🚧 Work on fixing booting issues and various other things

This commit is contained in:
Jo 2025-04-25 16:49:34 +02:00
parent dc87b2c186
commit cd32ad1c61
9 changed files with 95 additions and 52 deletions

View file

@ -1,10 +1,10 @@
{ self, ... }:
{
flake = {
nixosModules.puzzlevision = self.lib.mkModule {
class = "nixos";
modules = self.lib.dirToModuleList ../nixos;
};
#nixosModules.puzzlevision = self.lib.mkModule {
# class = "nixos";
# modules = self.lib.dirToModuleList ../nixos;
#};
homeModules.puzzlevision = self.lib.mkModule {
class = "home";

View file

@ -21,13 +21,13 @@ in {
};
config = mkIf osConfig.${namespace}.desktop.gnome.enable {
home.packages = cfg.enabled-extensions;
home.packages = cfg.enabled-extensions;
dconf.settings = {
"org/gnome/shell" = {
enabled-extensions = lib.forEach cfg.enabled-extensions (x: x.extensionUuid);
disabled-extensions = []; # Make sure none of our extensions are disabled on system rebuild
};
dconf.settings = {
"org/gnome/shell" = {
enabled-extensions = lib.forEach cfg.enabled-extensions (x: x.extensionUuid);
disabled-extensions = []; # Make sure none of our extensions are disabled on system rebuild
};
};
};
}

View file

@ -0,0 +1,34 @@
{
lib,
self,
config,
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (self) namespace;
cfg = config.${namespace}.common.grub;
in {
options.${namespace}.common.grub = { enable = mkEnableOption "grub"; };
config = mkIf cfg.enable {
boot.loader.systemd-boot.enable = false;
boot.loader.grub = {
enable = true;
devices = [ "nodev" ];
efiInstallAsRemovable = true;
efiSupport = true;
extraEntries = ''
menuentry "Reboot" {
reboot
}
menuentry "Poweroff" {
halt
}
'';
};
};
}

View file

@ -2,6 +2,7 @@
lib,
config,
self,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
@ -10,17 +11,15 @@
cfg = config.${namespace}.users;
system = builtins.currentSystem;
systemClass =
if builtins.match ".*-linux" system != null then "nixos"
else if builtins.match ".*-darwin" system != null then "darwin"
else "nixos"; # Default fallback
# The identifier of the current system type, e.g. "x86_64-linux" or "aarch64-darwin"
system = pkgs.system;
# Type for a user configuration
userType = types.submodule {
options = {
enable = mkEnableOption "Enable this user";
enable = mkEnableOption "this user";
initialPassword = mkOpt (types.nullOr types.str) null "Initial password for the user";
password = mkOpt (types.nullOr types.str) null "Plaintext password for the user";
hashedPassword = mkOpt (types.nullOr types.str) null "Hashed password for the user";
isNormalUser = mkOpt types.bool true "Whether this user is a normal user";
extraGroups = mkOpt (types.listOf types.str) [] "Extra groups for the user";
@ -28,7 +27,7 @@
};
# Function to get home configuration path for a username
getHomeConfigPath = username: "${self.outPath}/homes/${systemClass}/${username}";
getHomeConfigPath = username: "${self.outPath}/homes/${system}/${username}";
# Function to check if a home configuration exists for a username
homeConfigExists = username:
@ -38,12 +37,6 @@
# Import all home-manager modules
homeModules = dirToModuleList "${self.outPath}/modules/home";
in {
imports = [
# Import home-manager NixOS module
# This assumes home-manager is available as a flake input
self.inputs.home-manager.nixosModules.home-manager
];
options.${namespace}.users = mkOption {
type = types.attrsOf userType;
default = {};
@ -51,18 +44,18 @@ in {
};
config = {
# Create the actual users
# Ensure users are fully managed by NixOS
users.mutableUsers = false;
# Create the actual system users
users.users = lib.mapAttrs (username: userConfig:
mkIf userConfig.enable {
name = username;
isNormalUser = userConfig.isNormalUser;
inherit (userConfig) extraGroups;
initialPassword = userConfig.initialPassword;
hashedPassword = userConfig.hashedPassword;
inherit (userConfig) extraGroups initialPassword hashedPassword isNormalUser password;
}
) cfg;
# Configure home-manager with auto-imported configs
# Configure home-manager with auto-imported user configuration
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
@ -77,7 +70,9 @@ in {
{ ... }: {
imports = [
(getHomeConfigPath username) # Import the user's specific home configuration
] ++ homeModules; # Include all home modules from /modules/home
]; #++ homeModules; # Include all generalized home modules
home.stateVersion = lib.mkDefault config.system.stateVersion;
}
)
) cfg;