From 7e11e7751542a8a7089167b5ecbb07b4c16b4d90 Mon Sep 17 00:00:00 2001 From: Astro Date: Tue, 31 May 2022 22:07:32 +0200 Subject: [PATCH] flake.nix: fix memory leak by reorganizing hydraJobs --- flake.nix | 13 +++++-------- modules/autoupdate.nix | 4 ++-- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/flake.nix b/flake.nix index 2ad2a5d5..85e9ac84 100644 --- a/flake.nix +++ b/flake.nix @@ -620,18 +620,15 @@ rpi-netboot = ./modules/rpi-netboot.nix; }; - hydraJobs = forAllSystems (system: + hydraJobs = builtins.mapAttrs (_: nixpkgs.lib.hydraJob) ( - nixpkgs.lib.filterAttrs (_: toplevel: - system == toplevel.system - ) (builtins.mapAttrs (_: nixosSystem: + builtins.mapAttrs (_: nixosSystem: nixosSystem.config.system.build.toplevel - ) self.nixosConfigurations) + ) self.nixosConfigurations // nixpkgs.lib.filterAttrs (name: _: builtins.match ".+-tftproot" name != null - ) self.packages.${system} - ) - ); + ) self.packages.aarch64-linux + ); }; } diff --git a/modules/autoupdate.nix b/modules/autoupdate.nix index 559e2ca8..6987f89d 100644 --- a/modules/autoupdate.nix +++ b/modules/autoupdate.nix @@ -27,7 +27,7 @@ }; script = '' OLD=$(readlink /run/current-system) - NEW=$(curl -sLH "Accept: application/json" https://hydra.hq.c3d2.de/job/c3d2/nix-config/${pkgs.system}.$(hostname)/latest | jq -r .buildoutputs.out.path) + NEW=$(curl -sLH "Accept: application/json" https://hydra.hq.c3d2.de/job/c3d2/nix-config/$(hostname)/latest | jq -r .buildoutputs.out.path) if [ -z "$NEW" ] || [ "$NEW" = "null" ]; then echo "Unable to obtain updated system" exit 1 @@ -76,7 +76,7 @@ OLD=$(readlink /run/current-system) echo Current system: $(basename $OLD) - NEW=$(curl -sLH "Accept: application/json" https://hydra.hq.c3d2.de/job/c3d2/nix-config/${pkgs.system}.$(hostname)/latest | ${pkgs.jq}/bin/jq -r .buildoutputs.out.path) + NEW=$(curl -sLH "Accept: application/json" https://hydra.hq.c3d2.de/job/c3d2/nix-config/$(hostname)/latest | ${pkgs.jq}/bin/jq -r .buildoutputs.out.path) if [ -z "$NEW" ] || [ "$NEW" = "null" ]; then echo "Unable to obtain updated system" exit 1