From 58a1cd9aaea5193cc226c536180fe20b1642b8a3 Mon Sep 17 00:00:00 2001 From: Malte Brandy Date: Fri, 18 Jun 2021 17:54:56 +0200 Subject: [PATCH] Suppert flaky-nix on ci. --- nixos/roles/laminar/projects.nix | 9 +++++++-- overlays/pkgSets.nix | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/nixos/roles/laminar/projects.nix b/nixos/roles/laminar/projects.nix index 9791290f..55de6b45 100644 --- a/nixos/roles/laminar/projects.nix +++ b/nixos/roles/laminar/projects.nix @@ -8,8 +8,13 @@ let git show -q --oneline echo "Evaluating nix-expression." export FLAGS='--builders @/etc/nix/machines --max-jobs 0' - nix-instantiate --add-root ./drv --indirect $FLAGS - drv=$(readlink -f ./drv) + if [[ -e "flake.nix" ]]; then + echo "Flake detected. Using flake.nix" + drv=$(${pkgs.nixFlakes}/bin/flaky-nix eval --raw ".#defaultPackage.x86_64-linux".drvPath") + else + nix-instantiate --add-root ./drv --indirect $FLAGS + drv=$(readlink -f ./drv) + fi echo "Evaluation done." nix-jobs realise $drv laminarc set "RESULTDRV=$drv" diff --git a/overlays/pkgSets.nix b/overlays/pkgSets.nix index ec310754..76c4d68b 100644 --- a/overlays/pkgSets.nix +++ b/overlays/pkgSets.nix @@ -1,5 +1,6 @@ self: super: { # pkgs assumed to be present on a non nixos host + nixFlakes = self.writeShellScriptBin "flaky-nix" ''exec ${self.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@"''; core-system-pkgs = { inherit (self) gitFull gnumake mkpasswd file wget curl wireguard gnupg mutt bind liboping @@ -13,8 +14,8 @@ self: super: { htop tree pwgen borgbackup inotifyTools direnv socat nmap ncdu tcpdump tmux tig exa fzf ag fd bat ripgrep ranger pass sshuttle vnstat entr libargon2 mblaze niv compsize mediainfo asciinema gomuks nix-output-monitor fdroidserver jq cachix + nixFlakes ; - nixFlakes = self.writeShellScriptBin "flaky-nix" ''exec ${self.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@"''; }; my-home-pkgs = {