diff --git a/flake.nix b/flake.nix index 9aac5e3..16f8145 100644 --- a/flake.nix +++ b/flake.nix @@ -25,8 +25,9 @@ nixpkgs, android-nixpkgs, ... - }: + }@inputs: let + prefs = import ./preferences.nix { inherit inputs; }; forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" @@ -34,7 +35,7 @@ ]; in { - nixosConfigurations = import ./hosts { inherit self; }; + nixosConfigurations = import ./hosts { inherit self prefs; }; devShells = forAllSystems ( system: let diff --git a/hosts/base-configuration.nix b/hosts/base-configuration.nix index d7eb085..800d318 100644 --- a/hosts/base-configuration.nix +++ b/hosts/base-configuration.nix @@ -13,13 +13,6 @@ trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; }; - environment.systemPackages = with pkgs; [ - alacritty - vim - unzip - networkmanager - ]; - services.automatic-timezoned.enable = true; boot.loader.grub.enable = false; diff --git a/hosts/default.nix b/hosts/default.nix index 687491c..7811407 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,10 +1,10 @@ -{ self, ... }: +{ self, prefs, ... }: let inherit (self) inputs; lib = inputs.nixpkgs.lib; - homeDir = self + /profiles; + hmProfiles = self + /profiles; mkSystem = { @@ -14,15 +14,14 @@ let modules ? [ ], }: lib.nixosSystem { - specialArgs = { inherit inputs; }; - modules = - [ + specialArgs = { inherit inputs prefs; }; + modules = modules + ++ lib.lists.optionals useHomeManager [ inputs.home-manager.nixosModules.default ] + ++ [ ./base-configuration.nix ./${hostname} - homeDir - ] - ++ lib.lists.optionals useHomeManager [ inputs.home-manager.nixosModules.default ] - ++ modules; + hmProfiles + ]; }; in { diff --git a/hosts/hulk/users.nix b/hosts/hulk/users.nix index 6506d3d..b4ca1de 100644 --- a/hosts/hulk/users.nix +++ b/hosts/hulk/users.nix @@ -1,23 +1,32 @@ -{ pkgs, ... }: +{ + pkgs, + prefs, + config, + ... +}: let - username = "sadorowo"; - fullname = "Franek"; - preferredShell = pkgs.fish; + inherit (prefs.users.hulk) + username + fullname + isRoot + homeDirectory + preferredShell + ; + optional = pkgs.lib.lists.optionals; in { users.users.${username} = { - isNormalUser = true; + isNormalUser = !isRoot; description = fullname; - home = "/home/${username}"; + home = homeDirectory; extraGroups = [ "wheel" "networkmanager" "plugdev" "adbusers" - "nordvpn" - ]; - shell = preferredShell; - ignoreShellProgramCheck = true; # Will do it later in profile configuration + ] ++ optional config.modules.nordvpn.enable [ "nordvpn" ]; + ignoreShellProgramCheck = true; + shell = pkgs.fish; }; } diff --git a/modules/home-manager/stylix.nix b/modules/home-manager/stylix.nix index df9d063..cc8acac 100644 --- a/modules/home-manager/stylix.nix +++ b/modules/home-manager/stylix.nix @@ -7,6 +7,10 @@ }: { + imports = [ + inputs.stylix.homeManagerModules.stylix + ]; + options.modules.stylix = { enable = lib.mkEnableOption "Whether to enable Stylix, a theme manager for NixOS"; setupCursors = lib.mkOption { @@ -26,10 +30,6 @@ }; }; - imports = [ - inputs.stylix.homeManagerModules.stylix - ]; - config = lib.mkIf config.modules.stylix.enable { stylix = { enable = true; @@ -41,7 +41,7 @@ cursor = lib.mkIf config.modules.stylix.setupCursors { name = "Bibata-Modern-Classic"; package = pkgs.bibata-cursors; - size = 24; + size = 32; }; }; diff --git a/preferences.nix b/preferences.nix new file mode 100644 index 0000000..94919e9 --- /dev/null +++ b/preferences.nix @@ -0,0 +1,27 @@ +{ ... }: rec { + users = { + hulk = { + username = "sadorowo"; + fullname = "Franek"; + homeDirectory = "/home/${users.hulk.username}"; + isRoot = false; + }; + }; + + pkgs = { + hulk = { + insecure = [ + "fluffychat-linux-1.22.1" + "olm-3.2.16" + ]; + unfree = [ + "davinci-resolve" + "anydesk" + ]; + }; + }; + + homes = { + sadorowo = ./profiles/hulk; + }; +} diff --git a/profiles/default.nix b/profiles/default.nix index 3272be2..fc37b71 100644 --- a/profiles/default.nix +++ b/profiles/default.nix @@ -1,5 +1,6 @@ { self, + prefs, inputs, impurity, ... @@ -9,11 +10,9 @@ home-manager = { backupFileExtension = "bak"; extraSpecialArgs = { - inherit inputs self impurity; + inherit inputs self prefs impurity; }; - users = { - sadorowo = ./hulk; - }; + users = prefs.homes; }; } diff --git a/profiles/hulk/default.nix b/profiles/hulk/default.nix index 90d990d..42a7834 100644 --- a/profiles/hulk/default.nix +++ b/profiles/hulk/default.nix @@ -1,32 +1,24 @@ -{ pkgs, inputs, ... }: +{ + pkgs, + prefs, + inputs, + ... +}: -let - username = "sadorowo"; - homeDirectory = "/home/${username}"; -in { imports = [ ./modules.nix ]; home = { - inherit username homeDirectory; + inherit (prefs.users.hulk) username homeDirectory; + stateVersion = "24.11"; packages = import ./packages.nix { inherit pkgs inputs; }; }; nixpkgs.config = { - permittedInsecurePackages = [ - "fluffychat-linux-1.22.1" - "olm-3.2.16" - ]; - - allowUnfreePredicate = - pkg: - builtins.elem (pkgs.lib.getName pkg) [ - "davinci-resolve" - "anydesk" - ]; + permittedInsecurePackages = prefs.pkgs.hulk.insecure; + allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) prefs.pkgs.hulk.unfree; }; programs.home-manager.enable = true; - home.stateVersion = "24.11"; }