feat: move previously hardcoded values to top-level configuration file (pt1)

This commit is contained in:
Franek 2025-05-18 18:10:29 +02:00
parent 6cf261629e
commit f791a02a1c
8 changed files with 75 additions and 55 deletions

View File

@ -25,8 +25,9 @@
nixpkgs, nixpkgs,
android-nixpkgs, android-nixpkgs,
... ...
}: }@inputs:
let let
prefs = import ./preferences.nix { inherit inputs; };
forAllSystems = nixpkgs.lib.genAttrs [ forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux" "aarch64-linux"
"x86_64-linux" "x86_64-linux"
@ -34,7 +35,7 @@
]; ];
in in
{ {
nixosConfigurations = import ./hosts { inherit self; }; nixosConfigurations = import ./hosts { inherit self prefs; };
devShells = forAllSystems ( devShells = forAllSystems (
system: system:
let let

View File

@ -13,13 +13,6 @@
trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ]; trusted-public-keys = [ "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" ];
}; };
environment.systemPackages = with pkgs; [
alacritty
vim
unzip
networkmanager
];
services.automatic-timezoned.enable = true; services.automatic-timezoned.enable = true;
boot.loader.grub.enable = false; boot.loader.grub.enable = false;

View File

@ -1,10 +1,10 @@
{ self, ... }: { self, prefs, ... }:
let let
inherit (self) inputs; inherit (self) inputs;
lib = inputs.nixpkgs.lib; lib = inputs.nixpkgs.lib;
homeDir = self + /profiles; hmProfiles = self + /profiles;
mkSystem = mkSystem =
{ {
@ -14,15 +14,14 @@ let
modules ? [ ], modules ? [ ],
}: }:
lib.nixosSystem { lib.nixosSystem {
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs prefs; };
modules = modules = modules
[ ++ lib.lists.optionals useHomeManager [ inputs.home-manager.nixosModules.default ]
++ [
./base-configuration.nix ./base-configuration.nix
./${hostname} ./${hostname}
homeDir hmProfiles
] ];
++ lib.lists.optionals useHomeManager [ inputs.home-manager.nixosModules.default ]
++ modules;
}; };
in in
{ {

View File

@ -1,23 +1,32 @@
{ pkgs, ... }: {
pkgs,
prefs,
config,
...
}:
let let
username = "sadorowo"; inherit (prefs.users.hulk)
fullname = "Franek"; username
preferredShell = pkgs.fish; fullname
isRoot
homeDirectory
preferredShell
;
optional = pkgs.lib.lists.optionals;
in in
{ {
users.users.${username} = { users.users.${username} = {
isNormalUser = true; isNormalUser = !isRoot;
description = fullname; description = fullname;
home = "/home/${username}"; home = homeDirectory;
extraGroups = [ extraGroups = [
"wheel" "wheel"
"networkmanager" "networkmanager"
"plugdev" "plugdev"
"adbusers" "adbusers"
"nordvpn" ] ++ optional config.modules.nordvpn.enable [ "nordvpn" ];
]; ignoreShellProgramCheck = true;
shell = preferredShell; shell = pkgs.fish;
ignoreShellProgramCheck = true; # Will do it later in profile configuration
}; };
} }

View File

@ -7,6 +7,10 @@
}: }:
{ {
imports = [
inputs.stylix.homeManagerModules.stylix
];
options.modules.stylix = { options.modules.stylix = {
enable = lib.mkEnableOption "Whether to enable Stylix, a theme manager for NixOS"; enable = lib.mkEnableOption "Whether to enable Stylix, a theme manager for NixOS";
setupCursors = lib.mkOption { setupCursors = lib.mkOption {
@ -26,10 +30,6 @@
}; };
}; };
imports = [
inputs.stylix.homeManagerModules.stylix
];
config = lib.mkIf config.modules.stylix.enable { config = lib.mkIf config.modules.stylix.enable {
stylix = { stylix = {
enable = true; enable = true;
@ -41,7 +41,7 @@
cursor = lib.mkIf config.modules.stylix.setupCursors { cursor = lib.mkIf config.modules.stylix.setupCursors {
name = "Bibata-Modern-Classic"; name = "Bibata-Modern-Classic";
package = pkgs.bibata-cursors; package = pkgs.bibata-cursors;
size = 24; size = 32;
}; };
}; };

27
preferences.nix Normal file
View File

@ -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;
};
}

View File

@ -1,5 +1,6 @@
{ {
self, self,
prefs,
inputs, inputs,
impurity, impurity,
... ...
@ -9,11 +10,9 @@
home-manager = { home-manager = {
backupFileExtension = "bak"; backupFileExtension = "bak";
extraSpecialArgs = { extraSpecialArgs = {
inherit inputs self impurity; inherit inputs self prefs impurity;
}; };
users = { users = prefs.homes;
sadorowo = ./hulk;
};
}; };
} }

View File

@ -1,32 +1,24 @@
{ pkgs, inputs, ... }: {
pkgs,
prefs,
inputs,
...
}:
let
username = "sadorowo";
homeDirectory = "/home/${username}";
in
{ {
imports = [ ./modules.nix ]; imports = [ ./modules.nix ];
home = { home = {
inherit username homeDirectory; inherit (prefs.users.hulk) username homeDirectory;
stateVersion = "24.11";
packages = import ./packages.nix { inherit pkgs inputs; }; packages = import ./packages.nix { inherit pkgs inputs; };
}; };
nixpkgs.config = { nixpkgs.config = {
permittedInsecurePackages = [ permittedInsecurePackages = prefs.pkgs.hulk.insecure;
"fluffychat-linux-1.22.1" allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) prefs.pkgs.hulk.unfree;
"olm-3.2.16"
];
allowUnfreePredicate =
pkg:
builtins.elem (pkgs.lib.getName pkg) [
"davinci-resolve"
"anydesk"
];
}; };
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.stateVersion = "24.11";
} }