Lock flakes and add inputs

This commit is contained in:
Rodrigo Arias 2023-04-26 17:36:36 +02:00
parent 543983e9f3
commit 44fcb97ec7
7 changed files with 146 additions and 32 deletions

View File

@ -6,7 +6,6 @@
./fs.nix ./fs.nix
./hw.nix ./hw.nix
./net.nix ./net.nix
./overlays.nix
./ssh.nix ./ssh.nix
./users.nix ./users.nix
]; ];
@ -38,11 +37,12 @@
programs.zsh.enable = true; programs.zsh.enable = true;
programs.zsh.histSize = 100000; programs.zsh.histSize = 100000;
users.defaultUserShell = pkgs.zsh;
# Copy the NixOS configuration file and link it from the resulting system # Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you # (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix. # accidentally delete configuration.nix.
system.copySystemConfiguration = true; #system.copySystemConfiguration = true;
# This value determines the NixOS release from which the default # This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions # settings for stateful data, like file locations and database versions

View File

@ -1,21 +1,9 @@
{ options, ... }: { 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 = nix.nixPath =
# Prepend default nixPath values. # Prepend default nixPath values.
options.nix.nixPath.default ++ options.nix.nixPath.default ++
# Append our nixpkgs-overlays. # Append our nixpkgs-overlays.
[ "nixpkgs-overlays=/config/overlays-compat/" ] [ "nixpkgs-overlays=${../overlays-compat}" ];
;
nixpkgs.overlays = [
bscpkgs
];
} }

87
flake.lock Normal file
View File

@ -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
}

View File

@ -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 = { nixosConfigurations = {
xeon01 = nixpkgs.lib.nixosSystem { xeon01 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; 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 { xeon07 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; 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
];
}; };
}; };
}; };

View File

@ -6,11 +6,14 @@ if [ "$(id -u)" != 0 ]; then
fi fi
host=$(hostname) host=$(hostname)
conf="$(readlink -f .)/${host}/configuration.nix"
if [ ! -e "$conf" ]; then #conf="$(readlink -f .)/${host}/configuration.nix"
echo "Missing config $conf" #
exit 1 #if [ ! -e "$conf" ]; then
fi # echo "Missing config $conf"
# exit 1
#fi
#
#NIXOS_CONFIG="${conf}" nixos-rebuild switch
NIXOS_CONFIG="${conf}" nixos-rebuild switch nixos-rebuild switch --flake .

View File

@ -6,7 +6,7 @@
controlMachine = "xeon07"; controlMachine = "xeon07";
clusterName = "owl"; clusterName = "owl";
nodeName = [ 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"
]; ];
}; };
} }

View File

@ -8,8 +8,6 @@
./monitoring.nix ./monitoring.nix
./nfs.nix ./nfs.nix
./slurm.nix ./slurm.nix
<agenix/modules/age.nix>
]; ];
# Select the this using the ID to avoid mismatches # Select the this using the ID to avoid mismatches
@ -26,8 +24,4 @@
prefixLength = 24; prefixLength = 24;
} ]; } ];
}; };
environment.systemPackages = with pkgs; [
(pkgs.callPackage <agenix/pkgs/agenix.nix> {})
];
} }