Browse Source

update to 23.05 and other stuff

main
Dustin Frisch 1 year ago
parent
commit
a6a940d692
No known key found for this signature in database GPG Key ID: B4C3BF012D9B26BE
  1. 44
      flake.lock
  2. 16
      flake.nix
  3. 26
      gather.sh
  4. 2
      machines/manager/default.nix
  5. 11
      machines/manager/ldap.nix
  6. 13
      machines/manager/mpi.nix
  7. 19
      machines/manager/rdma.nix
  8. 2
      machines/manager/users.nix
  9. 9
      machines/node/users.nix
  10. 10
      modules/hostFile.nix
  11. 13
      shared/default.nix
  12. 11
      shared/rdma.nix
  13. 2
      shared/users.nix

44
flake.lock

@ -10,11 +10,11 @@
"stable": "stable" "stable": "stable"
}, },
"locked": { "locked": {
"lastModified": 1684127527,
"narHash": "sha256-tAzgb2jgmRaX9HETry38h2OvBf9YkHEH1fFvIJQV9A0=",
"lastModified": 1685163780,
"narHash": "sha256-tMwseHtEFDpO3WKeZKWqrKRAZI6TiEULidxEbzicuFg=",
"owner": "zhaofengli", "owner": "zhaofengli",
"repo": "colmena", "repo": "colmena",
"rev": "caf33af7d854c8d9b88a8f3dae7adb1c24c1407b",
"rev": "c61bebae1dc1d57237577080b1ca1e37a3fbcebf",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -30,11 +30,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1684783210,
"narHash": "sha256-hxRbwwBTu1G1u1EdI9nEo/n4HIsQIfNi+2BQ1nEoj/o=",
"lastModified": 1685450011,
"narHash": "sha256-/Az50GoWePZHL+Pkxy2ZuKW9zwIk+oVdzkR9xWomnpo=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "f0b9f374bb42fdcd57baa7d4448ac5d4788226bd",
"rev": "0d270372b21818eba342954220c1a30a7bdaba19",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -167,11 +167,11 @@
}, },
"gather": { "gather": {
"locked": { "locked": {
"lastModified": 1685458852,
"narHash": "sha256-w05QjsDxebdO6Hsfp60Run3tECsI6ucwoS1pPR1YLbk=",
"lastModified": 1685550922,
"narHash": "sha256-hShAmNFcHagm0tm+p8xaWEwl1XtKlPjS1fjO6HGdCFQ=",
"owner": "fooker", "owner": "fooker",
"repo": "gather.nix", "repo": "gather.nix",
"rev": "cd099d749f2050370d0cc42a496d537e61b9a6f4",
"rev": "c4cdc9b84053fe827b78c55d4f79e51c7fd15838",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -325,16 +325,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1684858140,
"narHash": "sha256-dQStox5GYrVlVNMvxxXs3xX9bXG7J7ttSjqUcVm8EaA=",
"lastModified": 1686513595,
"narHash": "sha256-H3JNqj7TEiMx5rd8lRiONvgFZvmf3kmwHI2umDdqgFY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a17f99dfcb9643200b3884ca195c69ae41d7f059",
"rev": "bb8b5735d6f7e06b9ddd27de115b0600c1ffbdb4",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-22.11",
"ref": "nixos-23.05",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -366,11 +366,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1684842236,
"narHash": "sha256-rYWsIXHvNhVQ15RQlBUv67W3YnM+Pd+DuXGMvCBq2IE=",
"lastModified": 1685361114,
"narHash": "sha256-4RjrlSb+OO+e1nzTExKW58o3WRwVGpXwj97iCta8aj4=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "61e567d6497bc9556f391faebe5e410e6623217f",
"rev": "ca2fdbf3edda2a38140184da6381d49f8206eaf4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -401,11 +401,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1684637723,
"narHash": "sha256-0vAxL7MVMhGbTkAyvzLvleELHjVsaS43p+PR1h9gzNQ=",
"lastModified": 1685434555,
"narHash": "sha256-aZl0yeaYX3T2L3W3yXOd3S9OfpS+8YUOT2b1KwrSf6E=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "4ccdfb573f323a108a44c13bb7730e42baf962a9",
"rev": "876846cde9762ae563f018c17993354875e2538e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -450,11 +450,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"lastModified": 1685518550,
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
"type": "github" "type": "github"
}, },
"original": { "original": {

16
flake.nix

@ -4,7 +4,7 @@
type = "github"; type = "github";
owner = "NixOS"; owner = "NixOS";
repo = "nixpkgs"; repo = "nixpkgs";
ref = "nixos-22.11";
ref = "nixos-23.05";
}; };
colmena = { colmena = {
@ -79,10 +79,22 @@
shellcheck.enable = true; shellcheck.enable = true;
}; };
}; };
gather = pkgs.writeShellScript "gather" ''
ROOT=${toString ./.}
MACHINES=( "$(${colmena}/bin/colmena eval -E '{nodes, ...}: ')" )
if [[ "$1" != "" ]]; then
else
mapfile -t MACHINES < <()
fi
'';
in in
pkgs.mkShell { pkgs.mkShell {
buildInputs = [ buildInputs = [
inputs.colmena.defaultPackage.${system}
colmena
#gather
] ++ (with pkgs; [ ] ++ (with pkgs; [
bash bash
gitAndTools.git gitAndTools.git

26
gather.sh

@ -0,0 +1,26 @@
#!/usr/bin/env bash
# Get all nodes with deployment data
NODES="$(colmena eval -E '
{nodes, lib, ...}:
with lib;
mapAttrs
(_: node: with node.config.deployment; "${targetUser}@${targetHost}")
nodes
')"
# Filter to single node if parameter is set
if [[ "$1" != "" ]]; then
NODES="$(jq "{ \"$1\" }" <<< "$NODES")"
fi
# Convert nodes to array of <user>@<host>
mapfile -t NODES < <(jq -r '.[]' <<< "$NODES")
for NODE in "${NODES[@]}"; do
echo "-- ${NODE} --"
ssh "${NODE}" "/run/gather" \
| tar xv --dereference --directory "." \
|| true
done

2
machines/manager/default.nix

@ -16,6 +16,8 @@ with lib;
#./gateway.nix #./gateway.nix
#./netinstall.nix #./netinstall.nix
./cache.nix ./cache.nix
./rdma.nix
./mpi.nix
]; ];
deployment = { deployment = {

11
machines/manager/ldap.nix

@ -45,17 +45,6 @@ in
}; };
}; };
}; };
declarativeContents.${baseDN} = ''
dn: ${baseDN}
objectClass: top
objectClass: dcObject
objectClass: organization
o: ${config.networking.domain}
dn: ou=users,${baseDN}
objectClass: top
objectClass: organizationalUnit
'';
}; };
sops.secrets."ldap/root/password" = { sops.secrets."ldap/root/password" = {

13
machines/manager/mpi.nix

@ -0,0 +1,13 @@
{ pkgs, lib, config, nodes, ... }:
with lib;
{
environment.etc."mpi/hosts" = {
text = concatMapStringsSep "\n"
(node: "${node.config.networking.hostName}")
(filter
(node: elem "node" node.config.deployment.tags)
(attrValues nodes));
};
}

19
machines/manager/rdma.nix

@ -0,0 +1,19 @@
{ pkgs, lib, config, ... }:
with lib;
{
systemd.services."opensm" = {
unitConfig = {
Before = [ "network.target" "remote-fs-pre.target" ];
ConditionPathExists = [ "/sys/class/infiniband_mad/abi_version" ];
};
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.opensm}/bin/opensm --guid '0x0002c9030052188b'";
};
wantedBy = [ "network-online.target" ];
};
}

2
machines/manager/users.nix

@ -13,7 +13,7 @@ with lib;
extraConfig = '' extraConfig = ''
EnableSSHKeysign yes EnableSSHKeysign yes
Host node-*.${config.networking.domain}
Host node-*.${config.networking.domain} node-*
HostbasedAuthentication yes HostbasedAuthentication yes
''; '';
}; };

9
machines/node/users.nix

@ -28,7 +28,10 @@ with lib;
''; '';
}; };
environment.etc."ssh/shosts.equiv".text = concatMapStringsSep "\n"
(node: node.config.networking.fqdn)
(attrValues nodes);
environment.etc."ssh/shosts.equiv".text = concatStringsSep "\n" (concatMap
(node: [
node.config.networking.hostName
node.config.networking.fqdn
])
(attrValues nodes));
} }

10
modules/hostFile.nix

@ -19,14 +19,6 @@ with lib;
]; ];
}; };
canonical = mkOption {
description = ''
Canonical host name
'';
type = types.str;
default = config.networking.fqdn;
};
aliases = mkOption { aliases = mkOption {
description = '' description = ''
Aliases for this host Aliases for this host
@ -41,7 +33,7 @@ with lib;
''; '';
type = types.listOf types.str; type = types.listOf types.str;
readOnly = true; readOnly = true;
default = (singleton config.hpc.hostFile.canonical) ++ config.hpc.hostFile.aliases;
default = [ config.networking.fqdn config.networking.hostName ] ++ config.hpc.hostFile.aliases;
}; };
}; };

13
shared/default.nix

@ -5,6 +5,7 @@
./network.nix ./network.nix
./users.nix ./users.nix
./ssh.nix ./ssh.nix
./rdma.nix
"${modulesPath}/profiles/headless.nix" "${modulesPath}/profiles/headless.nix"
"${modulesPath}/profiles/all-hardware.nix" "${modulesPath}/profiles/all-hardware.nix"
@ -26,10 +27,22 @@
console.keyMap = "de"; console.keyMap = "de";
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
openmpi
vim vim
wget wget
curl curl
tmux tmux
fd
ripgrep
zlib
htop
iotop
iftop
];
# Performance FTW!
boot.kernelParams = [
"mitigations=off"
]; ];
services.haveged.enable = true; services.haveged.enable = true;

11
shared/rdma.nix

@ -0,0 +1,11 @@
{ lib, pkgs, config, ... }:
with lib;
{
boot.kernelModules = [ "ib_umad" "ib_ipoib" ];
environment.systemPackages = [
pkgs.rdma-core
];
}

2
shared/users.nix

@ -21,7 +21,7 @@ in
users.ldap = { users.ldap = {
enable = true; enable = true;
server = "ldap://manager.${config.networking.domain}/";
server = "ldap://ldap.${config.networking.domain}/";
base = baseDN; base = baseDN;
daemon.enable = true; daemon.enable = true;

Loading…
Cancel
Save