mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 17:31:34 +01:00
Compare commits
3 commits
2db3be17a6
...
1c61682e5a
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c61682e5a | |||
| 72ed799826 | |||
| 2f4a83a906 |
16 changed files with 73 additions and 42 deletions
|
|
@ -26,10 +26,7 @@
|
||||||
services = {
|
services = {
|
||||||
gc.enable = true;
|
gc.enable = true;
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
tailscale = {
|
tailscale.enable = true;
|
||||||
enable = true;
|
|
||||||
ssh.enable = true;
|
|
||||||
};
|
|
||||||
nebula.node = {
|
nebula.node = {
|
||||||
enable = true;
|
enable = true;
|
||||||
address = "10.254.250.1";
|
address = "10.254.250.1";
|
||||||
|
|
|
||||||
|
|
@ -29,10 +29,7 @@
|
||||||
wlan.enable = true;
|
wlan.enable = true;
|
||||||
bluetooth.enable = true;
|
bluetooth.enable = true;
|
||||||
sound.enable = true;
|
sound.enable = true;
|
||||||
tailscale = {
|
tailscale.enable = true;
|
||||||
enable = true;
|
|
||||||
ssh.enable = true;
|
|
||||||
};
|
|
||||||
nebula.node = {
|
nebula.node = {
|
||||||
enable = true;
|
enable = true;
|
||||||
address = "10.254.250.3";
|
address = "10.254.250.3";
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@
|
||||||
boot.loader.grub.enable = true;
|
boot.loader.grub.enable = true;
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
tailscale = {
|
tailscale.enable = true;
|
||||||
enable = true;
|
|
||||||
ssh.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nebula.node = {
|
nebula.node = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
services = {
|
services = {
|
||||||
tailscale = {
|
tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
ssh.enable = true;
|
|
||||||
exitNode.enable = true;
|
exitNode.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
tailscale = {
|
tailscale.enable = true;
|
||||||
enable = true;
|
|
||||||
ssh.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
nebula.node = {
|
nebula.node = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,11 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
ssh = {
|
lazygit.enable = true;
|
||||||
enable = true;
|
|
||||||
enableDefaultConfig = false;
|
ssh.matchBlocks =
|
||||||
matchBlocks =
|
|
||||||
config.custom.sops.secrets.ssh-key
|
config.custom.sops.secrets.ssh-key
|
||||||
|> lib.mapAttrs (name: _: { identityFile = config.sops.secrets."ssh-key/${name}".path; });
|
|> lib.mapAttrs (name: _: { identityFile = config.sops.secrets."ssh-key/${name}".path; });
|
||||||
};
|
};
|
||||||
|
|
||||||
lazygit.enable = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
29
modules/home/programs/ssh.nix
Normal file
29
modules/home/programs/ssh.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}@moduleArgs:
|
||||||
|
let
|
||||||
|
cfg = config.custom.programs.ssh;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.custom.programs.ssh = {
|
||||||
|
enable = lib.mkEnableOption "";
|
||||||
|
hostName = lib.mkOption {
|
||||||
|
type = lib.types.nonEmptyStr;
|
||||||
|
default = moduleArgs.osConfig.networking.hostName or "";
|
||||||
|
};
|
||||||
|
publicKeyPath = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "${self}/users/${config.home.username}/@${cfg.hostName}/keys/ssh.pub";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf config.custom.programs.ssh.enable {
|
||||||
|
programs.ssh = {
|
||||||
|
enable = true;
|
||||||
|
enableDefaultConfig = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -7,36 +7,35 @@
|
||||||
}@moduleArgs:
|
}@moduleArgs:
|
||||||
let
|
let
|
||||||
cfg = config.custom.sops;
|
cfg = config.custom.sops;
|
||||||
|
|
||||||
absoluteSecretsPath = "${self}/${cfg.secretsFile}";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.sops.homeManagerModules.sops ];
|
imports = [ inputs.sops.homeManagerModules.sops ];
|
||||||
|
|
||||||
options.custom.sops = {
|
options.custom.sops = {
|
||||||
enable = lib.mkEnableOption "";
|
enable = lib.mkEnableOption "";
|
||||||
agePublicKey = lib.mkOption {
|
|
||||||
type = lib.types.nonEmptyStr;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
hostName = lib.mkOption {
|
hostName = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = moduleArgs.osConfig.networking.hostName or "";
|
default = moduleArgs.osConfig.networking.hostName or "";
|
||||||
};
|
};
|
||||||
secretsFile = lib.mkOption {
|
agePublicKey = lib.mkOption {
|
||||||
type = lib.types.nonEmptyStr;
|
type = lib.types.nonEmptyStr;
|
||||||
default = "users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
default =
|
||||||
|
"${self}/users/${config.home.username}/@${cfg.hostName}/keys/age.pub" |> lib.readFile |> lib.trim;
|
||||||
|
};
|
||||||
|
secretsFile = lib.mkOption {
|
||||||
|
type = lib.types.path;
|
||||||
|
default = "${self}/users/${config.home.username}/@${cfg.hostName}/secrets.json";
|
||||||
};
|
};
|
||||||
secrets = lib.mkOption {
|
secrets = lib.mkOption {
|
||||||
type = lib.types.anything;
|
type = lib.types.anything;
|
||||||
default = absoluteSecretsPath |> lib.readFile |> lib.strings.fromJSON;
|
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
sops = {
|
sops = {
|
||||||
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
age.sshKeyPaths = [ "${config.home.homeDirectory}/.ssh/id_ed25519" ];
|
||||||
defaultSopsFile = absoluteSecretsPath;
|
defaultSopsFile = cfg.secretsFile;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,9 @@
|
||||||
{ config, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
self,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
let
|
let
|
||||||
cfg = config.custom.services.nebula.node;
|
cfg = config.custom.services.nebula.node;
|
||||||
in
|
in
|
||||||
|
|
@ -25,13 +30,18 @@ in
|
||||||
addr = cfg.address;
|
addr = cfg.address;
|
||||||
inherit (cfg.sshd) port;
|
inherit (cfg.sshd) port;
|
||||||
};
|
};
|
||||||
|
settings = {
|
||||||
|
PasswordAuthentication = false;
|
||||||
|
KbdInteractiveAuthentication = false;
|
||||||
|
PermitRootLogin = "no";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nebula.networks.mesh.firewall.inbound =
|
nebula.networks.mesh.firewall.inbound =
|
||||||
config.custom.services.nebula.peers
|
config.custom.services.nebula.peers
|
||||||
|> lib.filter (node: node.isClient)
|
|> lib.filter (node: node.isClient)
|
||||||
|> lib.map (nebula: {
|
|> lib.map (nebula: {
|
||||||
port = "22";
|
inherit (cfg.sshd) port;
|
||||||
proto = "tcp";
|
proto = "tcp";
|
||||||
host = nebula.name;
|
host = nebula.name;
|
||||||
});
|
});
|
||||||
|
|
@ -41,5 +51,14 @@ in
|
||||||
requires = [ "nebula@mesh.service" ];
|
requires = [ "nebula@mesh.service" ];
|
||||||
after = [ "nebula@mesh.service" ];
|
after = [ "nebula@mesh.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
users.users.seb.openssh.authorizedKeys.keyFiles =
|
||||||
|
self.nixosConfigurations
|
||||||
|
|> lib.filterAttrs (name: _: name != config.networking.hostName)
|
||||||
|
|> lib.attrValues
|
||||||
|
|> lib.filter (value: value.config |> lib.hasAttr "home-manager")
|
||||||
|
|> lib.map (value: value.config.home-manager.users.seb.custom.programs.ssh)
|
||||||
|
|> lib.filter (ssh: ssh.enable)
|
||||||
|
|> lib.map (ssh: ssh.publicKeyPath);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ _: {
|
||||||
|
|
||||||
home.stateVersion = "23.11";
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
custom = {
|
custom.theme = "dark";
|
||||||
sops.agePublicKey = "age1p32cyzakxtcx346ej82ftln4r2aw2pcuazq3583s85nzsan4ygqsj32hjf";
|
|
||||||
theme = "dark";
|
|
||||||
};
|
|
||||||
|
|
||||||
wayland.windowManager.hyprland.settings.monitor = [ "DP-1,2560x1440@180,0x0,1" ];
|
wayland.windowManager.hyprland.settings.monitor = [ "DP-1,2560x1440@180,0x0,1" ];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
users/seb/@desktop/keys/age.pub
Normal file
1
users/seb/@desktop/keys/age.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
age1p32cyzakxtcx346ej82ftln4r2aw2pcuazq3583s85nzsan4ygqsj32hjf
|
||||||
1
users/seb/@desktop/keys/ssh.pub
Normal file
1
users/seb/@desktop/keys/ssh.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGBUORYC3AvTPQmtUEApTa9DvHoJy4mjuQy8abSjCcDd seb@desktop
|
||||||
|
|
@ -4,7 +4,6 @@ _: {
|
||||||
home.stateVersion = "24.11";
|
home.stateVersion = "24.11";
|
||||||
|
|
||||||
custom = {
|
custom = {
|
||||||
sops.agePublicKey = "age190mf9wx4ct7qvne3ly9j3cj9740z5wnfhsl6vsc5wtfyc5pueuas9hnjtr";
|
|
||||||
theme = "light";
|
theme = "light";
|
||||||
programs.brightnessctl.enable = true;
|
programs.brightnessctl.enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
1
users/seb/@laptop/keys/age.pub
Normal file
1
users/seb/@laptop/keys/age.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
age190mf9wx4ct7qvne3ly9j3cj9740z5wnfhsl6vsc5wtfyc5pueuas9hnjtr
|
||||||
1
users/seb/@laptop/keys/ssh.pub
Normal file
1
users/seb/@laptop/keys/ssh.pub
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID1WFOdZCvfb1ZRycBGK0x+3viQpkkl6CQ3cV/Mf3gAJ seb@laptop
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
aliases.enable = true;
|
aliases.enable = true;
|
||||||
direnv.enable = true;
|
direnv.enable = true;
|
||||||
};
|
};
|
||||||
|
ssh.enable = true;
|
||||||
git.enable = true;
|
git.enable = true;
|
||||||
kitty.enable = true;
|
kitty.enable = true;
|
||||||
vscode.enable = true;
|
vscode.enable = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue