From 09bc397a1db6a3af6335fa5befeceb79e829ae07 Mon Sep 17 00:00:00 2001 From: chaos Date: Sat, 11 May 2024 16:29:43 +0100 Subject: [PATCH] tidy and seperate some base home-manager profiles and presets --- home/apps/age.nix | 15 ++++++++++ home/base/age-encryption.nix | 5 ++++ home/base/ssh-aliases.nix | 21 ++++++++++++++ home/base/ssh.nix | 22 ++------------- home/base/vault.nix | 11 ++++++++ home/base/zsh.nix | 28 ++++--------------- home/dev/all/archives/common.nix | 2 ++ home/programming/languages/nix.nix | 2 ++ .../hetzner-arm/containers/music/default.nix | 2 +- presets/nixos/containerBase.nix | 2 +- presets/nixos/serverBase.nix | 2 +- presets/nixos/serverHetzner.nix | 1 - 12 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 home/apps/age.nix create mode 100644 home/base/age-encryption.nix create mode 100644 home/base/ssh-aliases.nix create mode 100644 home/base/vault.nix diff --git a/home/apps/age.nix b/home/apps/age.nix new file mode 100644 index 0000000..1677134 --- /dev/null +++ b/home/apps/age.nix @@ -0,0 +1,15 @@ +{ + self, + pkgs, + ... +}: let + encryptedUSBData = import "${self}/data/drives/encryptedUSB.nix"; +in { + home.packages = with pkgs; [age]; + + programs.zsh.shellAliases = { + chaos_age = "age -i ${encryptedUSBData.chaosAgePrivateKeyPath}"; + chaos_age_encrypt = "age -a -e -i ${encryptedUSBData.chaosAgePrivateKeyPath}"; + chaos_pub = "cat ${encryptedUSBData.chaosAgePublicKeyPath}"; + }; +} diff --git a/home/base/age-encryption.nix b/home/base/age-encryption.nix new file mode 100644 index 0000000..4b0b77b --- /dev/null +++ b/home/base/age-encryption.nix @@ -0,0 +1,5 @@ +{tree, ...}: { + imports = with tree; [ + home.apps.age + ]; +} diff --git a/home/base/ssh-aliases.nix b/home/base/ssh-aliases.nix new file mode 100644 index 0000000..5ff5312 --- /dev/null +++ b/home/base/ssh-aliases.nix @@ -0,0 +1,21 @@ +{lib, ...}: let + inherit (lib.modules) mkMerge; +in { + programs.ssh = { + enable = true; + matchBlocks = mkMerge [ + (mkMerge (map (hostname: { + "${hostname}" = { + user = "root"; + hostname = "${hostname}.servers.genderfucked.monster"; + }; + }) ["hetzner-arm" "hetzner-arm-decrypt" "vault" "vault-decrypt" "raspberry"])) + { + "blahaj" = { + user = "chaos"; + hostname = "blahaj.sapphicco.de"; + }; + } + ]; + }; +} diff --git a/home/base/ssh.nix b/home/base/ssh.nix index 5ff5312..ea8c277 100644 --- a/home/base/ssh.nix +++ b/home/base/ssh.nix @@ -1,21 +1,3 @@ -{lib, ...}: let - inherit (lib.modules) mkMerge; -in { - programs.ssh = { - enable = true; - matchBlocks = mkMerge [ - (mkMerge (map (hostname: { - "${hostname}" = { - user = "root"; - hostname = "${hostname}.servers.genderfucked.monster"; - }; - }) ["hetzner-arm" "hetzner-arm-decrypt" "vault" "vault-decrypt" "raspberry"])) - { - "blahaj" = { - user = "chaos"; - hostname = "blahaj.sapphicco.de"; - }; - } - ]; - }; +{...}: { + programs.ssh.enable = true; } diff --git a/home/base/vault.nix b/home/base/vault.nix new file mode 100644 index 0000000..08f6b46 --- /dev/null +++ b/home/base/vault.nix @@ -0,0 +1,11 @@ +{pkgs, ...}: { + home.packages = with pkgs; [vault-bin]; + + programs.zsh.envExtra = '' + export VAULT_ADDR="https://vault.owo.monster" + ''; + + home.sessionVariables = { + VAULT_ADDR = "https://vault.owo.monster"; + }; +} diff --git a/home/base/zsh.nix b/home/base/zsh.nix index d72c1d0..4701eb5 100644 --- a/home/base/zsh.nix +++ b/home/base/zsh.nix @@ -1,11 +1,5 @@ -{ - self, - pkgs, - ... -}: let - encryptedUSBData = import "${self}/data/drives/encryptedUSB.nix"; -in { - home.packages = with pkgs; [eza bat ripgrep vault-bin libarchive age]; +{pkgs, ...}: { + home.packages = with pkgs; [bat ripgrep]; programs.zsh = { enable = true; syntaxHighlighting.enable = true; @@ -16,27 +10,17 @@ in { plugins = []; }; shellAliases = { - nixdirfmt = "alejandra . && statix fix . && deadnix -e ."; - tar = "bsdtar"; - exa = "eza"; - eza = "eza --time-style long-iso"; - la = "eza -Ga"; - ll = "eza -l"; - lla = "eza -lga"; ip6 = "ip -6"; + sys = "systemctl"; sysu = "systemctl --user"; - logu = "journalctl --user"; log = "journalctl"; + logu = "journalctl --user"; + dmesg = "dmesg -HP"; + hg = "history 0 | rg"; - chaos_age = "age -i ${encryptedUSBData.chaosAgePrivateKeyPath}"; - chaos_age_encrypt = "age -a -e -i ${encryptedUSBData.chaosAgePrivateKeyPath}"; - chaos_pub = "cat ${encryptedUSBData.chaosAgePublicKeyPath}"; }; - envExtra = '' - export VAULT_ADDR="https://vault.owo.monster" - ''; }; programs.direnv = { enable = true; diff --git a/home/dev/all/archives/common.nix b/home/dev/all/archives/common.nix index da0e81d..4872d18 100644 --- a/home/dev/all/archives/common.nix +++ b/home/dev/all/archives/common.nix @@ -4,4 +4,6 @@ zip p7zip ]; + + programs.zsh.shellAliases.tar = "bsdtar"; } diff --git a/home/programming/languages/nix.nix b/home/programming/languages/nix.nix index 276a6aa..0b1c222 100644 --- a/home/programming/languages/nix.nix +++ b/home/programming/languages/nix.nix @@ -13,4 +13,6 @@ programs.vscode-mod.userSettings = { "alejandra.program" = "alejandra"; }; + + programs.zsh.shellAliases.nixdirfmt = "alejandra . && statix fix . && deadnix -e ."; } diff --git a/hosts/hetzner-arm/containers/music/default.nix b/hosts/hetzner-arm/containers/music/default.nix index f007fff..9f8a371 100644 --- a/hosts/hetzner-arm/containers/music/default.nix +++ b/hosts/hetzner-arm/containers/music/default.nix @@ -60,7 +60,7 @@ in { musicSync #soulseek # takes up too much ram :( ]); - home-manager.users.root.imports = with tree; [ home.apps.musicutil ]; + home-manager.users.root.imports = with tree; [home.apps.musicutil]; networking.firewall.allowedTCPPorts = with ports; [ mpd diff --git a/presets/nixos/containerBase.nix b/presets/nixos/containerBase.nix index 05903a4..3825e7d 100644 --- a/presets/nixos/containerBase.nix +++ b/presets/nixos/containerBase.nix @@ -20,7 +20,7 @@ ]; home-manager.users.root = { - imports = with tree; [home.base home.dev.small]; + imports = with tree; [home.base.zsh home.base.age-encyption home.dev.small]; }; networking.firewall = { diff --git a/presets/nixos/serverBase.nix b/presets/nixos/serverBase.nix index 3448348..f4784f1 100644 --- a/presets/nixos/serverBase.nix +++ b/presets/nixos/serverBase.nix @@ -10,7 +10,7 @@ ]; home-manager.users.root = { - imports = with tree; [home.base home.dev.small]; + imports = with tree; [home.base.zsh home.base.age-encyption home.dev.small]; }; networking.firewall = { diff --git a/presets/nixos/serverHetzner.nix b/presets/nixos/serverHetzner.nix index 7b6ada3..057a4ed 100644 --- a/presets/nixos/serverHetzner.nix +++ b/presets/nixos/serverHetzner.nix @@ -20,7 +20,6 @@ netmask = "255.255.255.255"; in { imports = [ - (modulesPath + "/installer/scan/not-detected.nix") (modulesPath + "/profiles/qemu-guest.nix") ];