26 lines
901 B
Nix
26 lines
901 B
Nix
|
{ depot, lib, pkgs, ... }@args:
|
||
|
let
|
||
|
inherit (builtins) foldl' mapAttrs;
|
||
|
systemFor = configs:
|
||
|
(depot.third_party.nixos {
|
||
|
configuration = lib.fix
|
||
|
(config: foldl' lib.recursiveUpdate { } (map (c: c config) configs));
|
||
|
}).system;
|
||
|
systems = [ "porcorosso" ];
|
||
|
rebuilder = system:
|
||
|
pkgs.writeShellScriptBin "rebuilder" ''
|
||
|
set -ue
|
||
|
if [[ $EUID -ne 0 ]]; then
|
||
|
exec sudo "$0" "$@"
|
||
|
fi
|
||
|
|
||
|
system="$(nix-build -E '(import <depot> {}).ops.nixos.${system}' --no-out-link)"
|
||
|
nix-env -p /nix/var/nix/profiles/system --set "$system"
|
||
|
"$system/bin/switch-to-configuration" switch
|
||
|
'';
|
||
|
systemCfgs = lib.genAttrs systems
|
||
|
(name: import (./. + "/${name}") (args // { rebuilder = rebuilder name; }));
|
||
|
mapAttrValues = (f: set: mapAttrs (name: f) set);
|
||
|
systemDrvs = mapAttrValues (systemCfg: systemFor [ systemCfg ]) systemCfgs;
|
||
|
in systemDrvs
|