diff --git a/common/main.nix b/common/main.nix index ef16e0c..ad54622 100644 --- a/common/main.nix +++ b/common/main.nix @@ -6,7 +6,6 @@ ./fs.nix ./hw.nix ./net.nix - ./overlays.nix ./ssh.nix ./users.nix ]; @@ -38,11 +37,12 @@ programs.zsh.enable = true; programs.zsh.histSize = 100000; + users.defaultUserShell = pkgs.zsh; # Copy the NixOS configuration file and link it from the resulting system # (/run/current-system/configuration.nix). This is useful in case you # accidentally delete configuration.nix. - system.copySystemConfiguration = true; + #system.copySystemConfiguration = true; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions diff --git a/common/overlays.nix b/common/overlays.nix index 2fb80d7..fdf0706 100644 --- a/common/overlays.nix +++ b/common/overlays.nix @@ -1,21 +1,9 @@ { options, ... }: -let - - bscpkgsSrc = builtins.fetchTarball "https://pm.bsc.es/gitlab/rarias/bscpkgs/-/archive/master/bscpkgs-master.tar.gz"; - bscpkgs = import "${bscpkgsSrc}/overlay.nix"; - -in - { nix.nixPath = # Prepend default nixPath values. options.nix.nixPath.default ++ # Append our nixpkgs-overlays. - [ "nixpkgs-overlays=/config/overlays-compat/" ] - ; - - nixpkgs.overlays = [ - bscpkgs - ]; + [ "nixpkgs-overlays=${../overlays-compat}" ]; } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c8d3383 --- /dev/null +++ b/flake.lock @@ -0,0 +1,87 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1682101079, + "narHash": "sha256-MdAhtjrLKnk2uiqun1FWABbKpLH090oeqCSiWemtuck=", + "owner": "ryantm", + "repo": "agenix", + "rev": "2994d002dcff5353ca1ac48ec584c7f6589fe447", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "bscpkgs": { + "locked": { + "lastModified": 1682521628, + "narHash": "sha256-uRIDCuJNt3rdikWiRcM3VPsQSk0vpQB1JO3Wx24psJo=", + "ref": "refs/heads/master", + "rev": "c775ee4d6f76aded05b08ae13924c302f18f9b2c", + "revCount": 807, + "type": "git", + "url": "https://pm.bsc.es/gitlab/rarias/bscpkgs.git" + }, + "original": { + "type": "git", + "url": "https://pm.bsc.es/gitlab/rarias/bscpkgs.git" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1673295039, + "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1669833724, + "narHash": "sha256-mlqo1r+TZUOuypWdrZHluxWL+E5WzXlUXNZ9Y0WLDFU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9a6aabc4740790ef3bbb246b86d029ccf6759658", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "bscpkgs": "bscpkgs", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index 0a90a63..70cdb8b 100644 --- a/flake.nix +++ b/flake.nix @@ -1,15 +1,57 @@ { - inputs.nixpkgs.url = "github:NixOS/nixpkgs/22.11"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/22.11"; + agenix.url = "github:ryantm/agenix"; + agenix.inputs.nixpkgs.follows = "nixpkgs"; + bscpkgs.url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; + }; - outputs = { nixpkgs, ... }: { + outputs = { self, nixpkgs, agenix, bscpkgs, ... }: { nixosConfigurations = { xeon01 = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - modules = [ ./xeon01/configuration.nix ]; + 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 + ]; }; xeon07 = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - modules = [ ./xeon07/configuration.nix ]; + 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}/xeon07/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 + ./xeon07/configuration.nix + ]; }; }; }; diff --git a/rebuild.sh b/rebuild.sh index 592ed38..5df9616 100755 --- a/rebuild.sh +++ b/rebuild.sh @@ -6,11 +6,14 @@ if [ "$(id -u)" != 0 ]; then fi host=$(hostname) -conf="$(readlink -f .)/${host}/configuration.nix" -if [ ! -e "$conf" ]; then - echo "Missing config $conf" - exit 1 -fi +#conf="$(readlink -f .)/${host}/configuration.nix" +# +#if [ ! -e "$conf" ]; then +# echo "Missing config $conf" +# exit 1 +#fi +# +#NIXOS_CONFIG="${conf}" nixos-rebuild switch -NIXOS_CONFIG="${conf}" nixos-rebuild switch +nixos-rebuild switch --flake . diff --git a/xeon01/slurm.nix b/xeon01/slurm.nix index 815c94a..672bfc5 100644 --- a/xeon01/slurm.nix +++ b/xeon01/slurm.nix @@ -6,7 +6,7 @@ controlMachine = "xeon07"; clusterName = "owl"; nodeName = [ - "xeon[01-02,07] Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=xeon" + "xeon[01-02,07] Sockets=2 CoresPerSocket=14 ThreadsPerCore=2 Feature=xeon" ]; }; } diff --git a/xeon07/configuration.nix b/xeon07/configuration.nix index df63508..4cb68cc 100644 --- a/xeon07/configuration.nix +++ b/xeon07/configuration.nix @@ -8,8 +8,6 @@ ./monitoring.nix ./nfs.nix ./slurm.nix - - ]; # Select the this using the ID to avoid mismatches @@ -26,8 +24,4 @@ prefixLength = 24; } ]; }; - - environment.systemPackages = with pkgs; [ - (pkgs.callPackage {}) - ]; }