diff --git a/devices/laptop.nix b/devices/laptop.nix index d41be65..c30ad15 100755 --- a/devices/laptop.nix +++ b/devices/laptop.nix @@ -11,6 +11,8 @@ let ... }: { + device.type = "primary"; + imports = with inputs; [ diff --git a/devices/mini-laptop.nix b/devices/mini-laptop.nix index 967c1f0..6d0cdde 100755 --- a/devices/mini-laptop.nix +++ b/devices/mini-laptop.nix @@ -11,7 +11,7 @@ let ... }: { - system.nixos.label = "stock"; + device.type = "primary"; imports = with inputs; [ self.nixosModules.default diff --git a/devices/mini-pc.nix b/devices/mini-pc.nix index d642495..568c8de 100755 --- a/devices/mini-pc.nix +++ b/devices/mini-pc.nix @@ -11,6 +11,8 @@ let ... }: { + device.type = "primary"; + imports = with inputs; [ ./hardware/mini-pc.nix ./hardware/logitech.nix diff --git a/devices/server.nix b/devices/server.nix index d1e698d..eb4b532 100755 --- a/devices/server.nix +++ b/devices/server.nix @@ -7,10 +7,9 @@ let pkgs, ... }: - let - last-stable = import inputs.nixpkgs-last-unstable { system = "x86_64-linux"; }; # temp - in { + device.type = "server"; + imports = with inputs; [ sops-nix.nixosModules.sops ./hardware/server.nix @@ -147,7 +146,6 @@ let }; calibre-web = { enable = true; - #package = last-stable.calibre-web; # temp group = "users"; user = "${inputs.zeroq.devices.admin}"; options = { diff --git a/devices/vds.nix b/devices/vds.nix index 4427cdb..82f5ae6 100755 --- a/devices/vds.nix +++ b/devices/vds.nix @@ -9,6 +9,8 @@ let ... }: { + device.type = "vds"; + imports = with inputs; [ diff --git a/devices/wsl.nix b/devices/wsl.nix index c4091a7..26ddc53 100755 --- a/devices/wsl.nix +++ b/devices/wsl.nix @@ -9,6 +9,7 @@ let ... }: { + device.type = "wsl"; imports = with inputs; [ nixos-wsl.nixosModules.default diff --git a/home/server.nix b/home/server.nix index 6585473..e838144 100755 --- a/home/server.nix +++ b/home/server.nix @@ -7,16 +7,21 @@ let pkgs, ... }: + let + # Paths + beetsPath = "${inputs.zeroq.dirs.storage}/beets/linux"; + sshPath = "${inputs.zeroq.dirs.storage}/ssh/${inputs.zeroq.devices.server.hostname}"; + musicPath = "${config.home.homeDirectory}/External/Music"; + in { imports = [ inputs.self.homeModules.default - #inputs.self.homeModules.links - ] # ++ (builtins.attrValues inputs.self.homeModules) - ; + ]; xdg = { configFile = { "beets" = { - source = config.lib.file.mkOutOfStoreSymlink "${inputs.zeroq.dirs.storage}/beets/linux"; + enable = builtins.pathExists beetsPath; + source = config.lib.file.mkOutOfStoreSymlink beetsPath; target = "beets"; }; }; @@ -24,10 +29,10 @@ let autostart.enable = true; userDirs = { enable = true; - createDirectories = true; + createDirectories = false; desktop = null; documents = null; - download = "${config.home.homeDirectory}/Downloads"; + download = null; music = null; pictures = null; publicShare = null; @@ -37,12 +42,14 @@ let }; home = { file = { - "ssh" = { - source = config.lib.file.mkOutOfStoreSymlink "${inputs.zeroq.dirs.storage}/ssh/${inputs.zeroq.devices.server.hostname}"; + ".ssh" = { + enable = builtins.pathExists sshPath; + source = config.lib.file.mkOutOfStoreSymlink sshPath; target = ".ssh"; }; "Music" = { - source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/External/Music"; + enable = builtins.pathExists musicPath; + source = config.lib.file.mkOutOfStoreSymlink musicPath; target = "${config.home.homeDirectory}/Music"; }; }; @@ -58,9 +65,6 @@ let useUserPackages = true; users.${inputs.zeroq.devices.admin} = homeModule; sharedModules = [ inputs.plasma-manager.homeManagerModules.plasma-manager ]; - # extraSpecialArgs = { - # inherit (config.networking) hostName; - # }; }; }; in diff --git a/modules/default.nix b/modules/default.nix index d426d46..dec8b1c 100755 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,7 +7,6 @@ { imports = [ ./essentials - #./services # Flake modules inputs.home-manager.nixosModules.home-manager # home-manager module @@ -36,4 +35,17 @@ }; }; }; + + # Options + options.device.type = lib.mkOption { + type = lib.types.enum [ + "minimal" + "primary" + "server" + "vds" + "wsl" + ]; + default = "minimal"; # Значение по умолчанию, если не указано + description = "Type of device for this host."; + }; } diff --git a/modules/essentials/services.nix b/modules/essentials/services.nix index 4b61ccd..4d215e6 100755 --- a/modules/essentials/services.nix +++ b/modules/essentials/services.nix @@ -4,6 +4,6 @@ }: { services = { - tailscale.enable = !(config.wsl.enable or false); # true, if not wsl + tailscale.enable = config.device.type != "wsl"; # true, if not wsl }; }