Recreated flake files

This commit is contained in:
2026-03-12 21:08:41 +01:00
parent f4951eb155
commit f1de0823a1
3 changed files with 140 additions and 37 deletions
+119 -37
View File
@@ -384,6 +384,7 @@ The Nix flake definition for Droidnix.
"traveldroid"
"maindroid"
];
flakeRoot = ./.; # Define flakeRoot here
in
{
nixosConfigurations = lib.genAttrs machines (
@@ -392,55 +393,32 @@ The Nix flake definition for Droidnix.
inherit system;
modules = [
# Import machine-specific configurations
./assets/flake/machines/${machine}/top.nix
# Home Manager module
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit user inputs; flakeRoot = ./.; };
}
./assets/flake/machines/traveldroid/top.nix
# Catppuccin theme module
inputs.catppuccin.nixosModules.catppuccin
# Generated configuration
# Anchoring all the other nixes
./generated/top.nix
# Ensure Home Manager is enabled for the user
({ config, pkgs, ... }: {
programs.home-manager.enable = true;
systemd.users.services."home-manager-${user.username}" = {
description = "Home Manager service for ${user.username}";
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
serviceConfig.ExecStart = "${pkgs.home-manager}/bin/home-manager switch --flake ${self}#${user.username}@${machine}";
};
})
# Home Manager module
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit user inputs flakeRoot; };
}
];
specialArgs = { inherit user inputs; flakeRoot = ./.; };
specialArgs = { inherit user inputs flakeRoot; };
}
);
# Home Manager configurations for each user/machine
homeConfigurations = lib.genAttrs [
(user.username + "@" + machine)
for machine in machines
] (
homeConfigurations = lib.genAttrs (map (machine: "${user.username}@${machine}") machines) (
userMachine:
let
username = lib.splitString "@" userMachine !!"";
machine = lib.splitString "@" userMachine !!"";
in
home-manager.lib.homeManagerConfiguration {
inherit system;
configuration = import ./assets/flake/users/${username}/home.nix {
inherit inputs user;
pkgs = import nixpkgs { inherit system; };
};
extraSpecialArgs = { inherit user inputs; flakeRoot = ./.; };
configuration = import ./user.nix { inherit inputs user flakeRoot; };
extraSpecialArgs = { inherit user inputs flakeRoot; };
}
);
@@ -452,6 +430,44 @@ The Nix flake definition for Droidnix.
#+END_SRC
* First the nix-files that flake really needs and that do not fit wel in the hierarchical structure
** =assets/flake/users/top.nix=
The ./generated/top.nix file acts as an anchor or entry point for the entire chain of imports in the pyramid structure.
#+BEGIN_SRC nix :tangle assets/flake/users/top.nix :noweb tangle :mkdirp yes :eval never-html
{ config, pkgs, lib, ... }:
{
imports = [
./user.nix
];
}
#+END_SRC
** =assets/flake/users/user.nix=
This is the default user, just search and replace henrov another name if you want to change
#+BEGIN_SRC nix :tangle assets/flake/users/henrov.nix :noweb tangle :mkdirp yes :eval never-html
{
config,
pkgs,
lib,
inputs,
...
}:
let
user = import ./henrov.nix;
in
{
home-manager.users.${user.username} = {
home.stateVersion = "25.11";
home.username = user.username;
home.homeDirectory = user.homeDirectory;
home.packages = with pkgs; [
direnv
git-extras
];
};
}
#+END_SRC
** =assets/flake/users/henrov.nix=
This is the default user, just search and replace henrov another name if you want to change
#+BEGIN_SRC nix :tangle assets/flake/users/henrov.nix :noweb tangle :mkdirp yes :eval never-html
@@ -514,6 +530,29 @@ This code defines the machine to build. Just search and replace traveldroid to p
}
#+END_SRC
** =assets/flake/machines/traveldroid/top.nix=
This is the top if the machine hierarchy
#+BEGIN_SRC nix :tangle assets/flake/machines/traveldroid/top.nix :noweb tangle :mkdirp yes :eval never-html
{
config,
pkgs,
lib,
user,
inputs,
flakeRoot,
...
}:
{
imports = [
./boot.nix
./hardware-configuration.nix
./machine.nix
inputs.home-manager.nixosModules.home-manager
];
}
#+END_SRC
** =assets/flake/machines/traveldroid/boot.nix=
This file has most of the settings the control how the computer boots up.
#+BEGIN_SRC nix :tangle assets/flake/machines/traveldroid/boot.nix :noweb tangle :mkdirp yes :eval never-html
@@ -544,6 +583,49 @@ This file has most of the settings the control how the computer boots up.
}
#+END_SRC
** =assets/flake/machines/traveldroid/machine.nix=
This is the top if the machine hierarchy
#+BEGIN_SRC nix :tangle assets/flake/machines/traveldroid/machine.nix :noweb tangle :mkdirp yes :eval never-html
{
config,
pkgs,
lib,
user,
inputs,
flakeRoot,
...
}:
{
options = {
wm = lib.mkOption {
type = lib.types.str;
default = "hyprland";
description = "Type of window manager to use";
};
};
config = {
# Minimal settings that must be defined here
networking.hostName = "traveldroid";
wm.type = "hyprland";
# User configuration
users.users.${user.username} = {
isNormalUser = true;
extraGroups = [
"wheel"
"networkmanager"
];
hashedPassword = user.hashedPassword;
home = user.homeDirectory;
};
# Optional: Enable auto-login for testing
services.getty.autologinUser = user.username;
};
}
#+END_SRC
* Now we reach the top of the hierarchy which will call all other imports
** =generated/top.nix=
@@ -559,7 +641,7 @@ The ./generated/top.nix file acts as an anchor or entry point for the entire cha
}
#+END_SRC
** =generated/hyprland/top.nix=
This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder
#+BEGIN_SRC nix :tangle generated/hyprland/top.nix :noweb tangle :mkdirp yes :eval never-html
{ config, pkgs, lib, user, inputs, flakeRoot,... }:
+15
View File
@@ -0,0 +1,15 @@
{
config,
pkgs,
lib,
user,
inputs,
flakeRoot,
...
}:
{
imports = [
./user.nix
];
}
+6
View File
@@ -6,6 +6,7 @@
flakeRoot,
...
}:
let
hyprlandConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/hypr";
# Dynamically read all files in assets/hyprland/conf/
@@ -33,6 +34,11 @@ in
enable = true;
};
# Ensure the Hyprland config directory exists
xdg.configFile."hypr/.keep" = {
text = "";
};
# Merge dynamic Hyprland configs with existing xdg.configFile
xdg.configFile = {
# Your existing manual configs (if any)