From cc63c41ba07bf75a6189e5a3447c9fa3d2d07acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Sun, 4 Dec 2022 20:53:20 +0100 Subject: [PATCH] Fix simd jobs --- flake.lock | 51 ++++++++++++++++++++---------- flake.nix | 92 +++++++++++++++++++++++++++++------------------------- 2 files changed, 83 insertions(+), 60 deletions(-) diff --git a/flake.lock b/flake.lock index 47802ec9..93798775 100644 --- a/flake.lock +++ b/flake.lock @@ -378,6 +378,22 @@ "type": "github" } }, + "nixos-mobilizon": { + "locked": { + "lastModified": 1664466500, + "narHash": "sha256-FvEUAKkf0PDZ2j2qIbI4+3oPTnuQq4HdX00iqBkvKOU=", + "owner": "minijackson", + "repo": "nixpkgs", + "rev": "8a43afd5579f58092d4bf616a0206f83d8062e1f", + "type": "github" + }, + "original": { + "owner": "minijackson", + "ref": "init-mobilizon", + "repo": "nixpkgs", + "type": "github" + } + }, "nixos-unstable": { "locked": { "lastModified": 1669542132, @@ -394,6 +410,22 @@ "type": "github" } }, + "nixos-unstable-simd": { + "locked": { + "lastModified": 1670178567, + "narHash": "sha256-mTUbgiMxtXRg0VL0518HlZhF/CSYUJmBuZnNkc1mlaU=", + "owner": "SuperSandro2000", + "repo": "nixpkgs", + "rev": "9f915b466b047207d391a8b651f2949cc528e1b6", + "type": "github" + }, + "original": { + "owner": "SuperSandro2000", + "ref": "nixos-unstable-simd", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1663264531, @@ -408,22 +440,6 @@ "type": "indirect" } }, - "nixpkgs-mobilizon": { - "locked": { - "lastModified": 1664466500, - "narHash": "sha256-FvEUAKkf0PDZ2j2qIbI4+3oPTnuQq4HdX00iqBkvKOU=", - "owner": "minijackson", - "repo": "nixpkgs", - "rev": "8a43afd5579f58092d4bf616a0206f83d8062e1f", - "type": "github" - }, - "original": { - "owner": "minijackson", - "ref": "init-mobilizon", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -523,8 +539,9 @@ "naersk": "naersk_2", "nixos": "nixos", "nixos-hardware": "nixos-hardware", + "nixos-mobilizon": "nixos-mobilizon", "nixos-unstable": "nixos-unstable", - "nixpkgs-mobilizon": "nixpkgs-mobilizon", + "nixos-unstable-simd": "nixos-unstable-simd", "oparl-scraper": "oparl-scraper", "openwrt": "openwrt", "openwrt-imagebuilder": "openwrt-imagebuilder", diff --git a/flake.nix b/flake.nix index df218a3e..354a9d1f 100644 --- a/flake.nix +++ b/flake.nix @@ -4,9 +4,10 @@ inputs = { # use sandro's fork full with cherry-picked fixes nixos.url = "github:SuperSandro2000/nixpkgs/nixos-22.11"; - nixpkgs-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon"; - nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixos-mobilizon.url = "github:minijackson/nixpkgs/init-mobilizon"; nixos-hardware.url = "github:nixos/nixos-hardware"; + nixos-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixos-unstable-simd.url = "github:SuperSandro2000/nixpkgs/nixos-unstable-simd"; affection-src = { url = "git+https://gitea.nek0.eu/nek0/affection"; @@ -173,7 +174,7 @@ }; }; - outputs = inputs@{ self, fenix, harmonia, heliwatch, microvm, naersk, nixos, nixos-hardware, nixos-unstable, caveman, oparl-scraper, scrapers, secrets, skyflake, sshlogd, sops-nix, spacemsg, ticker, tigger, yammat, zentralwerk, ... }: + outputs = inputs@{ self, fenix, harmonia, heliwatch, microvm, naersk, nixos, nixos-hardware, nixos-unstable, nixos-unstable-simd, caveman, oparl-scraper, scrapers, secrets, skyflake, sshlogd, sops-nix, spacemsg, ticker, tigger, yammat, zentralwerk, ... }: let inherit (nixos) lib; @@ -201,6 +202,37 @@ }; extraHostRegistry.hosts = import ./host-registry.nix; hostRegistry = lib.recursiveUpdate zwHostRegistry extraHostRegistry; + + # Our custom NixOS builder + nixosSystem' = + { nixpkgs ? inputs.nixos + , modules + , extraArgs ? { } + , specialArgs ? { } + , system ? "x86_64-linux" + }@args: + + { inherit args; } // nixpkgs.lib.nixosSystem { + inherit specialArgs system; + + modules = [ + ({ ... }: { + _module.args = extraArgs // { + inherit hostRegistry inputs zentralwerk; + }; + + nixpkgs = { + overlays = [ self.overlays ]; + }; + }) + + self.nixosModules.c3d2 + ./modules/audio-server.nix + ./modules/c3d2.nix + ./modules/stats.nix + ./modules/pi-sensors.nix + ] ++ modules; + }; in { overlays = import ./overlays { inherit nixos-unstable; @@ -216,31 +248,7 @@ packages = import ./packages.nix { inherit hostRegistry inputs lib microvm secrets self; }; - nixosConfigurations = let - nixosSystem' = - # Our custom NixOS builder - { nixpkgs ? inputs.nixos, modules, extraArgs ? {}, specialArgs ? { }, system ? "x86_64-linux" }: - nixpkgs.lib.nixosSystem { - inherit specialArgs system; - - modules = [ - ({ ... }: { - _module.args = extraArgs // { - inherit hostRegistry inputs zentralwerk; - }; - nixpkgs = { - overlays = [ self.overlays ]; - }; - }) - - self.nixosModules.c3d2 - ./modules/audio-server.nix - ./modules/c3d2.nix - ./modules/stats.nix - ./modules/pi-sensors.nix - ] ++ modules; - }; - in { + nixosConfigurations = { auth = nixosSystem' { modules = [ self.nixosModules.microvm @@ -501,7 +509,7 @@ mobilizon = nixosSystem' { # TODO: pending https://github.com/NixOS/nixpkgs/pull/119132 - nixpkgs = inputs.nixpkgs-mobilizon; + nixpkgs = inputs.nixos-mobilizon; modules = [ self.nixosModules.microvm ./hosts/mobilizon @@ -757,22 +765,20 @@ hydraJobs = lib.mapAttrs (_: nixos.lib.hydraJob) ( - lib.mapAttrs (_: nixosSystem: - nixosSystem.config.microvm.declaredRunner or nixosSystem.config.system.build.toplevel - ) self.nixosConfigurations + let + getBuildEntryPoint = _: nixosSystem: nixosSystem.config.microvm.declaredRunner or nixosSystem.config.system.build.toplevel; + in + lib.mapAttrs getBuildEntryPoint self.nixosConfigurations // lib.mapAttrs' (hostname: nixosSystem: lib.nameValuePair (hostname + "-simd") - (nixosSystem.config.microvm.declaredRunner or nixosSystem.config.system.build.toplevel hostname - (nixosSystem (nixosSystem.args // (with nixosSystem.args; { - hostname = hostname + "-simd"; - modules = modules ++ [ - { - sandro.simd.enable = lib.mkForce true; - } - ]; - inherit (inputs) nixpkgs; - }))) - ) + (getBuildEntryPoint null (nixosSystem' (nixosSystem.args // (with nixosSystem.args; { + modules = modules ++ [ + { + c3d2.simd.enable = lib.mkForce true; + } + ]; + nixpkgs = nixos-unstable-simd; + })))) ) self.nixosConfigurations // nixos.lib.filterAttrs (name: attr: (builtins.match ".+-tftproot" name != null && lib.isDerivation attr)