From 95f6255f586e93e096d56de75add76d7560b9df1 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 28 Nov 2018 21:30:46 +0100 Subject: [PATCH] * krops: merge krebs-nixpkgs into krebs-source --- jeschli/krops.nix | 4 +--- krebs/krops.nix | 38 ++++++++++++++++++-------------------- lass/krops.nix | 4 +--- tv/krops.nix | 4 +--- 4 files changed, 21 insertions(+), 29 deletions(-) diff --git a/jeschli/krops.nix b/jeschli/krops.nix index fff014377..989abcdd0 100644 --- a/jeschli/krops.nix +++ b/jeschli/krops.nix @@ -1,14 +1,12 @@ { name }: let inherit (import ../krebs/krops.nix { inherit name; }) - krebs-nixpkgs krebs-source lib pkgs ; source = { test }: lib.evalSource [ - (krebs-nixpkgs { test = test; }) - krebs-source + (krebs-source { test = test; }) { nixos-config.symlink = "stockholm/jeschli/1systems/${name}/config.nix"; secrets = if test then { diff --git a/krebs/krops.nix b/krebs/krops.nix index 1058e73c0..ab7524941 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -7,28 +7,27 @@ # TODO document why pkgs should be used like this pkgs = import "${krops}/pkgs" {}; - krebs-nixpkgs = { test ? false }: if test then { - nixpkgs.file = { - path = toString (pkgs.fetchFromGitHub { - owner = "nixos"; - repo = "nixpkgs"; - rev = (lib.importJSON ./nixpkgs.json).rev; - sha256 = (lib.importJSON ./nixpkgs.json).sha256; - }); - useChecksum = true; + 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; + }; }; - } else { - nixpkgs.git = { - ref = (lib.importJSON ./nixpkgs.json).rev; - url = https://github.com/NixOS/nixpkgs; - }; - }; - - krebs-source = { 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) @@ -41,8 +40,7 @@ }; source ={ test }: lib.evalSource [ - (krebs-nixpkgs { test = test; }) - krebs-source + (krebs-source { test = test; }) { nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix"; secrets = if test then { diff --git a/lass/krops.nix b/lass/krops.nix index 26668de65..d64454ea5 100644 --- a/lass/krops.nix +++ b/lass/krops.nix @@ -1,6 +1,5 @@ { name }: let inherit (import ../krebs/krops.nix { inherit name; }) - krebs-nixpkgs krebs-source lib pkgs @@ -13,8 +12,7 @@ ; source = { test }: lib.evalSource [ - (krebs-nixpkgs { test = test; }) - krebs-source + (krebs-source { test = test; }) { nixos-config.symlink = "stockholm/lass/1systems/${name}/physical.nix"; secrets = if test then { diff --git a/tv/krops.nix b/tv/krops.nix index 3b60d3208..af0e8616a 100644 --- a/tv/krops.nix +++ b/tv/krops.nix @@ -1,15 +1,13 @@ { name }: rec { inherit (import ../krebs/krops.nix { inherit name; }) - krebs-nixpkgs krebs-source lib pkgs ; source = lib.evalSource [ - (krebs-nixpkgs { test = true; }) - krebs-source + (krebs-source { test = true; }) { nixos-config.symlink = "stockholm/tv/1systems/${name}/config.nix"; secrets.file = toString ./dummy_secrets;