Simplify flake and expose host pkgs

The configuration of the machines is now moved to m/
This commit is contained in:
Rodrigo Arias 2023-06-14 17:28:00 +02:00
parent f787343f29
commit f4ac9f3186
31 changed files with 39 additions and 112 deletions

View File

@ -1,9 +0,0 @@
{ options, ... }:
{
nix.nixPath =
# Prepend default nixPath values.
options.nix.nixPath.default ++
# Append our nixpkgs-overlays.
[ "nixpkgs-overlays=${../overlays-compat}" ];
}

105
flake.nix
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +0,0 @@
self: super:
with super.lib;
let
# Load the system config and get the `nixpkgs.overlays` option
overlays = (import <nixpkgs/nixos> { }).config.nixpkgs.overlays;
in
# Apply all overlays to the input of the current "main" overlay
foldl' (flip extends) (_: super) overlays self