feat(sops): add sops-nix input, core module and devShell tooling
Wires sops-nix into every machine via machines/core/sops.nix so hosts decrypt with their existing SSH host key. Adds a devShell exposing sops/age/ssh-to-age for the operator workflow, which also fixes .envrc's previously no-op `use flake`.
This commit is contained in:
@@ -1 +1,3 @@
|
||||
AGENTS.md
|
||||
*.dec
|
||||
keys.txt
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
keys:
|
||||
- &admin_finn age1a0v442ct2qfjcdhyktn25spw02yq4fl08plrrvuradwwxzsle4mq8thln4
|
||||
- &host_mibook age1n3uqtee5ymykrls6k04dznq50cwmj99hw7ny83yxjndt4y2ncf5qhjwa2p
|
||||
# - &host_jupiter age1... # TODO: Phase 9, see docs/secrets.md
|
||||
|
||||
creation_rules:
|
||||
- path_regex: ^secrets/mibook\.yaml$
|
||||
key_groups:
|
||||
- age:
|
||||
- *admin_finn
|
||||
- *host_mibook
|
||||
# - path_regex: ^secrets/jupiter\.yaml$ # TODO: Phase 9
|
||||
# key_groups:
|
||||
# - age: [ *admin_finn, *host_jupiter ]
|
||||
# - path_regex: ^secrets/common\.yaml$ # TODO: Phase 9
|
||||
# key_groups:
|
||||
# - age: [ *admin_finn, *host_mibook, *host_jupiter ]
|
||||
Generated
+22
-1
@@ -264,7 +264,28 @@
|
||||
"nixos-generators": "nixos-generators",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs-unstable": "nixpkgs-unstable"
|
||||
"nixpkgs-unstable": "nixpkgs-unstable",
|
||||
"sops-nix": "sops-nix"
|
||||
}
|
||||
},
|
||||
"sops-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1788337237,
|
||||
"narHash": "sha256-gkSH8VUtCo6hnysNmb9DbTuDepH2t5pv+QWjP75xKAk=",
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"rev": "fbf759290e0cb0a98dfc813a4eb7d53ad1dacb57",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Mic92",
|
||||
"repo": "sops-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
url = "github:nix-community/nixos-generators";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
sops-nix = {
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
@@ -36,6 +40,15 @@
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
ssh-to-age
|
||||
nixfmt
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
systems = [ "x86_64-linux" ];
|
||||
|
||||
@@ -4,6 +4,7 @@ let
|
||||
nixpkgs
|
||||
nixpkgs-unstable
|
||||
nixos-hardware
|
||||
sops-nix
|
||||
#hyprland
|
||||
;
|
||||
nixosSystem = nixpkgs.lib.makeOverridable nixpkgs.lib.nixosSystem;
|
||||
@@ -40,6 +41,7 @@ let
|
||||
];
|
||||
}
|
||||
../modules
|
||||
sops-nix.nixosModules.sops
|
||||
# ../profiles
|
||||
];
|
||||
defaultModules = baseModules ++ customModules;
|
||||
|
||||
@@ -3,5 +3,6 @@
|
||||
./modules.nix
|
||||
./network.nix
|
||||
./nix.nix
|
||||
./sops.nix
|
||||
./users.nix
|
||||
]
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
# sops-nix plumbing — applied to every machine.
|
||||
# See docs/secrets.md for the day-to-day workflow.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
{
|
||||
# Each host defaults to its own secrets/<hostname>.yaml. Override per-secret
|
||||
# with sops.secrets.<name>.sopsFile for shared files.
|
||||
sops.defaultSopsFile = lib.mkDefault (../../secrets + "/${config.networking.hostName}.yaml");
|
||||
sops.defaultSopsFormat = "yaml";
|
||||
sops.validateSopsFiles = true;
|
||||
|
||||
# Decrypt with the host's own SSH host key, converted to age.
|
||||
# Explicit rather than inheriting the openssh-derived default, so this does
|
||||
# not silently break if services.openssh is ever disabled.
|
||||
sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
sops.age.generateKey = false;
|
||||
|
||||
# Age only. The default here is the RSA host key imported as a GPG key,
|
||||
# which is deprecated and an extra failure surface.
|
||||
sops.gnupg.sshKeyPaths = [ ];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
sops
|
||||
age
|
||||
ssh-to-age
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user