Skip to content

Commit

Permalink
allow to run ./deploy --build-only event if git-crypt is locked
Browse files Browse the repository at this point in the history
This will allow to test deployments in CI and also for contributors that
are not part of the core infrastructure team.
  • Loading branch information
zimbatm committed Apr 17, 2020
1 parent 1fdf33a commit 69cf40d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ jobs:
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
# Only needed for private caches
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- run: ./deploy --build-only
4 changes: 1 addition & 3 deletions deployment.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
let

secrets = import ./secrets;

secrets = import ./secrets.nix;
in
{

Expand Down
23 changes: 23 additions & 0 deletions secrets.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
with builtins;
let
# Copied from <nixpkgs/lib>
removeSuffix = suffix: str:
let
sufLen = stringLength suffix;
sLen = stringLength str;
in
if
sufLen <= sLen && suffix == substring (sLen - sufLen) sufLen str
then
substring 0 (sLen - sufLen) str
else
str;

# Copied from <nixpkgs/lib>
fileContents = file: removeSuffix "\n" (builtins.readFile file);

readSecret = name: fileContents (./secrets + "/${name}");
in
mapAttrs
(name: type: if type != "directory" then readSecret name else null)
(readDir ./secrets)

0 comments on commit 69cf40d

Please sign in to comment.