File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 5050 }
5151 // optionalAttrs ( system == "x86_64-linux" || system == "aarch64-darwin" ) {
5252 grafana-agent = import ./grafana-agent { inherit inputs' ; } ;
53+ ci-matrix = pkgs . callPackage ./ci-matrix { } ;
54+ secret = import ./secret { inherit inputs' pkgs ; } ;
5355 }
5456 // optionalAttrs isLinux {
5557 folder-size-metrics = pkgs . callPackage ./folder-size-metrics { } ;
Original file line number Diff line number Diff line change 1+ {
2+ inputs' ,
3+ pkgs ,
4+ ...
5+ } : let
6+ agenix = inputs' . agenix . packages . agenix . override { ageBin = "${ pkgs . rage } /bin/rage" ; } ;
7+ in
8+ pkgs . writeShellApplication {
9+ name = "secret" ;
10+ text = ''
11+ #!/usr/bin/env bash
12+ set -euo pipefail
13+
14+ machine=""
15+ service=""
16+ secret=""
17+ vm=""
18+ export RULES=""
19+
20+ while [[ $# -gt 0 ]]; do
21+ case "$1" in
22+ --machine=*)
23+ machine="'' ${1#*=}"
24+ ;;
25+ --service=*)
26+ service="'' ${1#*=}"
27+ ;;
28+ --secret=*)
29+ secret="'' ${1#*=}"
30+ ;;
31+ --vm)
32+ vm="true"
33+ ;;
34+ --help)
35+ echo -e "NAME\n\
36+ secret\n\n\
37+ SYNOPSIS\n\
38+ secret [OPTION]\n\n\
39+ EXAMPLE\n\
40+ secret --machine=mymachine --service=myservice --secret=mysecret\n\n\
41+ DESCRIPTION\n\
42+ Secret is the command made for nix repos to get rid of the secret.nix when\n\
43+ you are using agenix. Secret must be used with mcl-secrets and mcl-host-info\n\
44+ modules from nixos-modules repository to work properly.\n\n\
45+ OPTIONS\n\
46+ --machine - Machine for which you want to create a secret.\n\
47+ --service - Service for which you want to create a secret.\n\
48+ --secret - Secret you want to encrypt.\n\
49+ --vm - Make secret for the vmVariant."
50+ exit 0
51+ ;;
52+ *)
53+ echo "Unknown option: $1"
54+ exit 1
55+ ;;
56+ esac
57+ shift
58+ done
59+
60+ if [[ -z "$machine" || -z "$service" || -z "$secret" ]]; then
61+ echo "You must specify machine, service, and secret"
62+ exit 1
63+ fi
64+
65+ if [ "$vm" = "true" ]; then
66+ RULES="$(nix eval --raw ".#nixosConfigurations.$machine-vm.config.virtualisation.vmVariant.mcl.secrets.services.$service.nix-file")"
67+ else
68+ RULES="$(nix eval --raw ".#nixosConfigurations.$machine.config.mcl.secrets.services.$service.nix-file")"
69+ fi
70+ "${ agenix } /bin/agenix" -e "$secret.age"
71+ '' ;
72+ }
You can’t perform that action at this time.
0 commit comments