Initial sops setup
This commit is contained in:
parent
c983f97916
commit
4faa28d561
6 changed files with 77 additions and 36 deletions
|
@ -5,10 +5,9 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports =
|
imports = [ # Include the results of the hardware scan.
|
||||||
[ # Include the results of the hardware scan.
|
./hardware-configuration.nix
|
||||||
./hardware-configuration.nix
|
];
|
||||||
];
|
|
||||||
|
|
||||||
# Use the systemd-boot EFI boot loader.
|
# Use the systemd-boot EFI boot loader.
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
@ -52,7 +51,6 @@
|
||||||
|
|
||||||
# Configure console keymap
|
# Configure console keymap
|
||||||
console.keyMap = "no";
|
console.keyMap = "no";
|
||||||
|
|
||||||
|
|
||||||
# Configure keymap in X11
|
# Configure keymap in X11
|
||||||
# services.xserver.xkb.layout = "us";
|
# services.xserver.xkb.layout = "us";
|
||||||
|
@ -81,22 +79,14 @@
|
||||||
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBDpeouwzFZoYA7AYARaJ/qdQHORJB2h1V73PXQYEAI7sDrc3kYwgZPbrZ3pGkGKaHBl45kiV6SYsC7191OCwIl8AAAAEc3NoOg== A"
|
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBDpeouwzFZoYA7AYARaJ/qdQHORJB2h1V73PXQYEAI7sDrc3kYwgZPbrZ3pGkGKaHBl45kiV6SYsC7191OCwIl8AAAAEc3NoOg== A"
|
||||||
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBHlAtX4mBifZZ8u6sJckCgA6skwN7aamVK+lQuXLQ6kQWJy7GlEXEmoR9RW/0UIrQYLC+wd8Q5MROkYpn+cHLSoAAAAEc3NoOg== B"
|
"sk-ecdsa-sha2-nistp256@openssh.com AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb20AAAAIbmlzdHAyNTYAAABBBHlAtX4mBifZZ8u6sJckCgA6skwN7aamVK+lQuXLQ6kQWJy7GlEXEmoR9RW/0UIrQYLC+wd8Q5MROkYpn+cHLSoAAAAEc3NoOg== B"
|
||||||
];
|
];
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [ ];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [ btop vim tailscale python3 htop ];
|
||||||
btop
|
|
||||||
vim
|
|
||||||
tailscale
|
|
||||||
python3
|
|
||||||
htop
|
|
||||||
];
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
# programs.firefox.enable = true;
|
# programs.firefox.enable = true;
|
||||||
services.tailscale.enable = true;
|
|
||||||
# Enable the OpenSSH daemon.
|
# Enable the OpenSSH daemon.
|
||||||
# List packages installed in system profile. To search, run:
|
# List packages installed in system profile. To search, run:
|
||||||
# $ nix search wget
|
# $ nix search wget
|
||||||
|
@ -115,15 +105,6 @@
|
||||||
|
|
||||||
# List services that you want to enable:
|
# List services that you want to enable:
|
||||||
|
|
||||||
# Enable the OpenSSH daemon.
|
|
||||||
services.openssh = {
|
|
||||||
enable = true;
|
|
||||||
settings = {
|
|
||||||
PermitRootLogin = "no";
|
|
||||||
PasswordAuthentication = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
nix.settings.trusted-users = [ "poseidon" ];
|
nix.settings.trusted-users = [ "poseidon" ];
|
||||||
# Open ports in the firewall.
|
# Open ports in the firewall.
|
||||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||||
|
|
|
@ -21,6 +21,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"homelabSecrets": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1747945363,
|
||||||
|
"narHash": "sha256-gKUhfQzbwtXTEQoPIAkOhlbyu/WQBPk+Tl2va7iwjKQ=",
|
||||||
|
"ref": "master",
|
||||||
|
"rev": "cc48a631fb9470e3a6a07ca8660b7caf56b0ae06",
|
||||||
|
"shallow": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://forgejo@code.polsevev.dev/polsevev/nix-secrets-homelab.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"ref": "master",
|
||||||
|
"shallow": true,
|
||||||
|
"type": "git",
|
||||||
|
"url": "ssh://forgejo@code.polsevev.dev/polsevev/nix-secrets-homelab.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1747676747,
|
"lastModified": 1747676747,
|
||||||
|
@ -40,7 +58,29 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"disko": "disko",
|
"disko": "disko",
|
||||||
"nixpkgs": "nixpkgs"
|
"homelabSecrets": "homelabSecrets",
|
||||||
|
"nixpkgs": "nixpkgs",
|
||||||
|
"sops-nix": "sops-nix"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sops-nix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1747603214,
|
||||||
|
"narHash": "sha256-lAblXm0VwifYCJ/ILPXJwlz0qNY07DDYdLD+9H+Wc8o=",
|
||||||
|
"owner": "mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"rev": "8d215e1c981be3aa37e47aeabd4e61bb069548fd",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "mic92",
|
||||||
|
"repo": "sops-nix",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,16 +4,28 @@
|
||||||
inputs = {
|
inputs = {
|
||||||
# NixOS official package source, using the nixos-24.11 branch here
|
# NixOS official package source, using the nixos-24.11 branch here
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||||
disko = {
|
disko = {
|
||||||
url = "github:nix-community/disko/latest";
|
url = "github:nix-community/disko/latest";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
sops-nix = {
|
||||||
|
url = "github:mic92/sops-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
};
|
||||||
|
# Personal Repositories
|
||||||
|
homelabSecrets = {
|
||||||
|
url =
|
||||||
|
"git+ssh://forgejo@code.polsevev.dev/polsevev/nix-secrets-homelab.git?ref=master&shallow=1";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, disko, ... }@inputs: {
|
outputs = { self, nixpkgs, disko, ... }@inputs: {
|
||||||
# Please replace my-nixos with your hostname
|
# Please replace my-nixos with your hostname
|
||||||
nixosConfigurations.poseidon = nixpkgs.lib.nixosSystem {
|
nixosConfigurations.poseidon = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
specialArgs = { inherit inputs; };
|
||||||
modules = [
|
modules = [
|
||||||
# Import the previous configuration.nix we used,
|
# Import the previous configuration.nix we used,
|
||||||
# so the old configuration file still takes effect
|
# so the old configuration file still takes effect
|
||||||
|
@ -21,7 +33,11 @@
|
||||||
./configuration.nix
|
./configuration.nix
|
||||||
./disko-config.nix
|
./disko-config.nix
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
../shared/tailscale.nix
|
||||||
|
../shared/ssh.nix
|
||||||
|
../shared/sops.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
{ config, pkgs, homelabSecrets, ... }:
|
{ config, inputs, ... }:
|
||||||
let secretsPath = inputs.homelabSecrets;
|
let secretsPath = builtins.toString inputs.homelabSecrets;
|
||||||
in {
|
in {
|
||||||
imports = [
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
inputs.sops-nix.nixosModules.sops
|
|
||||||
];
|
|
||||||
|
|
||||||
sops = {
|
sops = {
|
||||||
defaultSopsFile = "${secretsPath}/secrets.yaml";
|
defaultSopsFile = "${secretsPath}/secrets.yaml";
|
||||||
validateSopsFile = false;
|
age = {
|
||||||
|
sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
|
||||||
|
keyFile = "/var/lib/sops-nix/key.txt";
|
||||||
|
generateKey = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
sops.secrets = { "tailscale/preauthkeys/poseidon" = { }; };
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
PermitRootLogin = "no";
|
PermitRootLogin = "no";
|
||||||
PasswordAuthentication = true;
|
PasswordAuthentication = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
authKeyFile = config.sops.secrets."tailscale.preauthkeys.poseidon".path;
|
authKeyFile = config.sops.secrets."tailscale/preauthkeys/poseidon".path;
|
||||||
extraUpFlags =
|
extraUpFlags =
|
||||||
[ "--login-server=https://headscale.polsevev.dev" "--accept-dns=false" ];
|
[ "--login-server=https://headscale.polsevev.dev" "--accept-dns=false" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue