diff --git a/common/overlays.nix b/common/overlays.nix deleted file mode 100644 index fdf0706..0000000 --- a/common/overlays.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ options, ... }: - -{ - nix.nixPath = - # Prepend default nixPath values. - options.nix.nixPath.default ++ - # Append our nixpkgs-overlays. - [ "nixpkgs-overlays=${../overlays-compat}" ]; -} diff --git a/flake.nix b/flake.nix index d3fc4ae..54642d0 100644 --- a/flake.nix +++ b/flake.nix @@ -6,97 +6,22 @@ bscpkgs.url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; }; - outputs = { self, nixpkgs, agenix, bscpkgs, ... }: { + outputs = { self, nixpkgs, agenix, bscpkgs, ... }: +let + mkConf = name: nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit nixpkgs bscpkgs agenix; theFlake = self; }; + modules = [ "${self.outPath}/m/${name}/configuration.nix" ]; + }; +in + { nixosConfigurations = { - xeon01 = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ( {options, ...}: { - # Sel the nixos-config path to the one of the current flake - nixpkgs.overlays = [ bscpkgs.bscOverlay ]; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "bscpkgs=${bscpkgs}" - "nixos-config=${self.outPath}/xeon01/configuration.nix" - "nixpkgs-overlays=${self.outPath}/overlays-compat" - ]; - nix.registry.nixpkgs.flake = nixpkgs; - nix.registry.bscpkgs.flake = bscpkgs; - system.configurationRevision = - if self ? rev - then self.rev - else throw ("Refusing to build from a dirty Git tree!"); - }) - ./xeon01/configuration.nix - ]; - }; - xeon02 = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ( {options, ...}: { - # Sel the nixos-config path to the one of the current flake - nixpkgs.overlays = [ bscpkgs.bscOverlay ]; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "bscpkgs=${bscpkgs}" - "nixos-config=${self.outPath}/xeon02/configuration.nix" - "nixpkgs-overlays=${self.outPath}/overlays-compat" - ]; - nix.registry.nixpkgs.flake = nixpkgs; - nix.registry.bscpkgs.flake = bscpkgs; - system.configurationRevision = - if self ? rev - then self.rev - else throw ("Refusing to build from a dirty Git tree!"); - }) - ./xeon02/configuration.nix - ]; - }; - hut = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ( {options, ...}: { - # Sel the nixos-config path to the one of the current flake - nixpkgs.overlays = [ bscpkgs.bscOverlay ]; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "bscpkgs=${bscpkgs}" - "nixos-config=${self.outPath}/hut/configuration.nix" - "nixpkgs-overlays=${self.outPath}/overlays-compat" - ]; - nix.registry.nixpkgs.flake = nixpkgs; - nix.registry.bscpkgs.flake = bscpkgs; - system.configurationRevision = - if self ? rev - then self.rev - else throw ("Refusing to build from a dirty Git tree!"); - }) - agenix.nixosModules.default - ./hut/configuration.nix - ]; - }; - xeon08 = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ( {options, ...}: { - # Sel the nixos-config path to the one of the current flake - nixpkgs.overlays = [ bscpkgs.bscOverlay ]; - nix.nixPath = [ - "nixpkgs=${nixpkgs}" - "bscpkgs=${bscpkgs}" - "nixos-config=${self.outPath}/xeon08/configuration.nix" - "nixpkgs-overlays=${self.outPath}/overlays-compat" - ]; - nix.registry.nixpkgs.flake = nixpkgs; - nix.registry.bscpkgs.flake = bscpkgs; - system.configurationRevision = - if self ? rev - then self.rev - else throw ("Refusing to build from a dirty Git tree!"); - }) - ./xeon08/configuration.nix - ]; - }; + hut = mkConf "hut"; + owl1 = mkConf "owl1"; + owl2 = mkConf "owl2"; + xeon08 = mkConf "xeon08"; }; + + packages.x86_64-linux.hut = self.nixosConfigurations.hut.pkgs; }; } diff --git a/common/boot.nix b/m/common/boot.nix similarity index 100% rename from common/boot.nix rename to m/common/boot.nix diff --git a/common/fs.nix b/m/common/fs.nix similarity index 100% rename from common/fs.nix rename to m/common/fs.nix diff --git a/common/hw.nix b/m/common/hw.nix similarity index 100% rename from common/hw.nix rename to m/common/hw.nix diff --git a/common/main.nix b/m/common/main.nix similarity index 80% rename from common/main.nix rename to m/common/main.nix index 59d5286..ba50376 100644 --- a/common/main.nix +++ b/m/common/main.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, nixpkgs, bscpkgs, agenix, theFlake, ... }: { imports = [ @@ -11,6 +11,23 @@ ./users.nix ]; + nixpkgs.overlays = [ bscpkgs.bscOverlay ]; + + nix.nixPath = [ + "nixpkgs=${nixpkgs}" + "bscpkgs=${bscpkgs}" + "jungle=${theFlake.outPath}" + ]; + + nix.registry.nixpkgs.flake = nixpkgs; + nix.registry.bscpkgs.flake = bscpkgs; + nix.registry.jungle.flake = theFlake; + + system.configurationRevision = + if theFlake ? rev + then theFlake.rev + else throw ("Refusing to build from a dirty Git tree!"); + environment.systemPackages = with pkgs; [ vim wget git htop tmux pciutils tcpdump ripgrep nix-index nixos-option nix-diff ipmitool freeipmi ethtool lm_sensors ix cmake gnumake file tree diff --git a/common/net.nix b/m/common/net.nix similarity index 96% rename from common/net.nix rename to m/common/net.nix index 51f80f4..504246c 100644 --- a/common/net.nix +++ b/m/common/net.nix @@ -43,12 +43,12 @@ 10.0.40.143 oss02-ipmi0 # Node Entry for node: xeon01 (ID=15) - 10.0.40.1 xeon01 xeon01-eth0 + 10.0.40.1 xeon01 xeon01-eth0 owl1 10.0.42.1 xeon01-ib0 10.0.40.101 xeon01-ipmi0 # Node Entry for node: xeon02 (ID=16) - 10.0.40.2 xeon02 xeon02-eth0 + 10.0.40.2 xeon02 xeon02-eth0 owl2 10.0.42.2 xeon02-ib0 10.0.40.102 xeon02-ipmi0 diff --git a/common/slurm.nix b/m/common/slurm.nix similarity index 61% rename from common/slurm.nix rename to m/common/slurm.nix index 2da5a02..c208b88 100644 --- a/common/slurm.nix +++ b/m/common/slurm.nix @@ -6,7 +6,8 @@ controlMachine = "hut"; clusterName = "owl"; nodeName = [ - "xeon[01-02,07] Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=xeon" + "owl[1,2] Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=owl" + "hut Sockets=2 CoresPerSocket=14 ThreadsPerCore=2" ]; extraConfig = '' MpiDefault=pmix diff --git a/common/ssh.nix b/m/common/ssh.nix similarity index 100% rename from common/ssh.nix rename to m/common/ssh.nix diff --git a/common/users.nix b/m/common/users.nix similarity index 100% rename from common/users.nix rename to m/common/users.nix diff --git a/hut/configuration.nix b/m/hut/configuration.nix similarity index 89% rename from hut/configuration.nix rename to m/hut/configuration.nix index 423b18d..82d4c34 100644 --- a/hut/configuration.nix +++ b/m/hut/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, agenix, ... }: { imports = [ @@ -8,6 +8,7 @@ ./monitoring.nix ./nfs.nix ./slurm-daemon.nix + agenix.nixosModules.default ]; # Select the this using the ID to avoid mismatches diff --git a/hut/gitlab-runner.nix b/m/hut/gitlab-runner.nix similarity index 100% rename from hut/gitlab-runner.nix rename to m/hut/gitlab-runner.nix diff --git a/hut/monitoring.nix b/m/hut/monitoring.nix similarity index 100% rename from hut/monitoring.nix rename to m/hut/monitoring.nix diff --git a/hut/nfs.nix b/m/hut/nfs.nix similarity index 100% rename from hut/nfs.nix rename to m/hut/nfs.nix diff --git a/hut/secrets.nix b/m/hut/secrets.nix similarity index 100% rename from hut/secrets.nix rename to m/hut/secrets.nix diff --git a/hut/secrets/nosv-token.age b/m/hut/secrets/nosv-token.age similarity index 100% rename from hut/secrets/nosv-token.age rename to m/hut/secrets/nosv-token.age diff --git a/hut/secrets/ovni-token.age b/m/hut/secrets/ovni-token.age similarity index 100% rename from hut/secrets/ovni-token.age rename to m/hut/secrets/ovni-token.age diff --git a/hut/slurm-daemon.nix b/m/hut/slurm-daemon.nix similarity index 100% rename from hut/slurm-daemon.nix rename to m/hut/slurm-daemon.nix diff --git a/xeon01/configuration.nix b/m/owl1/configuration.nix similarity index 100% rename from xeon01/configuration.nix rename to m/owl1/configuration.nix diff --git a/xeon02/configuration.nix b/m/owl2/configuration.nix similarity index 100% rename from xeon02/configuration.nix rename to m/owl2/configuration.nix diff --git a/xeon08/configuration.nix b/m/xeon08/configuration.nix similarity index 100% rename from xeon08/configuration.nix rename to m/xeon08/configuration.nix diff --git a/xeon08/cpufreq.nix b/m/xeon08/cpufreq.nix similarity index 100% rename from xeon08/cpufreq.nix rename to m/xeon08/cpufreq.nix diff --git a/xeon08/fs.nix b/m/xeon08/fs.nix similarity index 100% rename from xeon08/fs.nix rename to m/xeon08/fs.nix diff --git a/xeon08/kernel/configs/defconfig b/m/xeon08/kernel/configs/defconfig similarity index 100% rename from xeon08/kernel/configs/defconfig rename to m/xeon08/kernel/configs/defconfig diff --git a/xeon08/kernel/configs/lockdep b/m/xeon08/kernel/configs/lockdep similarity index 100% rename from xeon08/kernel/configs/lockdep rename to m/xeon08/kernel/configs/lockdep diff --git a/xeon08/kernel/kernel.nix b/m/xeon08/kernel/kernel.nix similarity index 100% rename from xeon08/kernel/kernel.nix rename to m/xeon08/kernel/kernel.nix diff --git a/xeon08/kernel/lttng.nix b/m/xeon08/kernel/lttng.nix similarity index 100% rename from xeon08/kernel/lttng.nix rename to m/xeon08/kernel/lttng.nix diff --git a/xeon08/kernel/perf.nix b/m/xeon08/kernel/perf.nix similarity index 100% rename from xeon08/kernel/perf.nix rename to m/xeon08/kernel/perf.nix diff --git a/xeon08/slurm.nix b/m/xeon08/slurm.nix similarity index 100% rename from xeon08/slurm.nix rename to m/xeon08/slurm.nix diff --git a/xeon08/users.nix b/m/xeon08/users.nix similarity index 100% rename from xeon08/users.nix rename to m/xeon08/users.nix diff --git a/overlays-compat/overlays.nix b/overlays-compat/overlays.nix deleted file mode 100644 index 8a606c5..0000000 --- a/overlays-compat/overlays.nix +++ /dev/null @@ -1,8 +0,0 @@ -self: super: -with super.lib; -let - # Load the system config and get the `nixpkgs.overlays` option - overlays = (import { }).config.nixpkgs.overlays; -in - # Apply all overlays to the input of the current "main" overlay - foldl' (flip extends) (_: super) overlays self