Add secret handling
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
{
|
||||
imports = [
|
||||
./secrets.nix
|
||||
./sh.nix
|
||||
./tmux.nix
|
||||
./git.nix
|
||||
@@ -18,6 +19,10 @@
|
||||
yaml-language-server
|
||||
marksman
|
||||
dockerfile-language-server
|
||||
|
||||
# Secrets management
|
||||
sops
|
||||
age
|
||||
];
|
||||
|
||||
news.display = "silent";
|
||||
|
||||
17
nix/modules/home/secrets.nix
Normal file
17
nix/modules/home/secrets.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ inputs, config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.sops-nix.homeManagerModules.sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
defaultSopsFile = ../../secrets/secrets.yaml;
|
||||
defaultSopsFormat = "yaml";
|
||||
|
||||
age = {
|
||||
# This is the default location for the age key
|
||||
keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,10 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./secrets.nix
|
||||
];
|
||||
|
||||
time.timeZone = "Europe/Berlin";
|
||||
i18n.defaultLocale = "en_US.UTF-8";
|
||||
|
||||
|
||||
21
nix/modules/nixos/secrets.nix
Normal file
21
nix/modules/nixos/secrets.nix
Normal file
@@ -0,0 +1,21 @@
|
||||
{ inputs, config, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
inputs.sops-nix.nixosModules.sops
|
||||
];
|
||||
|
||||
sops = {
|
||||
defaultSopsFile = ../../secrets/secrets.yaml;
|
||||
defaultSopsFormat = "yaml";
|
||||
|
||||
age = {
|
||||
# This will automatically import the SSH keys as age keys
|
||||
sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||
# This is where the age key for sops-nix is stored
|
||||
keyFile = "/var/lib/sops-nix/key.txt";
|
||||
# This will generate a new age key from the SSH key if it doesn't exist
|
||||
generateKey = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user