Handle locked secret.nix

This commit is contained in:
Alexander Bantyev 2020-04-29 01:50:53 +03:00
parent 2033cecc11
commit b88c4c7bf6
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5
3 changed files with 9 additions and 16 deletions

16
flake.lock generated
View File

@ -257,20 +257,18 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"info": { "info": {
"lastModified": 1587452212, "lastModified": 1588110642,
"narHash": "sha256-Sn9xtMrUYmXCT33yQjNh0tWFwY7jF5x4vCUrkcXDMCE=" "narHash": "sha256-A5Sqy2PAJOYaTIjHOTo3ZFbUtd1r6uZf9ymcbSyMh9Q="
}, },
"locked": { "locked": {
"owner": "nixos", "owner": "NixOS",
"repo": "nixpkgs-channels", "repo": "nixpkgs",
"rev": "22a3bf9fb9edad917fb6cd1066d58b5e426ee975", "rev": "a0ebabf60a3febbd0ba4b401b13503e1fae24934",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nixos", "id": "nixpkgs",
"ref": "nixos-unstable", "type": "indirect"
"repo": "nixpkgs-channels",
"type": "github"
} }
}, },
"nixpkgs_5": { "nixpkgs_5": {

View File

@ -5,12 +5,6 @@
edition = 201909; edition = 201909;
inputs = { inputs = {
nixpkgs = {
type = "github";
owner = "nixos";
repo = "nixpkgs-channels";
ref = "nixos-unstable";
};
NUR = { NUR = {
type = "github"; type = "github";
owner = "nix-community"; owner = "nix-community";

View File

@ -89,8 +89,9 @@ in rec {
}; };
}; };
config = let config = let
unlocked = import (pkgs.runCommand "check-secret" {} "set +e; grep -qI . ${../secret.nix}; echo $? > $out") == 0;
secretnix = import ../secret.nix; secretnix = import ../secret.nix;
secrets = if isNull secretnix then secrets = if ! unlocked || isNull secretnix then
mapAttrs (n: v: null) options.secrets mapAttrs (n: v: null) options.secrets
else else
secretnix; secretnix;