depot/ops/nixos/default.nix
Luke Granger-Brown 1006e41bfb ops/nixos/porcorosso: create
Summary:
Adds porcorosso to the depot, and also adds the supporting Nix architecture required to make this work.

This also tests that encryption is working correctly.

Reviewers: tazjin

Reviewed By: tazjin

Subscribers: tazjin

Differential Revision: https://phab.lukegb.com/D8
2020-04-30 05:49:19 +01:00

25 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