🚧 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

6
.gitignore vendored
View file

@ -4,3 +4,9 @@
### Jetbrains ### Jetbrains
/.idea /.idea
### Zed Editor
/.zed
### VSCode
/.vscode

24
flake.lock generated
View file

@ -2,11 +2,11 @@
"nodes": { "nodes": {
"easy-hosts": { "easy-hosts": {
"locked": { "locked": {
"lastModified": 1739315072, "lastModified": 1743693165,
"narHash": "sha256-m0Lzdrj95GbdmKhqlTKkr4vvHy2Ghdi1GxISOKqUeSA=", "narHash": "sha256-BAYno/4P0hq3aaqfVLbDmv8pgvzJWcN+4L8jK8SzaMo=",
"owner": "tgirlcloud", "owner": "tgirlcloud",
"repo": "easy-hosts", "repo": "easy-hosts",
"rev": "e96af44cae1f48a1a94f2471faee92caf22aa45f", "rev": "611cc21942feb55c6a38410dfe8eee3fb5f08c8d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -22,11 +22,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1741352980, "lastModified": 1743550720,
"narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=", "narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9", "rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -42,11 +42,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1742305478, "lastModified": 1745494811,
"narHash": "sha256-iYCinzZnnUeCkZ031qGRwPdwRsqW6o9Y0MgGpA7Zva4=", "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "fb74bb76d94a6c55632376c931fc108131260ee9", "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -57,11 +57,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1742069588, "lastModified": 1745391562,
"narHash": "sha256-C7jVfohcGzdZRF6DO+ybyG/sqpo1h6bZi9T56sxLy+k=", "narHash": "sha256-sPwcCYuiEopaafePqlG826tBhctuJsLx/mhKKM5Fmjo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "c80f6a7e10b39afcc1894e02ef785b1ad0b0d7e5", "rev": "8a2f738d9d1f1d986b5a4cd2fd2061a7127237d7",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -1,3 +0,0 @@
{ ... }: {
home.stateVersion = "25.05";
}

View file

@ -0,0 +1,11 @@
{
pkgs,
...
}: {
home.packages = with pkgs; [
vscodium
cmatrix
];
home.stateVersion = "25.05";
}

View file

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

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, lib,
config, config,
self, self,
pkgs,
... ...
}: let }: let
inherit (lib) mkEnableOption mkIf mkOption types; inherit (lib) mkEnableOption mkIf mkOption types;
@ -10,17 +11,15 @@
cfg = config.${namespace}.users; cfg = config.${namespace}.users;
system = builtins.currentSystem; # The identifier of the current system type, e.g. "x86_64-linux" or "aarch64-darwin"
systemClass = system = pkgs.system;
if builtins.match ".*-linux" system != null then "nixos"
else if builtins.match ".*-darwin" system != null then "darwin"
else "nixos"; # Default fallback
# Type for a user configuration # Type for a user configuration
userType = types.submodule { userType = types.submodule {
options = { options = {
enable = mkEnableOption "Enable this user"; enable = mkEnableOption "this user";
initialPassword = mkOpt (types.nullOr types.str) null "Initial password for the 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"; hashedPassword = mkOpt (types.nullOr types.str) null "Hashed password for the user";
isNormalUser = mkOpt types.bool true "Whether this user is a normal user"; isNormalUser = mkOpt types.bool true "Whether this user is a normal user";
extraGroups = mkOpt (types.listOf types.str) [] "Extra groups for the 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 # 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 # Function to check if a home configuration exists for a username
homeConfigExists = username: homeConfigExists = username:
@ -38,12 +37,6 @@
# Import all home-manager modules # Import all home-manager modules
homeModules = dirToModuleList "${self.outPath}/modules/home"; homeModules = dirToModuleList "${self.outPath}/modules/home";
in { 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 { options.${namespace}.users = mkOption {
type = types.attrsOf userType; type = types.attrsOf userType;
default = {}; default = {};
@ -51,18 +44,18 @@ in {
}; };
config = { 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: users.users = lib.mapAttrs (username: userConfig:
mkIf userConfig.enable { mkIf userConfig.enable {
name = username; name = username;
isNormalUser = userConfig.isNormalUser; inherit (userConfig) extraGroups initialPassword hashedPassword isNormalUser password;
inherit (userConfig) extraGroups;
initialPassword = userConfig.initialPassword;
hashedPassword = userConfig.hashedPassword;
} }
) cfg; ) cfg;
# Configure home-manager with auto-imported configs # Configure home-manager with auto-imported user configuration
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
useUserPackages = true; useUserPackages = true;
@ -77,7 +70,9 @@ in {
{ ... }: { { ... }: {
imports = [ imports = [
(getHomeConfigPath username) # Import the user's specific home configuration (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; ) cfg;

View file

@ -1,29 +1,29 @@
{pkgs, ...}: { {
pkgs,
...
}: {
imports = [ imports = [
./hardware.nix ./hardware.nix
]; ];
users.users.jo.isNormalUser = true;
users.users.jo.initialPassword = "balls";
users.users.jo.createHome = true;
# System configuration
puzzlevision = { puzzlevision = {
# TODO: improve home-manager configuration loading as development continues and make sure everything works correctly. # TODO: improve home-manager configuration loading as development continues and make sure everything works correctly.
users = { users = {
jo = { jo = {
enable = true; enable = true;
initialPassword = "balls"; initialPassword = "balls";
extraGroups = [ "wheel" ];
}; };
}; };
desktop.gnome.enable = true; desktop.gnome.enable = true;
utils.vm.enable = true;
common.grub.enable = true;
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
ghostty ghostty
firefox firefox
vscodium
]; ];
system.stateVersion = "25.05"; system.stateVersion = "25.05";