mirror of
https://github.com/Jokiller230/puzzlevision.git
synced 2025-09-09 12:20:04 +00:00
🚧 Work on fixing booting issues and various other things
This commit is contained in:
parent
dc87b2c186
commit
cd32ad1c61
9 changed files with 95 additions and 52 deletions
34
modules/nixos/common/grub/default.nix
Normal file
34
modules/nixos/common/grub/default.nix
Normal 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
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue