From 79e3c5c266b83bd131ffc9b78954d9fbb95d8034 Mon Sep 17 00:00:00 2001 From: Ricard Illa Date: Sat, 12 Aug 2023 17:33:27 +0200 Subject: [PATCH] refactor: big refactor --- flake.nix | 39 +++- home/hosts/capibara.nix | 7 +- home/hosts/common.nix | 208 ------------------ home/modules/common/default.nix | 147 +++++++++++++ home/modules/desktop-river/default.nix | 1 - home/modules/desktop-river/foot.nix | 47 ---- home/modules/music/default.nix | 13 +- home/modules/neovim/default.nix | 21 +- justfile | 7 +- nixos/hosts/capibara/default.nix | 163 +------------- nixos/hosts/capibara/file-systems.nix | 135 ++++++++++++ nixos/hosts/trantor/default.nix | 177 +-------------- nixos/hosts/trantor/file-systems.nix | 154 +++++++++++++ .../{common/default.nix => common.nix} | 0 nixos/modules/{common => }/desktop.nix | 0 overlays/default.nix | 63 ++++++ 16 files changed, 570 insertions(+), 612 deletions(-) delete mode 100644 home/hosts/common.nix create mode 100644 home/modules/common/default.nix delete mode 100644 home/modules/desktop-river/foot.nix create mode 100644 nixos/hosts/capibara/file-systems.nix create mode 100644 nixos/hosts/trantor/file-systems.nix rename nixos/modules/{common/default.nix => common.nix} (100%) rename nixos/modules/{common => }/desktop.nix (100%) create mode 100644 overlays/default.nix diff --git a/flake.nix b/flake.nix index dbb7c24..082409e 100644 --- a/flake.nix +++ b/flake.nix @@ -18,12 +18,14 @@ , nixos-hardware , home-manager , impermanence + , ... }@inputs: let - system = "x86_64-linux"; - pkgs = nixpkgs.legacyPackages.${system}; + inherit (self) outputs; in - { + rec { + overlays = import ./overlays { inherit inputs; }; + nixosConfigurations = { trantor = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -35,6 +37,8 @@ modules = [ ./nixos/hosts/trantor + ./nixos/modules/common.nix + ./nixos/modules/desktop.nix home-manager.nixosModules.home-manager impermanence.nixosModules.impermanence ]; @@ -43,13 +47,14 @@ capibara = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; specialArgs = { - # unstablePkgs = nixpkgs-unstable.legacyPackages."x86_64-linux"; stablePkgs = nixpkgs-stable.legacyPackages."x86_64-linux"; impermanence = impermanence; }; modules = [ ./nixos/hosts/capibara + ./nixos/modules/common.nix + ./nixos/modules/desktop.nix nixos-hardware.nixosModules.lenovo-thinkpad-x230 home-manager.nixosModules.home-manager impermanence.nixosModules.impermanence @@ -58,8 +63,32 @@ }; homeConfigurations = { + + "rilla@capibara" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ + ./home/hosts/capibara.nix + ./home/modules/common + ./home/modules/desktop-river + ./home/modules/theming + ]; + }; + + "rilla@trantor" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ + ./home/hosts/trantor.nix + ./home/modules/common + ./home/modules/desktop-river + ./home/modules/theming/trantor.nix + ]; + }; + "rilla@echidna" = home-manager.lib.homeManagerConfiguration { - inherit pkgs; + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs outputs; }; modules = [ ./home/hosts/echidna.nix ]; }; }; diff --git a/home/hosts/capibara.nix b/home/hosts/capibara.nix index 6dacdd6..2d9b9d2 100644 --- a/home/hosts/capibara.nix +++ b/home/hosts/capibara.nix @@ -1,9 +1,4 @@ -{ config, pkgs, ... }: +{ inputs, outputs, lib, config, pkgs, ... }: { - imports = [ - ./common.nix - ../modules/desktop-river - ../modules/theming - ]; } diff --git a/home/hosts/common.nix b/home/hosts/common.nix deleted file mode 100644 index db2f0bc..0000000 --- a/home/hosts/common.nix +++ /dev/null @@ -1,208 +0,0 @@ -{ config, inputs, pkgs, stablePkgs, ... }: - -{ - - nixpkgs.config = { allowUnfree = true; }; - - nixpkgs.overlays = [ - # (self: super: { - # # use lf fork with support for sixel graphics - # lf = super.lf.overrideAttrs (old: { - # src = super.fetchFromGitHub { - # owner = "horriblename"; - # repo = "lf"; - # rev = "8997e5b03772d5628ed6a490777048581d978674"; - # sha256 = "rJq2Tv3py6HvRI1O2odTdGb1ksdijhO3FcJsPj5dm34="; - # }; - # }); - # }) - - (self: super: { - kile-wl = super.rustPlatform.buildRustPackage rec { - pname = "kile-wl"; - version = "2023-08-23"; - src = super.fetchFromGitLab { - owner = "snakedye"; - repo = "kile"; - rev = "c24208761d04e0a74d203fc1dcd2f7fed68da388"; - sha256 = "sha256-4iclNVd7nm6LkgvsHwWaWyi1bZL/A+bbT5OSXn70bLs="; - }; - - cargoLock = { - lockFile = src + "/Cargo.lock"; - outputHashes = { - "kilexpr-0.1.0" = - "sha256-Bw6vYtzhheAJ8NLQtr3gLjZ9/5ajuABURRYDnVF9W1Y="; - }; - }; - - meta = with super.lib; { - description = "A tiling layout generator for river"; - homepage = "https://gitlab.com/snakedye/kile"; - license = licenses.mit; - platforms = - platforms.linux; # It's meant for river, a wayland compositor - mainProgram = "kile"; - }; - }; - }) - - (self: super: { - ristate = super.ristate.overrideAttrs (old: rec { - src = super.fetchFromGitLab { - owner = "snakedye"; - repo = "ristate"; - rev = "92e989f26cadac69af1208163733e73b4cf447da"; - sha256 = "sha256-6slH7R6kbSXQBd7q38oBEbngaCbFv0Tyq34VB1PAfhM="; - }; - cargoDeps = old.cargoDeps.overrideAttrs (super.lib.const { - inherit src; - outputHash = "sha256-fOo9C0dNL9dYy5wXq/yEDqOV0OhOTEY42XK8ShpQh6k="; - }); - }); - }) - - # These packages seem to be broken on the unstable channel, so I'm using - # the stable versions for now. Currently this is not happening for any - # package that I use :) - ]; - - # Let Home Manager install and manage itself. - # programs.home-manager.enable = true; - - # Home Manager needs a bit of information about you and the - # paths it should manage. - home.username = "rilla"; - home.homeDirectory = "/home/rilla"; - - imports = [ - # ./minidisc - ../modules/arduino - ../modules/browsers - ../modules/cheat - ../modules/dav - ../modules/drawterm - ../modules/fonts - ../modules/git - ../modules/gotify - ../modules/gpg - ../modules/idasen - ../modules/lf - ../modules/mail - ../modules/maker - ../modules/mpd - ../modules/msg - ../modules/music - ../modules/neovim - ../modules/pass - ../modules/rss - ../modules/snapcast - ../modules/sound - ../modules/ssh - ../modules/syncthing - ../modules/tmux - ../modules/vitetris - ../modules/wallets - ../modules/wine - ../modules/xdg - ../modules/zsh - ]; - - home.sessionVariables = { - EDITOR = "${pkgs.neovim}/bin/nvim"; - VISUAL = "${pkgs.neovim}/bin/nvim"; - BROWSER = "${pkgs.firefox}/bin/firefox"; - # OPENER = "todo"; # todo - TERMINAL = "${pkgs.alacritty}/bin/alacritty"; - CM_LAUNCHER = "rofi"; # for clipmenu - LEDGER_FILE = "${config.home.homeDirectory}/finance/2021.journal"; - }; - - home.packages = with pkgs; [ - # calibre - R - acpi - android-tools - ansible - bind.dnsutils - # pyenv - docker-compose - file - gimp - gnumake - html-tidy - htop - inetutils # telnet - j2cli - john - jq - killall - kubectl - libnotify - libreoffice - lxqt.pcmanfm-qt - mosh - mpv - neofetch - pynitrokey - networkmanagerapplet - nextcloud-client - pandoc - podman-compose - pv - ripgrep - sassc - screen - shellcheck - signify - unzip - vagrant - virt-manager - virtiofsd - wget - ]; - - # services.kdeconnect = { - # enable = true; - # indicator = true; - # }; - - programs.bat = { - enable = true; - config = { theme = "gruvbox-dark"; }; - }; - - programs.fzf = { - enable = true; - enableZshIntegration = true; - # defaultOptions = [ - # "--preview --preview 'bat --color=always --style=header,grid --line-range :300 {}'" - # ]; - tmux.enableShellIntegration = true; - }; - - services.gnome-keyring = { - enable = true; - components = [ "secrets" ]; - }; - - services.nextcloud-client = { - enable = true; - startInBackground = true; - }; - - dconf.settings = { - "org/virt-manager/virt-manager/connections" = { - "autoconnect" = [ "qemu:///system" ]; - "uris" = [ "qemu:///system" ]; - }; - }; - - programs.direnv = { - enable = true; - enableZshIntegration = true; - nix-direnv.enable = true; - }; - - home.stateVersion = "22.11"; -} diff --git a/home/modules/common/default.nix b/home/modules/common/default.nix new file mode 100644 index 0000000..124c75b --- /dev/null +++ b/home/modules/common/default.nix @@ -0,0 +1,147 @@ +{ inputs, outputs, lib, config, pkgs, ... }: + +{ + nixpkgs = { + overlays = [ + outputs.overlays.modifications + ]; + config = { + allowUnfree = true; + allowUnfreePredicate = (_: true); + }; + }; + + home = { + username = "rilla"; + homeDirectory = "/home/rilla"; + }; + + programs.home-manager.enable = true; + + imports = [ + # ./minidisc + ../arduino + ../browsers + ../cheat + ../dav + ../drawterm + ../fonts + ../foot + ../git + ../gotify + ../gpg + ../idasen + ../lf + ../mail + ../maker + ../mpd + ../msg + ../music + ../neovim + ../pass + ../rss + ../snapcast + ../sound + ../ssh + ../syncthing + ../tmux + ../vitetris + ../wallets + ../wine + ../xdg + ../zsh + ]; + + home.sessionVariables = { + BROWSER = "${pkgs.firefox}/bin/firefox"; + TERMINAL = "${pkgs.alacritty}/bin/alacritty"; + }; + + home.packages = with pkgs; [ + # calibre + R + acpi + android-tools + ansible + bind.dnsutils + # pyenv + docker-compose + file + gimp + gnumake + html-tidy + htop + inetutils # telnet + j2cli + john + jq + killall + kubectl + libnotify + libreoffice + lxqt.pcmanfm-qt + mosh + mpv + neofetch + pynitrokey + networkmanagerapplet + nextcloud-client + pandoc + podman-compose + pv + ripgrep + sassc + screen + shellcheck + signify + unzip + vagrant + virt-manager + virtiofsd + wget + ]; + + # services.kdeconnect = { + # enable = true; + # indicator = true; + # }; + + programs.bat = { + enable = true; + config = { theme = "gruvbox-dark"; }; + }; + + programs.fzf = { + enable = true; + enableZshIntegration = true; + # defaultOptions = [ + # "--preview --preview 'bat --color=always --style=header,grid --line-range :300 {}'" + # ]; + tmux.enableShellIntegration = true; + }; + + services.gnome-keyring = { + enable = true; + components = [ "secrets" ]; + }; + + services.nextcloud-client = { + enable = true; + startInBackground = true; + }; + + dconf.settings = { + "org/virt-manager/virt-manager/connections" = { + "autoconnect" = [ "qemu:///system" ]; + "uris" = [ "qemu:///system" ]; + }; + }; + + programs.direnv = { + enable = true; + enableZshIntegration = true; + nix-direnv.enable = true; + }; + + home.stateVersion = "22.11"; +} diff --git a/home/modules/desktop-river/default.nix b/home/modules/desktop-river/default.nix index 8c10325..c2b4a4a 100644 --- a/home/modules/desktop-river/default.nix +++ b/home/modules/desktop-river/default.nix @@ -4,7 +4,6 @@ imports = [ ./kile ./bemenu.nix - ./foot.nix ./init.nix ./kanshi.nix ./mako.nix diff --git a/home/modules/desktop-river/foot.nix b/home/modules/desktop-river/foot.nix deleted file mode 100644 index 7f8c2a8..0000000 --- a/home/modules/desktop-river/foot.nix +++ /dev/null @@ -1,47 +0,0 @@ -{ config, pkgs, ... }: - -let - font-name = "Hack Nerd Font"; - font-size = "10"; -in -{ - programs.foot = { - enable = true; - server.enable = true; - settings = { - main = { - shell = "${pkgs.tmux}/bin/tmux -u"; - font = "${font-name}:size=${font-size}:style=Regular"; - font-bold = "${font-name}:size=${font-size}:style=Bold"; - font-italic = "${font-name}:size=${font-size}:style=Italic"; - font-bold-italic = "${font-name}:size=${font-size}:style=Bold Italic"; - dpi-aware = "no"; - selection-target = "both"; - }; - colors = { - alpha = 0.9; - background = "282828"; - foreground = "ebdbb2"; - - regular0 = "282828"; # black - regular1 = "cc241d"; # red - regular2 = "98971a"; # green - regular3 = "d79921"; # yellow - regular4 = "458588"; # blue - regular5 = "b16286"; # magenta - regular6 = "689d6a"; # cyan - regular7 = "ebdbb2"; # white - - bright0 = "928374"; # black - bright1 = "fb4934"; # red - bright2 = "b8bb26"; # green - bright3 = "fabd2f"; # yellow - bright4 = "83a598"; # blue - bright5 = "d3869b"; # magenta - bright6 = "8ec07c"; # cyan - bright7 = "ebdbb2"; # white - }; - }; - }; - -} diff --git a/home/modules/music/default.nix b/home/modules/music/default.nix index 9e5f182..651fa6c 100644 --- a/home/modules/music/default.nix +++ b/home/modules/music/default.nix @@ -5,7 +5,10 @@ # wafConfigureFlags = old.wafConfigureFlags ++ [ "--windows-vst" ]; # }); #in -{ +let + home = config.home.homeDirectory; +in + { home.packages = [ pkgs.ardour # ardour-windows-vst @@ -27,4 +30,10 @@ pkgs.zynaddsubfx # pkgs.haskellPackages.tidal-midi ]; -} + + home.sessionVariables = { + LV2_PATH = "${home}/.nix-profile/lib/lv2:${home}/Audio/plugins/lv2:/run/current-system/sw/lib/lv2"; + LXVST_PATH = "${home}/.nix-profile/lib/lxvst:${home}/Audio/plugins/lxvst:/run/current-system/sw/lib/lxvst"; + LADSPA_PATH = "${home}/.nix-profile/lib/ladspa:${home}/Audio/plugins/ladspa:/run/current-system/sw/lib/ladspa"; + }; + } diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix index f836f08..25253b9 100644 --- a/home/modules/neovim/default.nix +++ b/home/modules/neovim/default.nix @@ -33,18 +33,25 @@ vscode-langservers-extracted ]; extraPython3Packages = pyPkgs: with pyPkgs; [ pylint ]; - # plugins = [ pkgs.vimPlugins.lazy-nvim ]; - # extraLuaConfig = builtins.readFile ./init.lua; }; - # home.file.lua = { - # recursive = true; - # source = ./lua; - # target = "/.config/nvim/lua"; - # }; home.packages = [ pkgs.neovide ]; + home.sessionVariables = { + EDITOR = "${pkgs.neovim}/bin/nvim"; + VISUAL = "${pkgs.neovim}/bin/nvim"; + }; home.file = { notes.source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Nextcloud/notes"; + nvim_init = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/configs/neovim-config/nvim/init.lua"; + target = "${config.xdg.configHome}/nvim/init.lua"; + }; + nvim_lua = { + source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/configs/neovim-config/nvim/lua"; + target = "${config.xdg.configHome}/nvim/lua"; + }; + }; + } diff --git a/justfile b/justfile index 9ed87df..ff717af 100644 --- a/justfile +++ b/justfile @@ -2,4 +2,9 @@ echidna: home-manager switch --flake .#rilla@echidna capibara: - doas nixos-rebuild switch --flake .#capibara + doas nixos-rebuild switch --flake .#capibara && \ + home-manager switch --flake .#rilla@capibara + +trantor: + doas nixos-rebuild switch --flake .#trantor && \ + home-manager switch --flake .#rilla@trantor diff --git a/nixos/hosts/capibara/default.nix b/nixos/hosts/capibara/default.nix index 2d5b61a..064d5f5 100644 --- a/nixos/hosts/capibara/default.nix +++ b/nixos/hosts/capibara/default.nix @@ -1,7 +1,6 @@ -{ config, pkgs, stablePkgs, ... }: +{ config, pkgs, ... }: let - home = "/home/rilla"; offline-backups = pkgs.writeScriptBin "offline-backups" '' #!${pkgs.dash}/bin/dash @@ -22,163 +21,14 @@ in { imports = [ ./hardware-configuration.nix - ../../modules/common - ../../modules/common/desktop.nix + ./file-systems.nix ]; - home-manager.users.rilla.imports = [ - ../../../home/hosts/capibara.nix - ]; - - fileSystems = { - "/" = { - device = "tmpfs"; - fsType = "tmpfs"; - options = [ "defaults" "size=2G" "mode=755" ]; - }; - - "/mnt/btr_root" = { - device = "/dev/mapper/root"; - fsType = "btrfs"; - options = [ "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/btr_data" = { - device = "/dev/mapper/data"; - fsType = "btrfs"; - options = [ "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/persist" = { - device = "/dev/mapper/data"; - fsType = "btrfs"; - options = [ "subvol=persist" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/logs" = { - device = "/dev/mapper/root"; - fsType = "btrfs"; - options = [ "subvol=logs" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/data" = { - device = "/dev/mapper/data"; - fsType = "btrfs"; - options = [ "subvol=data" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/secrets" = { - device = "narwhal:/secrets"; - fsType = "nfs"; - options = [ "noauto" ]; - }; - - "/mnt/secrets/gnupg" = { - device = "/dev/mapper/gnupg_secrets"; - fsType = "btrfs"; - options = [ "noauto" ]; - }; - - "/nix" = { - device = "/dev/mapper/root"; - fsType = "btrfs"; - options = [ "subvol=nix" "compress=zstd" ]; - }; - - "/boot" = { - device = "/dev/disk/by-uuid/c99d1f1b-45a4-4a25-b5b8-bc76464c6825"; - fsType = "ext4"; - }; - - "/swap" = { - device = "/dev/mapper/root"; - fsType = "btrfs"; - options = [ "subvol=swap" ]; - }; - - "/mnt/vfs_share" = { - device = "/dev/mapper/data"; - fsType = "btrfs"; - options = [ "subvol=vfs_share" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/backups/0" = { - device = "/dev/mapper/backups0"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/backups/1" = { - device = "/dev/mapper/backups1"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/backups/2" = { - device = "/dev/mapper/backups2"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - }; - - swapDevices = [{ device = "/swap/swapfile"; }]; - - environment.etc = { - crypttab = { - text = '' - backups0 UUID="e45232d5-f46f-46f3-a150-be26374b3357" /etc/luks-keys/backups.bin noauto - backups1 UUID="5b3da928-4862-4451-89cd-5bd6a95466d0" /etc/luks-keys/backups.bin noauto - backups2 UUID="cbfa9cba-dee2-4d0b-8cde-2f1d1849b22c" /etc/luks-keys/backups.bin noauto - gnupg_secrets /mnt/secrets/gnupg.img none noauto - ''; - }; - }; - - environment.variables = { - LV2_PATH = - "${home}/.nix-profile/lib/lv2:${home}/Audio/plugins/lv2:/run/current-system/sw/lib/lv2"; - LXVST_PATH = - "${home}/.nix-profile/lib/lxvst:${home}/Audio/plugins/lxvst:/run/current-system/sw/lib/lxvst"; - LADSPA_PATH = - "${home}/.nix-profile/lib/ladspa:${home}/Audio/plugins/ladspa:/run/current-system/sw/lib/ladspa"; - }; - networking.networkmanager.wifi.macAddress = "CC:AF:78:75:29:32"; nixpkgs.config.allowUnfree = true; programs.steam.enable = true; - boot = { - - loader = { - grub = { - efiSupport = false; - efiInstallAsRemovable = false; - enable = true; - device = "/dev/disk/by-id/ata-KINGSTON_SKC600MS512G_50026B7783FC3D2F"; - }; - }; - initrd = { - luks = { - devices = { - root = { - device = "/dev/disk/by-uuid/869b4b9e-5004-4625-877f-6b1c9489ac8f"; - allowDiscards = true; - }; - data = { - device = "/dev/disk/by-uuid/6a9246a0-984b-471c-9950-be16db3060f5"; - allowDiscards = true; - }; - }; - reusePassphrases = true; - }; - }; - }; services.earlyoom.enable = true; @@ -190,15 +40,6 @@ in services.power-profiles-daemon.enable = false; environment.systemPackages = with pkgs; [ powertop acpi offline-backups ]; - #services.beesd.filesystems = { - # root = { - # spec = "/dev/mapper/root"; - # hashTableSizeMB = 256; - # verbosity = "info"; - # extraOptions = [ "--loadavg-target" "2.0" ]; - # }; - #}; - # todo: target and/or archive services.btrbk.instances = { btrbk = { diff --git a/nixos/hosts/capibara/file-systems.nix b/nixos/hosts/capibara/file-systems.nix new file mode 100644 index 0000000..a14ae95 --- /dev/null +++ b/nixos/hosts/capibara/file-systems.nix @@ -0,0 +1,135 @@ +{ config, pkgs, stablePkgs, ... }: + +{ + boot = { + + loader = { + grub = { + efiSupport = false; + efiInstallAsRemovable = false; + enable = true; + device = "/dev/disk/by-id/ata-KINGSTON_SKC600MS512G_50026B7783FC3D2F"; + }; + }; + initrd = { + luks = { + devices = { + root = { + device = "/dev/disk/by-uuid/869b4b9e-5004-4625-877f-6b1c9489ac8f"; + allowDiscards = true; + }; + data = { + device = "/dev/disk/by-uuid/6a9246a0-984b-471c-9950-be16db3060f5"; + allowDiscards = true; + }; + }; + reusePassphrases = true; + }; + }; + }; + + fileSystems = { + "/" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ "defaults" "size=2G" "mode=755" ]; + }; + + "/mnt/btr_root" = { + device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/btr_data" = { + device = "/dev/mapper/data"; + fsType = "btrfs"; + options = [ "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/persist" = { + device = "/dev/mapper/data"; + fsType = "btrfs"; + options = [ "subvol=persist" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/logs" = { + device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=logs" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/data" = { + device = "/dev/mapper/data"; + fsType = "btrfs"; + options = [ "subvol=data" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/secrets" = { + device = "narwhal:/secrets"; + fsType = "nfs"; + options = [ "noauto" ]; + }; + + "/mnt/secrets/gnupg" = { + device = "/dev/mapper/gnupg_secrets"; + fsType = "btrfs"; + options = [ "noauto" ]; + }; + + "/nix" = { + device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=nix" "compress=zstd" ]; + }; + + "/boot" = { + device = "/dev/disk/by-uuid/c99d1f1b-45a4-4a25-b5b8-bc76464c6825"; + fsType = "ext4"; + }; + + "/swap" = { + device = "/dev/mapper/root"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + + "/mnt/vfs_share" = { + device = "/dev/mapper/data"; + fsType = "btrfs"; + options = [ "subvol=vfs_share" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/backups/0" = { + device = "/dev/mapper/backups0"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/backups/1" = { + device = "/dev/mapper/backups1"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/backups/2" = { + device = "/dev/mapper/backups2"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + }; + + swapDevices = [{ device = "/swap/swapfile"; }]; + + environment.etc.crypttab.text = '' + backups0 UUID="e45232d5-f46f-46f3-a150-be26374b3357" /etc/luks-keys/backups.bin noauto + backups1 UUID="5b3da928-4862-4451-89cd-5bd6a95466d0" /etc/luks-keys/backups.bin noauto + backups2 UUID="cbfa9cba-dee2-4d0b-8cde-2f1d1849b22c" /etc/luks-keys/backups.bin noauto + gnupg_secrets /mnt/secrets/gnupg.img none noauto + ''; +} diff --git a/nixos/hosts/trantor/default.nix b/nixos/hosts/trantor/default.nix index 76c8826..29449b8 100644 --- a/nixos/hosts/trantor/default.nix +++ b/nixos/hosts/trantor/default.nix @@ -1,191 +1,20 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). +{ config, pkgs, ... }: -{ config, pkgs, stablePkgs, ... }: - -let home = "/home/rilla"; -in { +{ imports = [ ./hardware-configuration.nix - ../../modules/common - ../../modules/common/desktop.nix + ./file-systems.nix ]; home-manager.users.rilla.imports = [ ../../../home/hosts/trantor.nix ]; - fileSystems = { - - "/" = { - device = "tmpfs"; - fsType = "tmpfs"; - options = [ "defaults" "size=2G" "mode=755" ]; - }; - - "/boot/efi" = { - device = "/dev/disk/by-uuid/0BFA-9A66"; - fsType = "vfat"; - }; - - "/mnt/btr_system" = { - device = "/dev/mapper/system"; - fsType = "btrfs"; - options = [ "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/btr_user" = { - device = "/dev/mapper/user"; - fsType = "btrfs"; - options = [ "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/persist" = { - device = "/dev/mapper/user"; - fsType = "btrfs"; - options = [ "subvol=persist" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/data" = { - device = "/dev/mapper/user"; - fsType = "btrfs"; - options = [ "subvol=data" "compress=zstd" ]; - neededForBoot = true; - }; - - "/mnt/vfs_share" = { - device = "/dev/mapper/user"; - fsType = "btrfs"; - options = [ "subvol=vfs_share" "compress=zstd" ]; - neededForBoot = true; - }; - - "/nix" = { - device = "/dev/mapper/system"; - fsType = "btrfs"; - options = [ "subvol=nix" "compress=zstd" ]; - }; - - "/mnt/logs" = { - device = "/dev/mapper/system"; - fsType = "btrfs"; - options = [ "subvol=logs" "compress=zstd" ]; - neededForBoot = true; - }; - - "/boot" = { - device = "/dev/mapper/system"; - fsType = "btrfs"; - options = [ "subvol=boot" "compress=zstd" ]; - }; - - "/swap" = { - device = "/dev/mapper/system"; - fsType = "btrfs"; - options = [ "subvol=swap" ]; - }; - - "/mnt/narwhal" = { - device = "narwhal:/"; - fsType = "nfs"; - }; - - "/mnt/backups/0" = { - device = "/dev/mapper/backups0"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/backups/1" = { - device = "/dev/mapper/backups1"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - "/mnt/backups/2" = { - device = "/dev/mapper/backups2"; - fsType = "btrfs"; - options = [ "noauto" "subvolid=5" "compress=zstd" ]; - }; - - }; - - swapDevices = [{ device = "/swap/swapfile"; }]; - - environment.etc = { - crypttab = { - text = '' - backups0 UUID="e45232d5-f46f-46f3-a150-be26374b3357" /etc/luks-keys/backups.bin noauto - backups1 UUID="5b3da928-4862-4451-89cd-5bd6a95466d0" /etc/luks-keys/backups.bin noauto - backups2 UUID="cbfa9cba-dee2-4d0b-8cde-2f1d1849b22c" /etc/luks-keys/backups.bin noauto - ''; - }; - }; - - environment.variables = { - NIXOS_CONFIG = "${home}/configs/nix-config/trantor.nix"; - LV2_PATH = - "${home}/.nix-profile/lib/lv2:${home}/Audio/plugins/lv2:/run/current-system/sw/lib/lv2"; - LXVST_PATH = - "${home}/.nix-profile/lib/lxvst:${home}/Audio/plugins/lxvst:/run/current-system/sw/lib/lxvst"; - LADSPA_PATH = - "${home}/.nix-profile/lib/ladspa:${home}/Audio/plugins/ladspa:/run/current-system/sw/lib/ladspa"; - }; - networking.networkmanager.wifi.macAddress = "80:FA:5B:41:12:0F"; nixpkgs.config.allowUnfree = true; programs.steam.enable = true; - boot = { - loader = { - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot/efi"; - }; - grub = { - enable = true; - device = "nodev"; - enableCryptodisk = true; - efiSupport = true; - }; - }; - initrd = { - luks = { - #yubikeySupport = true; - devices = { - "system" = { - device = "/dev/disk/by-uuid/b9778e01-a86c-4c6b-beb3-f97888d4a6eb"; - keyFile = "/system_keyfile.bin"; - allowDiscards = true; - # yubikey = { - # slot = 2; - # twoFactor = false; - # gracePeriod = 30; - # keyLength = 64; - # saltLength = 16; - # storage = { - # device = "/dev/nvme0n1p1"; - # fsType = "vfat"; - # path = "/crypt-storage/default"; - # }; - # }; - }; - "user" = { - device = "/dev/disk/by-uuid/d8e9b35d-704a-4f66-bc19-0dd3e158de36"; - keyFile = "/user_keyfile.bin"; - }; - }; - }; - secrets = { - "/system_keyfile.bin" = "/etc/luks-keys/system.bin"; - "/user_keyfile.bin" = "/etc/luks-keys/user.bin"; - }; - }; - }; - # todo: target and/or archive services.btrbk = { sshAccess = [{ diff --git a/nixos/hosts/trantor/file-systems.nix b/nixos/hosts/trantor/file-systems.nix new file mode 100644 index 0000000..22558c7 --- /dev/null +++ b/nixos/hosts/trantor/file-systems.nix @@ -0,0 +1,154 @@ +{ config, pkgs, ... }: + +{ + boot = { + loader = { + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot/efi"; + }; + grub = { + enable = true; + device = "nodev"; + enableCryptodisk = true; + efiSupport = true; + }; + }; + initrd = { + luks = { + #yubikeySupport = true; + devices = { + "system" = { + device = "/dev/disk/by-uuid/b9778e01-a86c-4c6b-beb3-f97888d4a6eb"; + keyFile = "/system_keyfile.bin"; + allowDiscards = true; + # yubikey = { + # slot = 2; + # twoFactor = false; + # gracePeriod = 30; + # keyLength = 64; + # saltLength = 16; + # storage = { + # device = "/dev/nvme0n1p1"; + # fsType = "vfat"; + # path = "/crypt-storage/default"; + # }; + # }; + }; + "user" = { + device = "/dev/disk/by-uuid/d8e9b35d-704a-4f66-bc19-0dd3e158de36"; + keyFile = "/user_keyfile.bin"; + }; + }; + }; + secrets = { + "/system_keyfile.bin" = "/etc/luks-keys/system.bin"; + "/user_keyfile.bin" = "/etc/luks-keys/user.bin"; + }; + }; + }; + + fileSystems = { + + "/" = { + device = "tmpfs"; + fsType = "tmpfs"; + options = [ "defaults" "size=2G" "mode=755" ]; + }; + + "/boot/efi" = { + device = "/dev/disk/by-uuid/0BFA-9A66"; + fsType = "vfat"; + }; + + "/mnt/btr_system" = { + device = "/dev/mapper/system"; + fsType = "btrfs"; + options = [ "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/btr_user" = { + device = "/dev/mapper/user"; + fsType = "btrfs"; + options = [ "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/persist" = { + device = "/dev/mapper/user"; + fsType = "btrfs"; + options = [ "subvol=persist" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/data" = { + device = "/dev/mapper/user"; + fsType = "btrfs"; + options = [ "subvol=data" "compress=zstd" ]; + neededForBoot = true; + }; + + "/mnt/vfs_share" = { + device = "/dev/mapper/user"; + fsType = "btrfs"; + options = [ "subvol=vfs_share" "compress=zstd" ]; + neededForBoot = true; + }; + + "/nix" = { + device = "/dev/mapper/system"; + fsType = "btrfs"; + options = [ "subvol=nix" "compress=zstd" ]; + }; + + "/mnt/logs" = { + device = "/dev/mapper/system"; + fsType = "btrfs"; + options = [ "subvol=logs" "compress=zstd" ]; + neededForBoot = true; + }; + + "/boot" = { + device = "/dev/mapper/system"; + fsType = "btrfs"; + options = [ "subvol=boot" "compress=zstd" ]; + }; + + "/swap" = { + device = "/dev/mapper/system"; + fsType = "btrfs"; + options = [ "subvol=swap" ]; + }; + + "/mnt/narwhal" = { + device = "narwhal:/"; + fsType = "nfs"; + }; + + "/mnt/backups/0" = { + device = "/dev/mapper/backups0"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/backups/1" = { + device = "/dev/mapper/backups1"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + "/mnt/backups/2" = { + device = "/dev/mapper/backups2"; + fsType = "btrfs"; + options = [ "noauto" "subvolid=5" "compress=zstd" ]; + }; + + }; + + swapDevices = [{ device = "/swap/swapfile"; }]; + + environment.etc.crypttab.text = '' + backups0 UUID="e45232d5-f46f-46f3-a150-be26374b3357" /etc/luks-keys/backups.bin noauto + backups1 UUID="5b3da928-4862-4451-89cd-5bd6a95466d0" /etc/luks-keys/backups.bin noauto + backups2 UUID="cbfa9cba-dee2-4d0b-8cde-2f1d1849b22c" /etc/luks-keys/backups.bin noauto + ''; +} diff --git a/nixos/modules/common/default.nix b/nixos/modules/common.nix similarity index 100% rename from nixos/modules/common/default.nix rename to nixos/modules/common.nix diff --git a/nixos/modules/common/desktop.nix b/nixos/modules/desktop.nix similarity index 100% rename from nixos/modules/common/desktop.nix rename to nixos/modules/desktop.nix diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..fa55846 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,63 @@ +{ inputs, ... }: + +{ + modifications = final: prev: { + + # # use lf fork with support for sixel graphics + # lf = prev.lf.overrideAttrs (old: { + # src = prev.fetchFromGitHub { + # owner = "horriblename"; + # repo = "lf"; + # rev = "8997e5b03772d5628ed6a490777048581d978674"; + # sha256 = "rJq2Tv3py6HvRI1O2odTdGb1ksdijhO3FcJsPj5dm34="; + # }; + # }); + + kile-wl = prev.rustPlatform.buildRustPackage rec { + pname = "kile-wl"; + version = "2023-08-23"; + src = prev.fetchFromGitLab { + owner = "snakedye"; + repo = "kile"; + rev = "c24208761d04e0a74d203fc1dcd2f7fed68da388"; + sha256 = "sha256-4iclNVd7nm6LkgvsHwWaWyi1bZL/A+bbT5OSXn70bLs="; + }; + cargoLock = { + lockFile = src + "/Cargo.lock"; + outputHashes = { + "kilexpr-0.1.0" = + "sha256-Bw6vYtzhheAJ8NLQtr3gLjZ9/5ajuABURRYDnVF9W1Y="; + }; + }; + meta = with prev.lib; { + description = "A tiling layout generator for river"; + homepage = "https://gitlab.com/snakedye/kile"; + license = licenses.mit; + platforms = + platforms.linux; # It's meant for river, a wayland compositor + mainProgram = "kile"; + }; + }; + + ristate = prev.ristate.overrideAttrs (old: rec { + src = prev.fetchFromGitLab { + owner = "snakedye"; + repo = "ristate"; + rev = "92e989f26cadac69af1208163733e73b4cf447da"; + sha256 = "sha256-6slH7R6kbSXQBd7q38oBEbngaCbFv0Tyq34VB1PAfhM="; + }; + cargoDeps = old.cargoDeps.overrideAttrs (prev.lib.const { + inherit src; + outputHash = "sha256-fOo9C0dNL9dYy5wXq/yEDqOV0OhOTEY42XK8ShpQh6k="; + }); + }); + + }; + + stable-packages = final: prev: { + stable = import inputs.nixpkgs-stable { + system = final.system; + config.allowUnfree = true; + }; + }; +}