summaryrefslogtreecommitdiffstats
path: root/krebs/krops.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-11-28 22:19:52 +0100
committermakefu <github@syntax-fehler.de>2018-11-28 22:19:52 +0100
commitee4ffd2fcfd8c3906eb9bf4651c8a6fb70f6f3ea (patch)
tree82e9ff79db74ccc03f87c3c66972317ef3031a0d /krebs/krops.nix
parent26c897d72ce24a300b871a737c74742f35221006 (diff)
parent95f6255f586e93e096d56de75add76d7560b9df1 (diff)
Merge remote-tracking branch 'lassul.us/master'
Diffstat (limited to 'krebs/krops.nix')
-rw-r--r--krebs/krops.nix44
1 files changed, 26 insertions, 18 deletions
diff --git a/krebs/krops.nix b/krebs/krops.nix
index 763e76b83..ab7524941 100644
--- a/krebs/krops.nix
+++ b/krebs/krops.nix
@@ -7,15 +7,27 @@
# TODO document why pkgs should be used like this
pkgs = import "${krops}/pkgs" {};
- krebs-source = {
- nixpkgs.git = {
- ref = (lib.importJSON ./nixpkgs.json).rev;
- url = https://github.com/NixOS/nixpkgs;
+ krebs-source = { test ? false }: rec {
+ nixpkgs = if test then {
+ file = {
+ path = toString (pkgs.fetchFromGitHub {
+ owner = "nixos";
+ repo = "nixpkgs";
+ rev = (lib.importJSON ./nixpkgs.json).rev;
+ sha256 = (lib.importJSON ./nixpkgs.json).sha256;
+ });
+ useChecksum = true;
+ };
+ } else {
+ git = {
+ ref = (lib.importJSON ./nixpkgs.json).rev;
+ url = https://github.com/NixOS/nixpkgs;
+ };
};
stockholm.file = toString ../.;
stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" ''
set -efu
- cd ${lib.escapeShellArg krebs-source.stockholm.file}
+ cd ${lib.escapeShellArg stockholm.file}
V=$(${pkgs.coreutils}/bin/date +%y.%m)
if test -d .git; then
V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty)
@@ -28,21 +40,17 @@
};
source ={ test }: lib.evalSource [
- krebs-source
+ (krebs-source { test = test; })
{
nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix";
- secrets =
- if test
- then {
- file = toString <stockholm/krebs/0tests/data/secrets>;
- }
- else {
- pass = {
- dir = "${lib.getEnv "HOME"}/brain";
- name = "krebs-secrets/${name}";
- };
- }
- ;
+ secrets = if test then {
+ file = toString <stockholm/krebs/0tests/data/secrets>;
+ } else {
+ pass = {
+ dir = "${lib.getEnv "HOME"}/brain";
+ name = "krebs-secrets/${name}";
+ };
+ };
}
];