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" "traveldroid"
"maindroid" "maindroid"
]; ];
flakeRoot = ./.; # Define flakeRoot here
in in
{ {
nixosConfigurations = lib.genAttrs machines ( nixosConfigurations = lib.genAttrs machines (
@@ -392,55 +393,32 @@ The Nix flake definition for Droidnix.
inherit system; inherit system;
modules = [ modules = [
# Import machine-specific configurations # Import machine-specific configurations
./assets/flake/machines/${machine}/top.nix ./assets/flake/machines/traveldroid/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 = ./.; };
}
# Catppuccin theme module # Catppuccin theme module
inputs.catppuccin.nixosModules.catppuccin inputs.catppuccin.nixosModules.catppuccin
# Generated configuration # Anchoring all the other nixes
./generated/top.nix ./generated/top.nix
# Ensure Home Manager is enabled for the user # Home Manager module
({ config, pkgs, ... }: { inputs.home-manager.nixosModules.home-manager
programs.home-manager.enable = true; {
systemd.users.services."home-manager-${user.username}" = { home-manager.useGlobalPkgs = true;
description = "Home Manager service for ${user.username}"; home-manager.useUserPackages = true;
wantedBy = [ "multi-user.target" ]; home-manager.extraSpecialArgs = { inherit user inputs flakeRoot; };
serviceConfig.Type = "oneshot"; }
serviceConfig.RemainAfterExit = true;
serviceConfig.ExecStart = "${pkgs.home-manager}/bin/home-manager switch --flake ${self}#${user.username}@${machine}";
};
})
]; ];
specialArgs = { inherit user inputs; flakeRoot = ./.; }; specialArgs = { inherit user inputs flakeRoot; };
} }
); );
# Home Manager configurations for each user/machine homeConfigurations = lib.genAttrs (map (machine: "${user.username}@${machine}") machines) (
homeConfigurations = lib.genAttrs [
(user.username + "@" + machine)
for machine in machines
] (
userMachine: userMachine:
let
username = lib.splitString "@" userMachine !!"";
machine = lib.splitString "@" userMachine !!"";
in
home-manager.lib.homeManagerConfiguration { home-manager.lib.homeManagerConfiguration {
inherit system; inherit system;
configuration = import ./assets/flake/users/${username}/home.nix { configuration = import ./user.nix { inherit inputs user flakeRoot; };
inherit inputs user; extraSpecialArgs = { inherit user inputs flakeRoot; };
pkgs = import nixpkgs { inherit system; };
};
extraSpecialArgs = { inherit user inputs; flakeRoot = ./.; };
} }
); );
@@ -452,6 +430,44 @@ The Nix flake definition for Droidnix.
#+END_SRC #+END_SRC
* First the nix-files that flake really needs and that do not fit wel in the hierarchical structure * 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= ** =assets/flake/users/henrov.nix=
This is the default user, just search and replace henrov another name if you want to change 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 #+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 #+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= ** =assets/flake/machines/traveldroid/boot.nix=
This file has most of the settings the control how the computer boots up. 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 #+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 #+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 * Now we reach the top of the hierarchy which will call all other imports
** =generated/top.nix= ** =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 #+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 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 #+BEGIN_SRC nix :tangle generated/hyprland/top.nix :noweb tangle :mkdirp yes :eval never-html
{ config, pkgs, lib, user, inputs, flakeRoot,... }: { 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, flakeRoot,
... ...
}: }:
let let
hyprlandConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/hypr"; hyprlandConfigDir = "${config.home-manager.users.${user.username}.xdg.configHome}/hypr";
# Dynamically read all files in assets/hyprland/conf/ # Dynamically read all files in assets/hyprland/conf/
@@ -33,6 +34,11 @@ in
enable = true; enable = true;
}; };
# Ensure the Hyprland config directory exists
xdg.configFile."hypr/.keep" = {
text = "";
};
# Merge dynamic Hyprland configs with existing xdg.configFile # Merge dynamic Hyprland configs with existing xdg.configFile
xdg.configFile = { xdg.configFile = {
# Your existing manual configs (if any) # Your existing manual configs (if any)