diff --git a/README.md b/README.md index 2d4e85b..283d1f4 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,6 @@ ## Structure - `hosts/` contain nixos configuration for hosts - - `common/` shared configuration modules - - `core/` base configuration shared on all machines - - `dev/` configuration enabling dev environment - - `graphical/` configuration for graphical environments - - `hardware/` configuration for hardware components - `/` configuration for hosts - `default.nix` Toplevel system definition - `fs.nix` file system definiton @@ -15,8 +10,13 @@ - `secrets/` secrets local to this hosts - `secrets.nix.age` local secrets usable on deploy - `host.pub` host public key, needed for rekeying agenix secrets -- `modules/` extra nixos modules +- `modules/` extra nixos modules and shared configurations - `secrets.nix` module to enable deploy-time secrets + - `config/` base configuration used on all machines + - `dev/` configuration options enabling developer environment + - `graphical/` configuration for graphical environments + - `hardware/` configuration for hardware components + - `impermanence/` impermanence modules for hosts - `nix/` additional nix functions - `checks.nix` pre-commit checks - `colmena.nix` Setup for using colmena to deploy @@ -34,7 +34,6 @@ - `graphical/` configuration for graphical programs - `programs/` configuration for miscellaneous programs - `shells/` configuration for shells - - `impermanence.nix` hm-impermanence setup for users - `default.nix` minimal setup for all users - `interactive.nix` minimal setup for interactive users on a command line - `graphical.nix` configuration for users utilizing a graphical interface diff --git a/flake.nix b/flake.nix index 678704f..0941db8 100644 --- a/flake.nix +++ b/flake.nix @@ -116,7 +116,7 @@ inherit pkgs; modules = [ ./nix/installer-configuration.nix - ./hosts/common/core/ssh.nix + ./modules/os-conf/core/ssh.nix {system.stateVersion = stateVersion;} ]; format = diff --git a/hosts/desktopnix/default.nix b/hosts/desktopnix/default.nix index eb04366..8a21355 100644 --- a/hosts/desktopnix/default.nix +++ b/hosts/desktopnix/default.nix @@ -5,19 +5,18 @@ inputs.nixos-hardware.nixosModules.common-pc-hdd inputs.nixos-hardware.nixosModules.common-pc-ssd - ../common/core - ../common/dev + ../../modules/config + ../../modules/dev - ../common/graphical/fonts.nix - ../common/graphical/steam.nix + ../../modules/impermanence - ../common/hardware/bluetooth.nix - ../common/hardware/intel.nix - ../common/hardware/nvidia.nix - ../common/hardware/physical.nix - ../common/hardware/pipewire.nix - ../common/hardware/yubikey.nix - ../common/hardware/zfs.nix + ../../modules/hardware/bluetooth.nix + ../../modules/hardware/intel.nix + ../../modules/hardware/nvidia.nix + ../../modules/hardware/physical.nix + ../../modules/hardware/pipewire.nix + ../../modules/hardware/yubikey.nix + ../../modules/hardware/zfs.nix ./net.nix ./fs.nix diff --git a/hosts/patricknix/default.nix b/hosts/patricknix/default.nix index da2ca14..67a6129 100644 --- a/hosts/patricknix/default.nix +++ b/hosts/patricknix/default.nix @@ -5,22 +5,21 @@ inputs.nixos-hardware.nixosModules.common-pc-laptop inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd - ../common/core - ../common/dev + ../../modules/config + ../../modules/dev - ../common/graphical/fonts.nix - ../common/graphical/steam.nix + ../../modules/impermanence - ../common/hardware/bluetooth.nix - ../common/hardware/intel.nix - ../common/hardware/laptop.nix - ../common/hardware/physical.nix - ../common/hardware/pipewire.nix - ../common/hardware/yubikey.nix - ../common/hardware/zfs.nix + ../../modules/hardware/bluetooth.nix + ../../modules/hardware/laptop.nix + ../../modules/hardware/intel.nix + ../../modules/hardware/nvidia.nix + ../../modules/hardware/physical.nix + ../../modules/hardware/pipewire.nix + ../../modules/hardware/yubikey.nix + ../../modules/hardware/zfs.nix - ../common/hardware/nvidia.nix - ../common/hardware/prime-offload.nix + ../../modules/hardware/prime-offload.nix ./net.nix ./fs.nix diff --git a/hosts/testienix/default.nix b/hosts/testienix/default.nix index 3d16bf4..2b2629c 100644 --- a/hosts/testienix/default.nix +++ b/hosts/testienix/default.nix @@ -4,11 +4,11 @@ inputs.nixos-hardware.nixosModules.common-pc-ssd # TODO: sollte entfernt werden für server - ../common/core + ../../modules/config - ../common/hardware/intel.nix - ../common/hardware/physical.nix - ../common/hardware/zfs.nix + ../../modules/hardware/intel.nix + ../../modules/hardware/physical.nix + ../../modules/hardware/zfs.nix ./net.nix ./fs.nix diff --git a/hosts/common/core/default.nix b/modules/config/default.nix similarity index 80% rename from hosts/common/core/default.nix rename to modules/config/default.nix index eb459c8..e1a8718 100644 --- a/hosts/common/core/default.nix +++ b/modules/config/default.nix @@ -1,8 +1,8 @@ {inputs, ...}: { imports = [ ./efi.nix + ./fonts.nix ./home-manager.nix - ./impermanence.nix ./inputrc.nix ./issue.nix ./net.nix @@ -11,10 +11,10 @@ ./system.nix ./xdg.nix - ../../../users/root + ../../users/root - ../../../modules/secrets.nix - ../../../modules/meta.nix + ../secrets.nix + ../meta.nix inputs.home-manager.nixosModules.default inputs.impermanence.nixosModules.impermanence diff --git a/hosts/common/core/efi.nix b/modules/config/efi.nix similarity index 100% rename from hosts/common/core/efi.nix rename to modules/config/efi.nix diff --git a/hosts/common/graphical/fonts.nix b/modules/config/fonts.nix similarity index 100% rename from hosts/common/graphical/fonts.nix rename to modules/config/fonts.nix diff --git a/hosts/common/core/home-manager.nix b/modules/config/home-manager.nix similarity index 64% rename from hosts/common/core/home-manager.nix rename to modules/config/home-manager.nix index 8d13eb2..8d20c06 100644 --- a/hosts/common/core/home-manager.nix +++ b/modules/config/home-manager.nix @@ -1,10 +1,4 @@ -{ - stateVersion, - config, - inputs, - pkgs, - ... -}: { +{stateVersion, ...}: { home-manager = { useGlobalPkgs = true; useUserPackages = true; @@ -13,11 +7,7 @@ { home.stateVersion = stateVersion; } - inputs.impermanence.nixosModules.home-manager.impermanence ]; - extraSpecialArgs = { - nixosConfig = config; - }; }; # HM zsh needs this or else the startup order is fucked # and env variables will be loaded incorrectly diff --git a/hosts/common/core/inputrc.nix b/modules/config/inputrc.nix similarity index 100% rename from hosts/common/core/inputrc.nix rename to modules/config/inputrc.nix diff --git a/hosts/common/core/issue.nix b/modules/config/issue.nix similarity index 100% rename from hosts/common/core/issue.nix rename to modules/config/issue.nix diff --git a/hosts/common/core/net.nix b/modules/config/net.nix similarity index 100% rename from hosts/common/core/net.nix rename to modules/config/net.nix diff --git a/hosts/common/core/nix.nix b/modules/config/nix.nix similarity index 100% rename from hosts/common/core/nix.nix rename to modules/config/nix.nix diff --git a/hosts/common/core/ssh.nix b/modules/config/ssh.nix similarity index 100% rename from hosts/common/core/ssh.nix rename to modules/config/ssh.nix diff --git a/hosts/common/core/system.nix b/modules/config/system.nix similarity index 97% rename from hosts/common/core/system.nix rename to modules/config/system.nix index f247296..1bf5e72 100644 --- a/hosts/common/core/system.nix +++ b/modules/config/system.nix @@ -61,7 +61,7 @@ local = config.node.secretsDir + "/secrets.nix.age"; in { - global = ../../../secrets/secrets.nix.age; + global = ../../secrets/secrets.nix.age; } // lib.optionalAttrs (config.node.name != null && lib.pathExists local) {inherit local;}; } diff --git a/hosts/common/core/xdg.nix b/modules/config/xdg.nix similarity index 100% rename from hosts/common/core/xdg.nix rename to modules/config/xdg.nix diff --git a/hosts/common/dev/default.nix b/modules/dev/default.nix similarity index 100% rename from hosts/common/dev/default.nix rename to modules/dev/default.nix diff --git a/hosts/common/dev/docs.nix b/modules/dev/docs.nix similarity index 100% rename from hosts/common/dev/docs.nix rename to modules/dev/docs.nix diff --git a/modules/graphical/fonts.nix b/modules/graphical/fonts.nix new file mode 100644 index 0000000..0b893e8 --- /dev/null +++ b/modules/graphical/fonts.nix @@ -0,0 +1,52 @@ +{pkgs, ...}: { + fonts = { + enableGhostscriptFonts = false; + fontDir.enable = false; + fontconfig = { + defaultFonts = { + sansSerif = ["IBM Plex Sans"]; + serif = ["IBM Plex Sans"]; + monospace = ["FiraCode Nerd Font"]; + emoji = ["Noto Color Emoji"]; + }; + localConf = '' + + + + + monospace + + emoji + + + + sans-serif + + emoji + + + + serif + + emoji + + + + ''; + }; + packages = with pkgs; [ + (nerdfonts.override {fonts = ["FiraCode"];}) + ibm-plex + dejavu_fonts + unifont + freefont_ttf + gyre-fonts # TrueType substitutes for standard PostScript fonts + liberation_ttf + noto-fonts + noto-fonts-cjk-sans + noto-fonts-cjk-serif + noto-fonts-emoji + noto-fonts-extra + ]; + }; +} diff --git a/hosts/common/graphical/steam.nix b/modules/graphical/steam.nix similarity index 100% rename from hosts/common/graphical/steam.nix rename to modules/graphical/steam.nix diff --git a/hosts/common/graphical/wayland.nix b/modules/graphical/wayland.nix similarity index 100% rename from hosts/common/graphical/wayland.nix rename to modules/graphical/wayland.nix diff --git a/hosts/common/hardware/bluetooth.nix b/modules/hardware/bluetooth.nix similarity index 100% rename from hosts/common/hardware/bluetooth.nix rename to modules/hardware/bluetooth.nix diff --git a/hosts/common/hardware/intel.nix b/modules/hardware/intel.nix similarity index 100% rename from hosts/common/hardware/intel.nix rename to modules/hardware/intel.nix diff --git a/hosts/common/hardware/laptop.nix b/modules/hardware/laptop.nix similarity index 100% rename from hosts/common/hardware/laptop.nix rename to modules/hardware/laptop.nix diff --git a/hosts/common/hardware/nvidia.nix b/modules/hardware/nvidia.nix similarity index 100% rename from hosts/common/hardware/nvidia.nix rename to modules/hardware/nvidia.nix diff --git a/hosts/common/hardware/physical.nix b/modules/hardware/physical.nix similarity index 100% rename from hosts/common/hardware/physical.nix rename to modules/hardware/physical.nix diff --git a/hosts/common/hardware/pipewire.nix b/modules/hardware/pipewire.nix similarity index 100% rename from hosts/common/hardware/pipewire.nix rename to modules/hardware/pipewire.nix diff --git a/hosts/common/hardware/prime-offload.nix b/modules/hardware/prime-offload.nix similarity index 100% rename from hosts/common/hardware/prime-offload.nix rename to modules/hardware/prime-offload.nix diff --git a/hosts/common/hardware/yubikey.nix b/modules/hardware/yubikey.nix similarity index 100% rename from hosts/common/hardware/yubikey.nix rename to modules/hardware/yubikey.nix diff --git a/hosts/common/hardware/zfs.nix b/modules/hardware/zfs.nix similarity index 100% rename from hosts/common/hardware/zfs.nix rename to modules/hardware/zfs.nix diff --git a/hosts/common/core/impermanence.nix b/modules/impermanence/default.nix similarity index 100% rename from hosts/common/core/impermanence.nix rename to modules/impermanence/default.nix diff --git a/modules/impermanence/users.nix b/modules/impermanence/users.nix new file mode 100644 index 0000000..4a77748 --- /dev/null +++ b/modules/impermanence/users.nix @@ -0,0 +1,45 @@ +userName: { + config, + lib, + ... +}: { + environment.persistence."/state" = { + users.${userName} = let + hmConfig = config.home-manager.users.${userName}; + in { + files = [ + ".ssh/known_hosts" + ]; + directories = with lib.lists; + [] + ++ + # firefox cannot be a symlink as home manager refuses put files outside your $HOME + optionals hmConfig.programs.firefox.enable [ + ".mozilla" + ] + ++ optionals hmConfig.programs.atuin.enable [ + ".local/share/atuin" + ] + ++ optionals hmConfig.programs.direnv.enable [ + ".local/share/direnv" + ] + ++ optionals hmConfig.programs.neovim.enable [ + ".local/share/nvim" + ".local/state/nvim" + ".cache/nvim" + ] + # root should never use interactive programs + ++ optionals config.services.pipewire.enable [ + # persist sound config + ".local/state/wireplumber" + ] + # Folders for steam + ++ optionals config.programs.steam.enable + [ + ".local/share/Steam" + ".steam" + ".local/share//Daedalic Entertainment GmbH/" + ]; + }; + }; +} diff --git a/modules/secrets.nix b/modules/secrets.nix index 116348d..e437e8f 100644 --- a/modules/secrets.nix +++ b/modules/secrets.nix @@ -1,6 +1,5 @@ { lib, - pkgs, inputs, config, ... @@ -14,7 +13,6 @@ types mkOption mdDoc - mkIf literalExpression ; # If the given expression is a bare set, it will be wrapped in a function, diff --git a/users/common/default.nix b/users/common/default.nix index fa2b9cf..a52be2d 100644 --- a/users/common/default.nix +++ b/users/common/default.nix @@ -4,8 +4,6 @@ ./shells/zsh ./programs/gpg - - ./impermanence.nix ]; home.packages = with pkgs; [ diff --git a/users/common/impermanence.nix b/users/common/impermanence.nix deleted file mode 100644 index 5e7c3fd..0000000 --- a/users/common/impermanence.nix +++ /dev/null @@ -1,50 +0,0 @@ -{ - pkgs, - config, - lib, - nixosConfig, - ... -}: { - home.persistence."/state/${config.home.homeDirectory}" = with lib.lists; { - allowOther = true; - files = [ - ".ssh/known_hosts" - ]; - directories = - # firefox cannot be a symlink as home manager refuses put files outside your $HOME - optionals config.programs.firefox.enable [ - ".mozilla" - ] - ++ pkgs.lib.impermanence.makeSymlinks ( - optionals config.programs.atuin.enable [ - ".local/share/atuin" - ] - ++ optionals config.programs.direnv.enable [ - ".local/share/direnv" - ] - ++ optionals config.programs.neovim.enable [ - ".local/share/nvim" - ".local/state/nvim" - ".cache/nvim" - ] - ++ optionals (builtins.elem pkgs.heroic config.home.packages) [ - ".config/heroic" - "Games/Heroic" - ] - # root should never use interactive programs - ++ optionals nixosConfig.users.users.${config.home.username}.isNormalUser ( - optionals nixosConfig.services.pipewire.enable [ - # persist sound config - ".local/state/wireplumber" - ] - # Folders for steam - ++ optionals nixosConfig.programs.steam.enable - [ - ".local/share/Steam" - ".steam" - ".local/share//Daedalic Entertainment GmbH/" - ] - ) - ); - }; -} diff --git a/users/patrick/default.nix b/users/patrick/default.nix index 63ac010..5a299d7 100644 --- a/users/patrick/default.nix +++ b/users/patrick/default.nix @@ -5,7 +5,10 @@ }: { # enable nixos wide wayland config imports = [ - ../../hosts/common/graphical/wayland.nix + ../../modules/graphical/wayland.nix + ../../modules/graphical/steam.nix + (import ../../modules/impermanence/users.nix "patrick") + ./impermanence.nix ]; users.users.patrick = { @@ -28,7 +31,6 @@ imports = [ ./patrick.nix ./ssh.nix - ./impermanence.nix ../common ../common/interactive.nix ../common/graphical diff --git a/users/patrick/impermanence.nix b/users/patrick/impermanence.nix index f71ab3c..79a9e57 100644 --- a/users/patrick/impermanence.nix +++ b/users/patrick/impermanence.nix @@ -1,17 +1,12 @@ { - config, - pkgs, - ... -}: { - home = { - persistence."/state/${config.home.homeDirectory}" = { - allowOther = true; - directories = pkgs.lib.impermanence.makeSymlinks [ + environment = { + persistence."/state".users.patrick = { + directories = [ "repos" "Downloads" # For nextcloud client install - "./Nextcloud" + "Nextcloud" ".config/Nextcloud" # for electron signal app state diff --git a/users/patrick/patrick.nix b/users/patrick/patrick.nix index 221310d..a8e2c33 100644 --- a/users/patrick/patrick.nix +++ b/users/patrick/patrick.nix @@ -2,7 +2,6 @@ home = { packages = with pkgs; [ nextcloud-client - heroic discord ]; }; diff --git a/users/patrick/ssh.nix b/users/patrick/ssh.nix index a1d5368..4829fc3 100644 --- a/users/patrick/ssh.nix +++ b/users/patrick/ssh.nix @@ -35,19 +35,6 @@ inherit identityFile; }; - "WSALVM" = { - hostname = "172.10.8.156"; - user = "root"; - inherit identityFile; - }; - - "CompConst" = { - hostname = "cp-service.kaist.ac.kr"; - user = "s20236085"; - port = 13001; - inherit identityFile; - }; - "valhalla" = { hostname = "valhalla.fs.tum.de"; user = "grossmann";