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,
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

View File

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

View File

@ -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
{

View File

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

View File

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

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

View File

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