2018-09-08 12:01:42 +02:00
|
|
|
{ config ? config, name, target ? name }: let
|
2018-08-29 00:24:34 +02:00
|
|
|
krops = builtins.fetchGit {
|
|
|
|
url = https://cgit.krebsco.de/krops/;
|
|
|
|
rev = "4e466eaf05861b47365c5ef46a31a188b70f3615";
|
|
|
|
};
|
|
|
|
nixpkgs-src = lib.importJSON ./nixpkgs.json;
|
|
|
|
|
2018-09-08 12:01:42 +02:00
|
|
|
lib = import "${krops}/lib";
|
2018-08-29 00:24:34 +02:00
|
|
|
pkgs = import "${krops}/pkgs" {};
|
2018-09-08 12:01:42 +02:00
|
|
|
|
|
|
|
host-src = {
|
2018-08-29 00:24:34 +02:00
|
|
|
secure = false;
|
|
|
|
full = false;
|
|
|
|
torrent = false;
|
|
|
|
hw = false;
|
|
|
|
musnix = false;
|
|
|
|
python = false;
|
|
|
|
unstable = false; #unstable channel checked out
|
|
|
|
mic92 = false;
|
|
|
|
nms = false;
|
2018-09-17 00:24:05 +02:00
|
|
|
arm6 = false;
|
2018-08-29 00:24:34 +02:00
|
|
|
clever_kexec = false;
|
|
|
|
} // import (./. + "/1systems/${name}/source.nix");
|
|
|
|
source = { test }: lib.evalSource [
|
|
|
|
{
|
|
|
|
# nixos-18.03 @ 2018-08-06
|
|
|
|
# + do_sqlite3 ruby: 55a952be5b5
|
|
|
|
# + exfat-nofuse bump: ee6a5296a35
|
|
|
|
# + uhub/sqlite: 5dd7610401747
|
2018-09-08 12:01:42 +02:00
|
|
|
nixpkgs = if test || host-src.full then {
|
|
|
|
git.ref = nixpkgs-src.rev;
|
|
|
|
git.url = nixpkgs-src.url;
|
2018-09-17 00:24:05 +02:00
|
|
|
} else if host-src.arm6 then {
|
|
|
|
# TODO: we want to track the unstable channel
|
|
|
|
symlink = "/nix/var/nix/profiles/per-user/root/channels/nixos/";
|
2018-09-08 12:01:42 +02:00
|
|
|
} else {
|
|
|
|
file = "/home/makefu/store/${nixpkgs-src.rev}";
|
2018-08-29 00:24:34 +02:00
|
|
|
};
|
|
|
|
nixos-config.symlink = "stockholm/makefu/1systems/${name}/config.nix";
|
|
|
|
|
2018-09-08 12:01:42 +02:00
|
|
|
stockholm.file = toString ./..;
|
2018-08-29 00:24:34 +02:00
|
|
|
secrets = if test then {
|
2018-09-08 12:01:42 +02:00
|
|
|
file = toString ./0tests/data/secrets;
|
2018-08-29 00:24:34 +02:00
|
|
|
} else {
|
|
|
|
pass = {
|
|
|
|
dir = "${lib.getEnv "HOME"}/.secrets-pass";
|
|
|
|
inherit name;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2018-09-08 12:01:42 +02:00
|
|
|
(lib.mkIf (host-src.torrent) {
|
2018-08-29 00:24:34 +02:00
|
|
|
torrent-secrets = if test then {
|
2018-09-08 12:01:42 +02:00
|
|
|
file = toString ./0tests/data/secrets;
|
2018-08-29 00:24:34 +02:00
|
|
|
} else {
|
|
|
|
pass = {
|
|
|
|
dir = "${lib.getEnv "HOME"}/.secrets-pass";
|
|
|
|
name = "torrent";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
})
|
2018-09-08 12:01:42 +02:00
|
|
|
(lib.mkIf ( host-src.musnix ) {
|
2018-08-29 00:24:34 +02:00
|
|
|
musnix.git = {
|
|
|
|
url = https://github.com/musnix/musnix.git;
|
|
|
|
ref = "master"; # follow the musnix channel, lets see how this works out
|
|
|
|
};
|
|
|
|
})
|
2018-09-08 12:01:42 +02:00
|
|
|
(lib.mkIf ( host-src.hw ) {
|
2018-08-29 00:24:34 +02:00
|
|
|
nixos-hardware.git = {
|
|
|
|
url = https://github.com/nixos/nixos-hardware.git;
|
|
|
|
ref = "30fdd53";
|
|
|
|
};
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
in {
|
|
|
|
# usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy)
|
|
|
|
deploy = pkgs.krops.writeDeploy "${name}-deploy" {
|
|
|
|
source = source { test = false; };
|
2018-09-08 12:01:42 +02:00
|
|
|
target = "root@${target}/var/src";
|
2018-08-29 00:24:34 +02:00
|
|
|
};
|
|
|
|
|
2018-09-09 10:23:20 +02:00
|
|
|
# usage: $(nix-build --no-out-link --argstr name HOSTNAME --argstr target PATH -A test)
|
2018-09-09 19:16:57 +02:00
|
|
|
test = { target ? target }: pkgs.krops.writeTest "${name}-test" {
|
2018-09-09 10:23:20 +02:00
|
|
|
inherit target;
|
2018-08-29 00:24:34 +02:00
|
|
|
source = source { test = true; };
|
2018-09-08 12:10:45 +02:00
|
|
|
};
|
2018-08-29 00:24:34 +02:00
|
|
|
}
|