1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00

krops: restructure expressions

This commit is contained in:
Kierán Meinhardt
2019-06-17 18:01:14 +02:00
parent 8878998844
commit ef573234ac

View File

@@ -1,8 +1,3 @@
{ catullus-ssh ? "root@catullus.r:22022"
, scardanelli-ssh ? "root@scardanelli.r:22022"
, homeros-ssh ? "root@homeros.r:22022"
, wilde-ssh ? "root@192.168.178.31:22"
}:
let
krops = builtins.fetchGit {
url = "https://cgit.krebsco.de/krops/";
@@ -12,7 +7,14 @@ let
pkgs = import "${krops}/pkgs" {};
importJson = (import <nixpkgs> {}).lib.importJSON;
niveum = path: {
niveum = {
lib.file = toString ./lib;
packages.file = toString ./packages;
configs.file = toString ./configs;
dot.file = toString ./dot;
modules.file = toString ./modules;
nixos-config.symlink = "system/configuration.nix";
nixpkgs.git = {
url = https://github.com/NixOS/nixpkgs-channels;
ref = (importJson ./nixpkgs.json).rev;
@@ -21,19 +23,6 @@ let
url = https://github.com/NixOS/nixpkgs-channels;
ref = "nixos-unstable";
};
system.file = toString path;
lib.file = toString ./lib;
packages.file = toString ./packages;
configs.file = toString ./configs;
dot.file = toString ./dot;
modules.file = toString ./modules;
nixos-config.symlink = "system/configuration.nix";
};
minimal = path: other: lib.evalSource [(niveum path // other)];
regular = path: name: minimal path {
home-manager.git = {
url = https://github.com/rycee/home-manager;
ref = "2ccbf43";
@@ -42,41 +31,24 @@ let
url = https://cgit.krebsco.de/stockholm;
ref = "1340e3fb";
};
secrets.pass = {
dir = toString ~/.password-store/niveum/systems;
inherit name;
};
art.file = toString ./art;
};
systems.scardanelli = pkgs.krops.writeDeploy "deploy-scardanelli" {
source = regular ./systems/scardanelli "scardanelli";
target = scardanelli-ssh;
regularSystem = path: name: extras: {
source = lib.evalSource [
(niveum // extras // {
system.file = toString path;
secrets.pass = {
dir = toString ~/.password-store/systems;
inherit name;
};
})
];
target = "root@${name}:22022";
};
in {
scardanelli = pkgs.krops.writeDeploy "deploy-scardanelli" (regularSystem systems/scardanelli "scardanelli" { art.file = toString ./art; });
homeros = pkgs.krops.writeDeploy "deploy-homeros" (regularSystem systems/homeros "homeros" { art.file = toString ./art; });
wilde = pkgs.krops.writeDeploy "deploy-wilde" (regularSystem systems/wilde "wilde" { art.file = toString ./art; });
systems.homeros = pkgs.krops.writeDeploy "deploy-homeros" {
source = regular ./systems/homeros "homeros";
target = homeros-ssh;
};
systems.wilde = pkgs.krops.writeDeploy "deploy-wilde" {
source = regular ./systems/wilde "wilde";
target = wilde-ssh;
};
systems.catullus = pkgs.krops.writeDeploy "deploy-catullus" {
source = minimal ./systems/catullus {
secrets.pass = {
dir = toString ~/.password-store;
name = "catullus";
};
stockholm.git = {
url = https://cgit.krebsco.de/stockholm;
ref = "1340e3fb";
};
};
target = catullus-ssh;
};
in systems // {
all = pkgs.writeScript "deploy-all" (lib.concatStringsSep "\n" (lib.attrValues systems));
catullus = pkgs.krops.writeDeploy "deploy-catullus" (regularSystem systems/catullus "catullus" {});
}