From 1a71b2cdc607d7e6b28763d9721840cb0e04c391 Mon Sep 17 00:00:00 2001 From: Dmitry Voronin Date: Mon, 30 Sep 2024 12:46:36 +0300 Subject: [PATCH] Move system configs to a separate dir. --- flake.nix | 39 ++++++++++++++------------- home/config/sway/default.nix | 2 +- host/x86_64-linux/dasha/default.nix | 4 --- host/x86_64-linux/desktop/default.nix | 4 --- host/x86_64-linux/home/default.nix | 9 ------- host/x86_64-linux/laptop/default.nix | 4 --- host/x86_64-linux/work/default.nix | 4 --- {module => system}/Bootloader.nix | 0 {module => system}/Crypto.nix | 0 {module => system}/Dbus.nix | 0 {module => system}/Filesystem.nix | 0 {module => system}/Firewall.nix | 0 {module => system}/Font.nix | 0 {module => system}/Fstrim.nix | 0 {module => system}/Locale.nix | 0 {module => system}/Network.nix | 0 {module => system}/Nix.nix | 0 {module => system}/Shell.nix | 0 {module => system}/Sshd.nix | 0 {module => system}/Systemd.nix | 0 {module => system}/Users.nix | 0 {module => system}/Vm.nix | 0 {module => system}/Zram.nix | 0 23 files changed, 22 insertions(+), 44 deletions(-) rename {module => system}/Bootloader.nix (100%) rename {module => system}/Crypto.nix (100%) rename {module => system}/Dbus.nix (100%) rename {module => system}/Filesystem.nix (100%) rename {module => system}/Firewall.nix (100%) rename {module => system}/Font.nix (100%) rename {module => system}/Fstrim.nix (100%) rename {module => system}/Locale.nix (100%) rename {module => system}/Network.nix (100%) rename {module => system}/Nix.nix (100%) rename {module => system}/Shell.nix (100%) rename {module => system}/Sshd.nix (100%) rename {module => system}/Systemd.nix (100%) rename {module => system}/Users.nix (100%) rename {module => system}/Vm.nix (100%) rename {module => system}/Zram.nix (100%) diff --git a/flake.nix b/flake.nix index 86c3228..a56959b 100644 --- a/flake.nix +++ b/flake.nix @@ -148,39 +148,38 @@ ) ); + # Nixos systems. nixosConfigurations = let # Function to create a host. It does basic setup, like adding common modules. - mkHost = { system, hostname, modules }: let - in nixpkgs.lib.nixosSystem { + mkHost = { system, hostname, modules }: nixpkgs.lib.nixosSystem { # `Inherit` is just an alias for `system = system;`, which means that # keep the `system` argument as a property in a resulting set. inherit system; # List of modules to use by defualt for all the hosts. - modules = modules ++ [ - # There I put host-specific configurations. - ./host/${system}/${hostname} - + modules = [ # Make a device hostname match the one from this config. { networking.hostName = hostname; } # Specify current release version. { system.stateVersion = self.const.stateVersion; } - # Add modules. - { imports = [ ./home/NixOs.nix ] ++ - (self.findFiles ./config) ++ - (self.findFiles ./container) ++ - (self.findFiles ./module) ++ - (self.findFiles ./overlay); - } - # Add Home Manager module. home-manager.nixosModules.home-manager # Add Stylix module. stylix.nixosModules.stylix - ]; + + # HM config. + ./home/NixOs.nix + ] ++ + modules ++ + (self.findFiles ./host/${system}/${hostname}) ++ + (self.findFiles ./config) ++ + (self.findFiles ./container) ++ + (self.findFiles ./module) ++ + (self.findFiles ./system) ++ + (self.findFiles ./overlay); # SpecialArgs allows you to pass objects down to other NixOS modules. specialArgs = let @@ -241,7 +240,7 @@ inherit self inputs secret util pkgs pkgsStable pkgsMaster; inherit (self) const __findFile; }; - modules = modules ++ (self.findFiles ./config) ++ [ + modules = [ ./home/HomeManager.nix { home.hm = { @@ -259,7 +258,10 @@ { nix.settings.experimental-features = [ "nix-command " "flakes" ]; } inputs.stylix.homeManagerModules.stylix - ]; + ] ++ + modules ++ + (self.findFiles ./config) ++ + (self.findFiles ./module); }; }; @@ -303,7 +305,8 @@ inherit (self) __findFile; inherit lib pkgs; }) - ]; + ] ++ + (self.findFiles ./module); # SpecialArgs allows you to pass objects down to other configuration. extraSpecialArgs = { diff --git a/home/config/sway/default.nix b/home/config/sway/default.nix index 5476ee2..fd615bf 100644 --- a/home/config/sway/default.nix +++ b/home/config/sway/default.nix @@ -27,6 +27,6 @@ in { text = (util.trimTabs '' # Read `man 5 sway` for a complete reference. include /etc/sway/config.d/* - '') + swayRc + config.module.desktop.sway.extraConfig or ""; + '') + swayRc + config.module.desktop.sway.extraConfig; } diff --git a/host/x86_64-linux/dasha/default.nix b/host/x86_64-linux/dasha/default.nix index ef55aa4..ddd53be 100644 --- a/host/x86_64-linux/dasha/default.nix +++ b/host/x86_64-linux/dasha/default.nix @@ -1,8 +1,4 @@ { ... }: { - imports = [ - ./Filesystem.nix - ]; - home.nixos.enable = true; user = { dasha.enable = true; diff --git a/host/x86_64-linux/desktop/default.nix b/host/x86_64-linux/desktop/default.nix index f8c9945..509dbf7 100644 --- a/host/x86_64-linux/desktop/default.nix +++ b/host/x86_64-linux/desktop/default.nix @@ -1,8 +1,4 @@ { ... }: { - imports = [ - ./Filesystem.nix - ]; - home.nixos.enable = true; user = { root.enable = true; diff --git a/host/x86_64-linux/home/default.nix b/host/x86_64-linux/home/default.nix index 576eb51..1c15116 100644 --- a/host/x86_64-linux/home/default.nix +++ b/host/x86_64-linux/home/default.nix @@ -1,13 +1,4 @@ { config, ... }: { - imports = [ - ./Backup.nix - ./Container.nix - ./Filesystem.nix - ./Network.nix - ./Photoprocess.nix - ./YaMusicDownload.nix - ]; - home.nixos.enable = true; user = { root.enable = true; diff --git a/host/x86_64-linux/laptop/default.nix b/host/x86_64-linux/laptop/default.nix index 2e37dc6..c4bc1be 100644 --- a/host/x86_64-linux/laptop/default.nix +++ b/host/x86_64-linux/laptop/default.nix @@ -1,8 +1,4 @@ { ... }: { - imports = [ - ./Filesystem.nix - ]; - home.nixos.enable = true; user = { dasha.enable = true; diff --git a/host/x86_64-linux/work/default.nix b/host/x86_64-linux/work/default.nix index 988e9d9..83d92fc 100644 --- a/host/x86_64-linux/work/default.nix +++ b/host/x86_64-linux/work/default.nix @@ -1,8 +1,4 @@ { ... }: { - imports = [ - ./Fprint.nix - ]; - # Keyd Print to Macro remap. services.keyd.keyboards.default.settings.main.print = "layer(layer_number)"; diff --git a/module/Bootloader.nix b/system/Bootloader.nix similarity index 100% rename from module/Bootloader.nix rename to system/Bootloader.nix diff --git a/module/Crypto.nix b/system/Crypto.nix similarity index 100% rename from module/Crypto.nix rename to system/Crypto.nix diff --git a/module/Dbus.nix b/system/Dbus.nix similarity index 100% rename from module/Dbus.nix rename to system/Dbus.nix diff --git a/module/Filesystem.nix b/system/Filesystem.nix similarity index 100% rename from module/Filesystem.nix rename to system/Filesystem.nix diff --git a/module/Firewall.nix b/system/Firewall.nix similarity index 100% rename from module/Firewall.nix rename to system/Firewall.nix diff --git a/module/Font.nix b/system/Font.nix similarity index 100% rename from module/Font.nix rename to system/Font.nix diff --git a/module/Fstrim.nix b/system/Fstrim.nix similarity index 100% rename from module/Fstrim.nix rename to system/Fstrim.nix diff --git a/module/Locale.nix b/system/Locale.nix similarity index 100% rename from module/Locale.nix rename to system/Locale.nix diff --git a/module/Network.nix b/system/Network.nix similarity index 100% rename from module/Network.nix rename to system/Network.nix diff --git a/module/Nix.nix b/system/Nix.nix similarity index 100% rename from module/Nix.nix rename to system/Nix.nix diff --git a/module/Shell.nix b/system/Shell.nix similarity index 100% rename from module/Shell.nix rename to system/Shell.nix diff --git a/module/Sshd.nix b/system/Sshd.nix similarity index 100% rename from module/Sshd.nix rename to system/Sshd.nix diff --git a/module/Systemd.nix b/system/Systemd.nix similarity index 100% rename from module/Systemd.nix rename to system/Systemd.nix diff --git a/module/Users.nix b/system/Users.nix similarity index 100% rename from module/Users.nix rename to system/Users.nix diff --git a/module/Vm.nix b/system/Vm.nix similarity index 100% rename from module/Vm.nix rename to system/Vm.nix diff --git a/module/Zram.nix b/system/Zram.nix similarity index 100% rename from module/Zram.nix rename to system/Zram.nix