From 86ac3cc84653faaad832e66ca90c09df995a6af2 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Fri, 6 Oct 2023 16:26:40 +0100 Subject: [PATCH] Restructure --- .github/workflows/ci.yml | 13 +++ .sops.yaml | 2 +- configurations/akane/home-manager/default.nix | 76 ++++++++++++++++++ .../akane/home-manager}/wallpaper.png | Bin configurations/akane/nixos/default.nix | 43 ++++++++++ .../akane/nixos}/hardware-configuration.nix | 0 .../generic/home-manager/default.nix | 20 +++++ .../kawashiro/home-manager/default.nix | 49 +++++++++++ configurations/kawashiro/nixos/default.nix | 43 ++++++++++ .../nixos}/hardware-configuration.nix | 0 configurations/maya/home-manager/default.nix | 68 ++++++++++++++++ .../maya/home-manager}/wallpaper.png | Bin configurations/maya/nixos/default.nix | 42 ++++++++++ .../maya/nixos}/hardware-configuration.nix | 0 {nixos => configurations}/yukari/README.md | 0 .../yukari/home-manager/default.nix | 29 +++++++ configurations/yukari/nixos/default.nix | 63 +++++++++++++++ .../yukari/nixos}/disk-config.nix | 0 .../yukari/nixos}/update-storage.nix | 0 flake.nix | 51 +++--------- home-manager/akane/default.nix | 73 ----------------- home-manager/generic/default.nix | 17 ---- home-manager/kawashiro/default.nix | 46 ----------- home-manager/maya/default.nix | 65 --------------- home-manager/yukari/default.nix | 26 ------ .../common => modules/home-manager}/base.nix | 0 .../home-manager}/borgmatic.nix | 0 .../desktop_environment/apps/default.nix | 0 .../desktop_environment/apps/zathura.nix | 0 .../components/alacritty.nix | 0 .../desktop_environment/components/mako.nix | 0 .../desktop_environment/components/sway.nix | 0 .../desktop_environment/components/tofi.nix | 0 .../desktop_environment/components/warpd.nix | 0 .../desktop_environment/default.nix | 0 .../home-manager}/development.nix | 0 .../home-manager}/email/default.nix | 0 .../home-manager}/email/neomutt.nix | 0 .../home-manager}/email/secrets.nix | 0 .../common => modules/home-manager}/media.nix | 0 .../terminal_environment/base.nix | 0 .../terminal_environment/default.nix | 0 .../terminal_environment/direnv.nix | 0 .../terminal_environment/fzf.nix | 0 .../terminal_environment/git.nix | 0 .../terminal_environment/gpg.nix | 0 .../terminal_environment/neovim.nix | 0 .../terminal_environment/nnn.nix | 0 .../terminal_environment/pass.nix | 0 .../terminal_environment/taskwarrior.nix | 0 .../terminal_environment/tmux.nix | 0 .../terminal_environment/zsh.nix | 0 {nixos/common => modules/nixos}/adb.nix | 0 {nixos/common => modules/nixos}/base.nix | 0 .../common => modules/nixos}/dan/default.nix | 0 .../nixos}/dan/secrets/default.nix | 0 .../nixos}/dan/secrets/rclone-config.nix | 0 .../nixos}/dan/secrets/secrets.yaml | 0 .../nixos}/dan/secrets/ssh-config.nix | 0 .../nixos}/desktop-environment.nix | 0 .../nixos}/encrypted-dns.nix | 0 {nixos/common => modules/nixos}/locale.nix | 0 .../nixos}/networkmanager.nix | 0 {nixos/common => modules/nixos}/scanner.nix | 0 {nixos/common => modules/nixos}/sound.nix | 0 {nixos/common => modules/nixos}/ssh.nix | 0 {nixos/common => modules/nixos}/syncthing.nix | 0 nixos/akane/default.nix | 41 ---------- nixos/kawashiro/default.nix | 41 ---------- nixos/maya/default.nix | 40 --------- nixos/yukari/default.nix | 58 ------------- treefmt.toml | 2 +- 72 files changed, 457 insertions(+), 451 deletions(-) create mode 100644 configurations/akane/home-manager/default.nix rename {home-manager/akane => configurations/akane/home-manager}/wallpaper.png (100%) create mode 100644 configurations/akane/nixos/default.nix rename {nixos/akane => configurations/akane/nixos}/hardware-configuration.nix (100%) create mode 100644 configurations/generic/home-manager/default.nix create mode 100644 configurations/kawashiro/home-manager/default.nix create mode 100644 configurations/kawashiro/nixos/default.nix rename {nixos/kawashiro => configurations/kawashiro/nixos}/hardware-configuration.nix (100%) create mode 100644 configurations/maya/home-manager/default.nix rename {home-manager/maya => configurations/maya/home-manager}/wallpaper.png (100%) create mode 100644 configurations/maya/nixos/default.nix rename {nixos/maya => configurations/maya/nixos}/hardware-configuration.nix (100%) rename {nixos => configurations}/yukari/README.md (100%) create mode 100644 configurations/yukari/home-manager/default.nix create mode 100644 configurations/yukari/nixos/default.nix rename {nixos/yukari => configurations/yukari/nixos}/disk-config.nix (100%) rename {nixos/yukari => configurations/yukari/nixos}/update-storage.nix (100%) delete mode 100644 home-manager/akane/default.nix delete mode 100644 home-manager/generic/default.nix delete mode 100644 home-manager/kawashiro/default.nix delete mode 100644 home-manager/maya/default.nix delete mode 100644 home-manager/yukari/default.nix rename {home-manager/common => modules/home-manager}/base.nix (100%) rename {home-manager/common => modules/home-manager}/borgmatic.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/apps/default.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/apps/zathura.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/components/alacritty.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/components/mako.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/components/sway.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/components/tofi.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/components/warpd.nix (100%) rename {home-manager/common => modules/home-manager}/desktop_environment/default.nix (100%) rename {home-manager/common => modules/home-manager}/development.nix (100%) rename {home-manager/common => modules/home-manager}/email/default.nix (100%) rename {home-manager/common => modules/home-manager}/email/neomutt.nix (100%) rename {home-manager/common => modules/home-manager}/email/secrets.nix (100%) rename {home-manager/common => modules/home-manager}/media.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/base.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/default.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/direnv.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/fzf.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/git.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/gpg.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/neovim.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/nnn.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/pass.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/taskwarrior.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/tmux.nix (100%) rename {home-manager/common => modules/home-manager}/terminal_environment/zsh.nix (100%) rename {nixos/common => modules/nixos}/adb.nix (100%) rename {nixos/common => modules/nixos}/base.nix (100%) rename {nixos/common => modules/nixos}/dan/default.nix (100%) rename {nixos/common => modules/nixos}/dan/secrets/default.nix (100%) rename {nixos/common => modules/nixos}/dan/secrets/rclone-config.nix (100%) rename {nixos/common => modules/nixos}/dan/secrets/secrets.yaml (100%) rename {nixos/common => modules/nixos}/dan/secrets/ssh-config.nix (100%) rename {nixos/common => modules/nixos}/desktop-environment.nix (100%) rename {nixos/common => modules/nixos}/encrypted-dns.nix (100%) rename {nixos/common => modules/nixos}/locale.nix (100%) rename {nixos/common => modules/nixos}/networkmanager.nix (100%) rename {nixos/common => modules/nixos}/scanner.nix (100%) rename {nixos/common => modules/nixos}/sound.nix (100%) rename {nixos/common => modules/nixos}/ssh.nix (100%) rename {nixos/common => modules/nixos}/syncthing.nix (100%) delete mode 100644 nixos/akane/default.nix delete mode 100644 nixos/kawashiro/default.nix delete mode 100644 nixos/maya/default.nix delete mode 100644 nixos/yukari/default.nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7522735..8d81742 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,3 +15,16 @@ jobs: - name: treefmt run: nix develop --command treefmt --fail-on-change + + check: + name: Check + needs: + - formatting + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - uses: cachix/install-nix-action@v20 + + - name: check + run: nix flake check --debug diff --git a/.sops.yaml b/.sops.yaml index 62de0d3..6ae66c0 100644 --- a/.sops.yaml +++ b/.sops.yaml @@ -7,7 +7,7 @@ keys: - &maya age1w908m223s5xg3xmsm3zxwxcudryc4hcp8xk5kveq09kgupjtpqhqq4nqsd creation_rules: - - path_regex: home-manager/common/email/secrets.nix + - path_regex: modules/home-manager/email/secrets.nix key_groups: - pgp: - *dan diff --git a/configurations/akane/home-manager/default.nix b/configurations/akane/home-manager/default.nix new file mode 100644 index 0000000..a5a209b --- /dev/null +++ b/configurations/akane/home-manager/default.nix @@ -0,0 +1,76 @@ +{ + inputs, + outputs, +}: +inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + + modules = [ + ../../../modules/home-manager/terminal_environment + ../../../modules/home-manager/borgmatic.nix + ../../../modules/home-manager/media.nix + ../../../modules/home-manager/development.nix + ../../../modules/home-manager/desktop_environment + + ({pkgs, ...}: { + programs.borgmatic.backups."main" = { + location = { + sourceDirectories = [ + "/home/dan/docs" + "/home/dan/phone" + "/home/dan/tombs" + ]; + repositories = ["ssh://r4zp295h@r4zp295h.repo.borgbase.com/./repo"]; + }; + storage.encryptionPasscommand = "pass borg/akane/passphrase"; + }; + + wayland.windowManager.sway.config = { + input."2:7:SynPS/2_Synaptics_TouchPad" = { + events = "disabled"; + }; + + output = { + LVDS-1 = { + enable = ""; + bg = "~/.local/share/wallpaper.png fill"; + }; + }; + }; + + home.file.wallpaper = { + source = ./wallpaper.png; + target = ".local/share/wallpaper.png"; + }; + + programs.i3status-rust.bars.main.blocks = [ + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "sink"; + } + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "source"; + } + { + block = "battery"; + } + { + block = "time"; + interval = 1; + format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; + } + ]; + + services.mpd.enable = true; + + home.packages = with pkgs; [ + scrcpy + inputs.satori.packages.${system}.satorictl + ]; + }) + ]; +} diff --git a/home-manager/akane/wallpaper.png b/configurations/akane/home-manager/wallpaper.png similarity index 100% rename from home-manager/akane/wallpaper.png rename to configurations/akane/home-manager/wallpaper.png diff --git a/configurations/akane/nixos/default.nix b/configurations/akane/nixos/default.nix new file mode 100644 index 0000000..a2451f9 --- /dev/null +++ b/configurations/akane/nixos/default.nix @@ -0,0 +1,43 @@ +{ + inputs, + outputs, +}: +inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + + modules = [ + ./hardware-configuration.nix + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x230 + inputs.nixos-hardware.nixosModules.common-pc-ssd + + inputs.sops-nix.nixosModules.sops + ../../../modules/nixos/adb.nix + ../../../modules/nixos/base.nix + ../../../modules/nixos/dan + ../../../modules/nixos/dan/secrets + ../../../modules/nixos/desktop-environment.nix + ../../../modules/nixos/encrypted-dns.nix + ../../../modules/nixos/locale.nix + ../../../modules/nixos/networkmanager.nix + ../../../modules/nixos/scanner.nix + ../../../modules/nixos/sound.nix + ../../../modules/nixos/ssh.nix + ../../../modules/nixos/syncthing.nix + + { + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + initrd.secrets."/crypto_keyfile.bin" = null; + }; + + networking.hostName = "akane"; + + users.users.dan.extraGroups = ["dialout"]; + + virtualisation.podman.enable = true; + services.upower.enable = true; + services.tailscale.enable = true; + } + ]; +} diff --git a/nixos/akane/hardware-configuration.nix b/configurations/akane/nixos/hardware-configuration.nix similarity index 100% rename from nixos/akane/hardware-configuration.nix rename to configurations/akane/nixos/hardware-configuration.nix diff --git a/configurations/generic/home-manager/default.nix b/configurations/generic/home-manager/default.nix new file mode 100644 index 0000000..8299042 --- /dev/null +++ b/configurations/generic/home-manager/default.nix @@ -0,0 +1,20 @@ +{ + inputs, + outputs, +}: +inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + + modules = [ + ../../../modules/home-manager/terminal_environment + ../../../modules/home-manager/development.nix + + { + # home = { + # username = "dan"; + # homeDirectory = "/home/dan"; + # }; + } + ]; +} diff --git a/configurations/kawashiro/home-manager/default.nix b/configurations/kawashiro/home-manager/default.nix new file mode 100644 index 0000000..1d25b8c --- /dev/null +++ b/configurations/kawashiro/home-manager/default.nix @@ -0,0 +1,49 @@ +{ + inputs, + outputs, +}: +inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + + modules = [ + ../../../modules/home-manager/terminal_environment + ../../../modules/home-manager/media.nix + ../../../modules/home-manager/development.nix + ../../../modules/home-manager/desktop_environment + + ({pkgs, ...}: { + wayland.windowManager.sway.config.output = { + eDP-1 = { + enable = ""; + bg = "#006070 solid_color"; + }; + }; + + programs.i3status-rust.bars.main.blocks = [ + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "sink"; + } + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "source"; + } + { + block = "battery"; + } + { + block = "time"; + interval = 1; + format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; + } + ]; + + home.packages = with pkgs; [ + lightburn + ]; + }) + ]; +} diff --git a/configurations/kawashiro/nixos/default.nix b/configurations/kawashiro/nixos/default.nix new file mode 100644 index 0000000..322ae73 --- /dev/null +++ b/configurations/kawashiro/nixos/default.nix @@ -0,0 +1,43 @@ +{ + inputs, + outputs, +}: +inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + + modules = [ + ./hardware-configuration.nix + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-pc-ssd + + inputs.sops-nix.nixosModules.sops + ../../../modules/nixos/base.nix + ../../../modules/nixos/dan + ../../../modules/nixos/dan/secrets + ../../../modules/nixos/desktop-environment.nix + ../../../modules/nixos/encrypted-dns.nix + ../../../modules/nixos/locale.nix + ../../../modules/nixos/networkmanager.nix + ../../../modules/nixos/sound.nix + ../../../modules/nixos/ssh.nix + ../../../modules/nixos/syncthing.nix + + { + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + initrd.secrets."/crypto_keyfile.bin" = null; + }; + + networking.hostName = "kawashiro"; + + users.users.dan.extraGroups = ["dialout" "plugdev"]; + + virtualisation.podman.enable = true; + services.upower.enable = true; + services.tailscale.enable = true; + + hardware.rtl-sdr.enable = true; + } + ]; +} diff --git a/nixos/kawashiro/hardware-configuration.nix b/configurations/kawashiro/nixos/hardware-configuration.nix similarity index 100% rename from nixos/kawashiro/hardware-configuration.nix rename to configurations/kawashiro/nixos/hardware-configuration.nix diff --git a/configurations/maya/home-manager/default.nix b/configurations/maya/home-manager/default.nix new file mode 100644 index 0000000..f21056a --- /dev/null +++ b/configurations/maya/home-manager/default.nix @@ -0,0 +1,68 @@ +{ + inputs, + outputs, +}: +inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + + modules = [ + ../../../modules/home-manager/terminal_environment + ../../../modules/home-manager/borgmatic.nix + ../../../modules/home-manager/media.nix + ../../../modules/home-manager/development.nix + ../../../modules/home-manager/email + ../../../modules/home-manager/desktop_environment + + ({pkgs, ...}: { + programs.borgmatic.backups."main" = { + location = { + sourceDirectories = [ + "/home/dan/docs" + "/home/dan/phone" + "/home/dan/tombs" + ]; + repositories = ["n0f5xqc1@n0f5xqc1.repo.borgbase.com:repo"]; + }; + storage.encryptionPasscommand = "pass borg/maya/passphrase"; + }; + + wayland.windowManager.sway.config.output = { + DP-1 = { + enable = ""; + bg = "~/.local/share/wallpaper.png fill"; + scale = "1.5"; + }; + }; + + home.file.wallpaper = { + source = ./wallpaper.png; + target = ".local/share/wallpaper.png"; + }; + + programs.i3status-rust.bars.main.blocks = [ + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "sink"; + } + { + block = "sound"; + driver = "pulseaudio"; + device_kind = "source"; + } + { + block = "time"; + interval = 1; + format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; + } + ]; + + services.mpd.enable = true; + + home.packages = with pkgs; [ + inputs.satori.packages.${system}.satorictl + ]; + }) + ]; +} diff --git a/home-manager/maya/wallpaper.png b/configurations/maya/home-manager/wallpaper.png similarity index 100% rename from home-manager/maya/wallpaper.png rename to configurations/maya/home-manager/wallpaper.png diff --git a/configurations/maya/nixos/default.nix b/configurations/maya/nixos/default.nix new file mode 100644 index 0000000..7d994ea --- /dev/null +++ b/configurations/maya/nixos/default.nix @@ -0,0 +1,42 @@ +{ + inputs, + outputs, +}: +inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + + modules = [ + ./hardware-configuration.nix + inputs.nixos-hardware.nixosModules.common-pc-ssd + + inputs.sops-nix.nixosModules.sops + ../../../modules/nixos/base.nix + ../../../modules/nixos/dan + ../../../modules/nixos/dan/secrets + ../../../modules/nixos/desktop-environment.nix + ../../../modules/nixos/encrypted-dns.nix + ../../../modules/nixos/locale.nix + ../../../modules/nixos/networkmanager.nix + ../../../modules/nixos/sound.nix + ../../../modules/nixos/ssh.nix + ../../../modules/nixos/syncthing.nix + + { + boot = { + loader.systemd-boot.enable = true; + loader.efi.canTouchEfiVariables = true; + initrd.secrets."/crypto_keyfile.bin" = null; + }; + + networking.hostName = "maya"; + + virtualisation.podman.enable = true; + services.upower.enable = true; + services.tailscale.enable = true; + + # i2c required for monitor control via ddcutil + hardware.i2c.enable = true; + users.users.dan.extraGroups = ["i2c" "dialout" "plugdev"]; + } + ]; +} diff --git a/nixos/maya/hardware-configuration.nix b/configurations/maya/nixos/hardware-configuration.nix similarity index 100% rename from nixos/maya/hardware-configuration.nix rename to configurations/maya/nixos/hardware-configuration.nix diff --git a/nixos/yukari/README.md b/configurations/yukari/README.md similarity index 100% rename from nixos/yukari/README.md rename to configurations/yukari/README.md diff --git a/configurations/yukari/home-manager/default.nix b/configurations/yukari/home-manager/default.nix new file mode 100644 index 0000000..14de179 --- /dev/null +++ b/configurations/yukari/home-manager/default.nix @@ -0,0 +1,29 @@ +{ + inputs, + outputs, +}: +inputs.home-manager.lib.homeManagerConfiguration { + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = {inherit inputs outputs;}; + + modules = [ + ../../../modules/home-manager/terminal_environment + ../../../modules/home-manager/borgmatic.nix + ../../../modules/home-manager/email + + { + programs.borgmatic.backups."main" = { + location = { + sourceDirectories = [ + "/home/dan/docs" + "/home/dan/git" + "/home/dan/phone" + "/home/dan/tombs" + ]; + repositories = ["ssh://sfxwxlb3@sfxwxlb3.repo.borgbase.com/./repo"]; + }; + storage.encryptionPasscommand = "pass borg/yukari/passphrase"; + }; + } + ]; +} diff --git a/configurations/yukari/nixos/default.nix b/configurations/yukari/nixos/default.nix new file mode 100644 index 0000000..d2026ba --- /dev/null +++ b/configurations/yukari/nixos/default.nix @@ -0,0 +1,63 @@ +{ + inputs, + outputs, +}: +inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + + modules = [ + inputs.disko.nixosModules.disko + ({modulesPath, ...}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ]; + }) + ./disk-config.nix + + inputs.sops-nix.nixosModules.sops + ../../../modules/nixos/base.nix + ../../../modules/nixos/dan + ../../../modules/nixos/encrypted-dns.nix + ../../../modules/nixos/locale.nix + ../../../modules/nixos/networkmanager.nix + ../../../modules/nixos/ssh.nix + ../../../modules/nixos/syncthing.nix + + ({pkgs, ...}: { + nixpkgs.overlays = [ + (final: _prev: { + update-storage = final.callPackage ./update-storage.nix {}; + }) + ]; + + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; + + nixpkgs.hostPlatform = "x86_64-linux"; + + networking.hostName = "yukari"; + + networking.firewall.extraInputRules = '' + iifname "tailscale0" tcp dport 22 log prefix "firewall: new SSH connection: " counter accept + iifname "tailscale0" tcp dport 22000 log prefix "firewall: Syncthing: " counter accept + iifname "tailscale0" udp dport 22000 log prefix "firewall: Syncthing: " counter accept + iifname "tailscale0" udp dport 21027 log prefix "firewall: Syncthing: " counter accept + ''; + services.openssh.openFirewall = false; + services.syncthing.openDefaultPorts = false; + + services.tailscale.enable = true; + + users.users.dan.initialPassword = "for-fucks-sake-change-this"; + + # Disable gpg-agent, but ensure the directory is present for SSH forwarded socket + programs.gnupg.agent.enable = false; + systemd.user.tmpfiles.rules = ["d %t/gnupg 700 - - -"]; + + environment.systemPackages = with pkgs; [update-storage]; + }) + ]; +} diff --git a/nixos/yukari/disk-config.nix b/configurations/yukari/nixos/disk-config.nix similarity index 100% rename from nixos/yukari/disk-config.nix rename to configurations/yukari/nixos/disk-config.nix diff --git a/nixos/yukari/update-storage.nix b/configurations/yukari/nixos/update-storage.nix similarity index 100% rename from nixos/yukari/update-storage.nix rename to configurations/yukari/nixos/update-storage.nix diff --git a/flake.nix b/flake.nix index 296a000..13935a4 100644 --- a/flake.nix +++ b/flake.nix @@ -50,7 +50,6 @@ outputs = { self, nixpkgs, - home-manager, ... } @ inputs: let inherit (self) outputs; @@ -69,50 +68,18 @@ ); nixosConfigurations = { - akane = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [./nixos/akane]; - }; - kawashiro = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [./nixos/kawashiro]; - }; - maya = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [./nixos/maya]; - }; - yukari = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [./nixos/yukari]; - }; + akane = import ./configurations/akane/nixos {inherit inputs outputs;}; + kawashiro = import ./configurations/kawashiro/nixos {inherit inputs outputs;}; + maya = import ./configurations/maya/nixos {inherit inputs outputs;}; + yukari = import ./configurations/yukari/nixos {inherit inputs outputs;}; }; homeConfigurations = { - akane = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [./home-manager/akane]; - }; - generic = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [./home-manager/generic]; - }; - kawashiro = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [./home-manager/kawashiro]; - }; - maya = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [./home-manager/maya]; - }; - yukari = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [./home-manager/yukari]; - }; + akane = import ./configurations/akane/home-manager {inherit inputs outputs;}; + generic = import ./configurations/generic/home-manager {inherit inputs outputs;}; + kawashiro = import ./configurations/kawashiro/home-manager {inherit inputs outputs;}; + maya = import ./configurations/maya/home-manager {inherit inputs outputs;}; + yukari = import ./configurations/yukari/home-manager {inherit inputs outputs;}; }; }; } diff --git a/home-manager/akane/default.nix b/home-manager/akane/default.nix deleted file mode 100644 index 5acf0b7..0000000 --- a/home-manager/akane/default.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ../common/terminal_environment - ../common/borgmatic.nix - ../common/media.nix - ../common/development.nix - ../common/desktop_environment - ]; - - programs.borgmatic.backups."main" = { - location = { - sourceDirectories = [ - "/home/dan/docs" - "/home/dan/phone" - "/home/dan/tombs" - ]; - repositories = ["ssh://r4zp295h@r4zp295h.repo.borgbase.com/./repo"]; - }; - storage.encryptionPasscommand = "pass borg/akane/passphrase"; - }; - - wayland.windowManager.sway.config = { - input."2:7:SynPS/2_Synaptics_TouchPad" = { - events = "disabled"; - }; - - output = { - LVDS-1 = { - enable = ""; - bg = "~/.local/share/wallpaper.png fill"; - }; - }; - }; - - home.file.wallpaper = { - source = ./wallpaper.png; - target = ".local/share/wallpaper.png"; - }; - - programs.i3status-rust.bars.main.blocks = [ - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "sink"; - } - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "source"; - } - { - block = "battery"; - } - { - block = "time"; - interval = 1; - format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; - } - ]; - - services.mpd.enable = true; - - home.packages = with pkgs; [ - scrcpy - inputs.satori.packages.${system}.satorictl - ]; -} diff --git a/home-manager/generic/default.nix b/home-manager/generic/default.nix deleted file mode 100644 index 3d94f92..0000000 --- a/home-manager/generic/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ../common/terminal_environment - ../common/development.nix - ]; - - # home = { - # username = "dan"; - # homeDirectory = "/home/dan"; - # }; -} diff --git a/home-manager/kawashiro/default.nix b/home-manager/kawashiro/default.nix deleted file mode 100644 index 45dac2f..0000000 --- a/home-manager/kawashiro/default.nix +++ /dev/null @@ -1,46 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ../common/terminal_environment - ../common/media.nix - ../common/development.nix - ../common/desktop_environment - ]; - - wayland.windowManager.sway.config.output = { - eDP-1 = { - enable = ""; - bg = "#006070 solid_color"; - }; - }; - - programs.i3status-rust.bars.main.blocks = [ - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "sink"; - } - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "source"; - } - { - block = "battery"; - } - { - block = "time"; - interval = 1; - format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; - } - ]; - - home.packages = with pkgs; [ - lightburn - ]; -} diff --git a/home-manager/maya/default.nix b/home-manager/maya/default.nix deleted file mode 100644 index 649a595..0000000 --- a/home-manager/maya/default.nix +++ /dev/null @@ -1,65 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ../common/terminal_environment - ../common/borgmatic.nix - ../common/media.nix - ../common/development.nix - ../common/email - ../common/desktop_environment - ]; - - programs.borgmatic.backups."main" = { - location = { - sourceDirectories = [ - "/home/dan/docs" - "/home/dan/phone" - "/home/dan/tombs" - ]; - repositories = ["n0f5xqc1@n0f5xqc1.repo.borgbase.com:repo"]; - }; - storage.encryptionPasscommand = "pass borg/maya/passphrase"; - }; - - wayland.windowManager.sway.config.output = { - DP-1 = { - enable = ""; - bg = "~/.local/share/wallpaper.png fill"; - scale = "1.5"; - }; - }; - - home.file.wallpaper = { - source = ./wallpaper.png; - target = ".local/share/wallpaper.png"; - }; - - programs.i3status-rust.bars.main.blocks = [ - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "sink"; - } - { - block = "sound"; - driver = "pulseaudio"; - device_kind = "source"; - } - { - block = "time"; - interval = 1; - format = " $timestamp.datetime(f:'%Y-%m-%d %H:%M:%S') "; - } - ]; - - services.mpd.enable = true; - - home.packages = with pkgs; [ - inputs.satori.packages.${system}.satorictl - ]; -} diff --git a/home-manager/yukari/default.nix b/home-manager/yukari/default.nix deleted file mode 100644 index e586d2e..0000000 --- a/home-manager/yukari/default.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ../common/terminal_environment - ../common/borgmatic.nix - ../common/email - ]; - - programs.borgmatic.backups."main" = { - location = { - sourceDirectories = [ - "/home/dan/docs" - "/home/dan/git" - "/home/dan/phone" - "/home/dan/tombs" - ]; - repositories = ["ssh://sfxwxlb3@sfxwxlb3.repo.borgbase.com/./repo"]; - }; - storage.encryptionPasscommand = "pass borg/yukari/passphrase"; - }; -} diff --git a/home-manager/common/base.nix b/modules/home-manager/base.nix similarity index 100% rename from home-manager/common/base.nix rename to modules/home-manager/base.nix diff --git a/home-manager/common/borgmatic.nix b/modules/home-manager/borgmatic.nix similarity index 100% rename from home-manager/common/borgmatic.nix rename to modules/home-manager/borgmatic.nix diff --git a/home-manager/common/desktop_environment/apps/default.nix b/modules/home-manager/desktop_environment/apps/default.nix similarity index 100% rename from home-manager/common/desktop_environment/apps/default.nix rename to modules/home-manager/desktop_environment/apps/default.nix diff --git a/home-manager/common/desktop_environment/apps/zathura.nix b/modules/home-manager/desktop_environment/apps/zathura.nix similarity index 100% rename from home-manager/common/desktop_environment/apps/zathura.nix rename to modules/home-manager/desktop_environment/apps/zathura.nix diff --git a/home-manager/common/desktop_environment/components/alacritty.nix b/modules/home-manager/desktop_environment/components/alacritty.nix similarity index 100% rename from home-manager/common/desktop_environment/components/alacritty.nix rename to modules/home-manager/desktop_environment/components/alacritty.nix diff --git a/home-manager/common/desktop_environment/components/mako.nix b/modules/home-manager/desktop_environment/components/mako.nix similarity index 100% rename from home-manager/common/desktop_environment/components/mako.nix rename to modules/home-manager/desktop_environment/components/mako.nix diff --git a/home-manager/common/desktop_environment/components/sway.nix b/modules/home-manager/desktop_environment/components/sway.nix similarity index 100% rename from home-manager/common/desktop_environment/components/sway.nix rename to modules/home-manager/desktop_environment/components/sway.nix diff --git a/home-manager/common/desktop_environment/components/tofi.nix b/modules/home-manager/desktop_environment/components/tofi.nix similarity index 100% rename from home-manager/common/desktop_environment/components/tofi.nix rename to modules/home-manager/desktop_environment/components/tofi.nix diff --git a/home-manager/common/desktop_environment/components/warpd.nix b/modules/home-manager/desktop_environment/components/warpd.nix similarity index 100% rename from home-manager/common/desktop_environment/components/warpd.nix rename to modules/home-manager/desktop_environment/components/warpd.nix diff --git a/home-manager/common/desktop_environment/default.nix b/modules/home-manager/desktop_environment/default.nix similarity index 100% rename from home-manager/common/desktop_environment/default.nix rename to modules/home-manager/desktop_environment/default.nix diff --git a/home-manager/common/development.nix b/modules/home-manager/development.nix similarity index 100% rename from home-manager/common/development.nix rename to modules/home-manager/development.nix diff --git a/home-manager/common/email/default.nix b/modules/home-manager/email/default.nix similarity index 100% rename from home-manager/common/email/default.nix rename to modules/home-manager/email/default.nix diff --git a/home-manager/common/email/neomutt.nix b/modules/home-manager/email/neomutt.nix similarity index 100% rename from home-manager/common/email/neomutt.nix rename to modules/home-manager/email/neomutt.nix diff --git a/home-manager/common/email/secrets.nix b/modules/home-manager/email/secrets.nix similarity index 100% rename from home-manager/common/email/secrets.nix rename to modules/home-manager/email/secrets.nix diff --git a/home-manager/common/media.nix b/modules/home-manager/media.nix similarity index 100% rename from home-manager/common/media.nix rename to modules/home-manager/media.nix diff --git a/home-manager/common/terminal_environment/base.nix b/modules/home-manager/terminal_environment/base.nix similarity index 100% rename from home-manager/common/terminal_environment/base.nix rename to modules/home-manager/terminal_environment/base.nix diff --git a/home-manager/common/terminal_environment/default.nix b/modules/home-manager/terminal_environment/default.nix similarity index 100% rename from home-manager/common/terminal_environment/default.nix rename to modules/home-manager/terminal_environment/default.nix diff --git a/home-manager/common/terminal_environment/direnv.nix b/modules/home-manager/terminal_environment/direnv.nix similarity index 100% rename from home-manager/common/terminal_environment/direnv.nix rename to modules/home-manager/terminal_environment/direnv.nix diff --git a/home-manager/common/terminal_environment/fzf.nix b/modules/home-manager/terminal_environment/fzf.nix similarity index 100% rename from home-manager/common/terminal_environment/fzf.nix rename to modules/home-manager/terminal_environment/fzf.nix diff --git a/home-manager/common/terminal_environment/git.nix b/modules/home-manager/terminal_environment/git.nix similarity index 100% rename from home-manager/common/terminal_environment/git.nix rename to modules/home-manager/terminal_environment/git.nix diff --git a/home-manager/common/terminal_environment/gpg.nix b/modules/home-manager/terminal_environment/gpg.nix similarity index 100% rename from home-manager/common/terminal_environment/gpg.nix rename to modules/home-manager/terminal_environment/gpg.nix diff --git a/home-manager/common/terminal_environment/neovim.nix b/modules/home-manager/terminal_environment/neovim.nix similarity index 100% rename from home-manager/common/terminal_environment/neovim.nix rename to modules/home-manager/terminal_environment/neovim.nix diff --git a/home-manager/common/terminal_environment/nnn.nix b/modules/home-manager/terminal_environment/nnn.nix similarity index 100% rename from home-manager/common/terminal_environment/nnn.nix rename to modules/home-manager/terminal_environment/nnn.nix diff --git a/home-manager/common/terminal_environment/pass.nix b/modules/home-manager/terminal_environment/pass.nix similarity index 100% rename from home-manager/common/terminal_environment/pass.nix rename to modules/home-manager/terminal_environment/pass.nix diff --git a/home-manager/common/terminal_environment/taskwarrior.nix b/modules/home-manager/terminal_environment/taskwarrior.nix similarity index 100% rename from home-manager/common/terminal_environment/taskwarrior.nix rename to modules/home-manager/terminal_environment/taskwarrior.nix diff --git a/home-manager/common/terminal_environment/tmux.nix b/modules/home-manager/terminal_environment/tmux.nix similarity index 100% rename from home-manager/common/terminal_environment/tmux.nix rename to modules/home-manager/terminal_environment/tmux.nix diff --git a/home-manager/common/terminal_environment/zsh.nix b/modules/home-manager/terminal_environment/zsh.nix similarity index 100% rename from home-manager/common/terminal_environment/zsh.nix rename to modules/home-manager/terminal_environment/zsh.nix diff --git a/nixos/common/adb.nix b/modules/nixos/adb.nix similarity index 100% rename from nixos/common/adb.nix rename to modules/nixos/adb.nix diff --git a/nixos/common/base.nix b/modules/nixos/base.nix similarity index 100% rename from nixos/common/base.nix rename to modules/nixos/base.nix diff --git a/nixos/common/dan/default.nix b/modules/nixos/dan/default.nix similarity index 100% rename from nixos/common/dan/default.nix rename to modules/nixos/dan/default.nix diff --git a/nixos/common/dan/secrets/default.nix b/modules/nixos/dan/secrets/default.nix similarity index 100% rename from nixos/common/dan/secrets/default.nix rename to modules/nixos/dan/secrets/default.nix diff --git a/nixos/common/dan/secrets/rclone-config.nix b/modules/nixos/dan/secrets/rclone-config.nix similarity index 100% rename from nixos/common/dan/secrets/rclone-config.nix rename to modules/nixos/dan/secrets/rclone-config.nix diff --git a/nixos/common/dan/secrets/secrets.yaml b/modules/nixos/dan/secrets/secrets.yaml similarity index 100% rename from nixos/common/dan/secrets/secrets.yaml rename to modules/nixos/dan/secrets/secrets.yaml diff --git a/nixos/common/dan/secrets/ssh-config.nix b/modules/nixos/dan/secrets/ssh-config.nix similarity index 100% rename from nixos/common/dan/secrets/ssh-config.nix rename to modules/nixos/dan/secrets/ssh-config.nix diff --git a/nixos/common/desktop-environment.nix b/modules/nixos/desktop-environment.nix similarity index 100% rename from nixos/common/desktop-environment.nix rename to modules/nixos/desktop-environment.nix diff --git a/nixos/common/encrypted-dns.nix b/modules/nixos/encrypted-dns.nix similarity index 100% rename from nixos/common/encrypted-dns.nix rename to modules/nixos/encrypted-dns.nix diff --git a/nixos/common/locale.nix b/modules/nixos/locale.nix similarity index 100% rename from nixos/common/locale.nix rename to modules/nixos/locale.nix diff --git a/nixos/common/networkmanager.nix b/modules/nixos/networkmanager.nix similarity index 100% rename from nixos/common/networkmanager.nix rename to modules/nixos/networkmanager.nix diff --git a/nixos/common/scanner.nix b/modules/nixos/scanner.nix similarity index 100% rename from nixos/common/scanner.nix rename to modules/nixos/scanner.nix diff --git a/nixos/common/sound.nix b/modules/nixos/sound.nix similarity index 100% rename from nixos/common/sound.nix rename to modules/nixos/sound.nix diff --git a/nixos/common/ssh.nix b/modules/nixos/ssh.nix similarity index 100% rename from nixos/common/ssh.nix rename to modules/nixos/ssh.nix diff --git a/nixos/common/syncthing.nix b/modules/nixos/syncthing.nix similarity index 100% rename from nixos/common/syncthing.nix rename to modules/nixos/syncthing.nix diff --git a/nixos/akane/default.nix b/nixos/akane/default.nix deleted file mode 100644 index d799ad2..0000000 --- a/nixos/akane/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x230 - inputs.nixos-hardware.nixosModules.common-pc-ssd - - inputs.sops-nix.nixosModules.sops - ../common/adb.nix - ../common/base.nix - ../common/dan - ../common/dan/secrets - ../common/desktop-environment.nix - ../common/encrypted-dns.nix - ../common/locale.nix - ../common/networkmanager.nix - ../common/scanner.nix - ../common/sound.nix - ../common/ssh.nix - ../common/syncthing.nix - ]; - - boot = { - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - initrd.secrets."/crypto_keyfile.bin" = null; - }; - - networking.hostName = "akane"; - - users.users.dan.extraGroups = ["dialout"]; - - virtualisation.podman.enable = true; - services.upower.enable = true; - services.tailscale.enable = true; -} diff --git a/nixos/kawashiro/default.nix b/nixos/kawashiro/default.nix deleted file mode 100644 index 04ce0fd..0000000 --- a/nixos/kawashiro/default.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - inputs.nixos-hardware.nixosModules.common-cpu-intel - inputs.nixos-hardware.nixosModules.common-pc-ssd - inputs.sops-nix.nixosModules.sops - - ../common/base.nix - ../common/dan - ../common/dan/secrets - ../common/desktop-environment.nix - ../common/encrypted-dns.nix - ../common/locale.nix - ../common/networkmanager.nix - ../common/sound.nix - ../common/ssh.nix - ../common/syncthing.nix - ]; - - boot = { - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - initrd.secrets."/crypto_keyfile.bin" = null; - }; - - networking.hostName = "kawashiro"; - - users.users.dan.extraGroups = ["dialout" "plugdev"]; - - virtualisation.podman.enable = true; - services.upower.enable = true; - services.tailscale.enable = true; - - hardware.rtl-sdr.enable = true; -} diff --git a/nixos/maya/default.nix b/nixos/maya/default.nix deleted file mode 100644 index d54cb7a..0000000 --- a/nixos/maya/default.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - inputs.nixos-hardware.nixosModules.common-pc-ssd - - inputs.sops-nix.nixosModules.sops - ../common/base.nix - ../common/dan - ../common/dan/secrets - ../common/desktop-environment.nix - ../common/encrypted-dns.nix - ../common/locale.nix - ../common/networkmanager.nix - ../common/sound.nix - ../common/ssh.nix - ../common/syncthing.nix - ]; - - boot = { - loader.systemd-boot.enable = true; - loader.efi.canTouchEfiVariables = true; - initrd.secrets."/crypto_keyfile.bin" = null; - }; - - networking.hostName = "maya"; - - virtualisation.podman.enable = true; - services.upower.enable = true; - services.tailscale.enable = true; - - # i2c required for monitor control via ddcutil - hardware.i2c.enable = true; - users.users.dan.extraGroups = ["i2c" "dialout" "plugdev"]; -} diff --git a/nixos/yukari/default.nix b/nixos/yukari/default.nix deleted file mode 100644 index aeb7fc7..0000000 --- a/nixos/yukari/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ - inputs, - lib, - config, - pkgs, - modulesPath, - ... -}: { - nixpkgs.overlays = [ - (final: _prev: { - update-storage = final.callPackage ./update-storage.nix {}; - }) - ]; - - imports = [ - inputs.disko.nixosModules.disko - (modulesPath + "/installer/scan/not-detected.nix") - (modulesPath + "/profiles/qemu-guest.nix") - ./disk-config.nix - - inputs.sops-nix.nixosModules.sops - ../common/base.nix - ../common/dan - ../common/encrypted-dns.nix - ../common/locale.nix - ../common/networkmanager.nix - ../common/ssh.nix - ../common/syncthing.nix - ]; - - boot.loader.grub = { - efiSupport = true; - efiInstallAsRemovable = true; - }; - - nixpkgs.hostPlatform = "x86_64-linux"; - - networking.hostName = "yukari"; - - networking.firewall.extraInputRules = '' - iifname "tailscale0" tcp dport 22 log prefix "firewall: new SSH connection: " counter accept - iifname "tailscale0" tcp dport 22000 log prefix "firewall: Syncthing: " counter accept - iifname "tailscale0" udp dport 22000 log prefix "firewall: Syncthing: " counter accept - iifname "tailscale0" udp dport 21027 log prefix "firewall: Syncthing: " counter accept - ''; - services.openssh.openFirewall = false; - services.syncthing.openDefaultPorts = false; - - services.tailscale.enable = true; - - users.users.dan.initialPassword = "for-fucks-sake-change-this"; - - # Disable gpg-agent, but ensure the directory is present for SSH forwarded socket - programs.gnupg.agent.enable = false; - systemd.user.tmpfiles.rules = ["d %t/gnupg 700 - - -"]; - - environment.systemPackages = with pkgs; [update-storage]; -} diff --git a/treefmt.toml b/treefmt.toml index b80b14a..52d7277 100644 --- a/treefmt.toml +++ b/treefmt.toml @@ -3,5 +3,5 @@ command = "alejandra" includes = [ "*.nix" ] excludes = [ "*/hardware-configuration.nix", - "home-manager/common/email/secrets.nix", + "modules/home-manager/email/secrets.nix", ]