From 36bc759878f1cc565537d243d8d7498a48f35f5a Mon Sep 17 00:00:00 2001 From: "info@data-pro.nu" Date: Thu, 12 Mar 2026 19:46:20 +0100 Subject: [PATCH] Recreated flake files --- Droidnix/assets/flake/users/user.nix | 21 ++++ Droidnix/flake.nix | 172 +++++++++++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 Droidnix/assets/flake/users/user.nix diff --git a/Droidnix/assets/flake/users/user.nix b/Droidnix/assets/flake/users/user.nix new file mode 100644 index 000000000..f778cefb1 --- /dev/null +++ b/Droidnix/assets/flake/users/user.nix @@ -0,0 +1,21 @@ +{ + config, + pkgs, + lib, + inputs, + flakeRoot, + ... +}: + +let + user = import ./henrov.nix; +in +{ + config = { + # User-specific configurations + home-manager.users.${user.username} = { + enable = true; + homeDirectory = user.homeDirectory; + }; + }; +} diff --git a/Droidnix/flake.nix b/Droidnix/flake.nix index 726e07678..5df112124 100644 --- a/Droidnix/flake.nix +++ b/Droidnix/flake.nix @@ -1,3 +1,175 @@ +This is my flake.nix. +I want you to create a minimal version of it. +Anything machine-related needs to find a place in machine.nix +Anything user related should be placed in user.nix +user.nix should import the attributes of the user from henrov.nix + +I give you my current files: +- first: current flake.nix +- second: machine.nix +- third: the attributes for henrov.nix + +Give me three files: +- a flake.nix that has been stripped down as much as possible, keeping the inputs, the cattpucinne theme and the ./generated/top.nix +- a machine.nix in which you moved anything machine-related into machine.nix +- a user.nix in which you moved anything user-related into user.nix + +{ + description = "Droidnix: A dendritic NixOS + Home Manager configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + emacs-overlay = { + url = "github:nix-community/emacs-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + catppuccin = { + url = "github:catppuccin/nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + zen-browser = { + url = "github:youwen5/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + hyprland.url = "github:hyprwm/Hyprland"; + }; + + outputs = + inputs@{ + self, + nixpkgs, + home-manager, + emacs-overlay, + catppuccin, + zen-browser, + hyprland, + ... + }: + let + lib = nixpkgs.lib; + system = "x86_64-linux"; + user = import ./assets/flake/users/henrov.nix; + machines = [ + "traveldroid" + "maindroid" + ]; + in + { + nixosConfigurations = lib.genAttrs machines ( + machine: + lib.nixosSystem { + 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 = ./.; + }; + } + + # Catppuccin theme module + inputs.catppuccin.nixosModules.catppuccin + + # Anchoring all the other nixes + ./generated/top.nix + + # Enable Home Manager for the user + ( + { config, pkgs, ... }: + { + home-manager.users.${user.username} = { + enable = true; + homeDirectory = "/home/${user.username}"; + }; + } + ) + ]; + specialArgs = { + inherit user inputs; + flakeRoot = ./.; + }; + } + ); + + # Home Manager configurations for each user/machine + homeConfigurations = lib.genAttrs (map (machine: user.username + "@" + machine) machines) ( + userMachine: + let + parts = lib.splitString "@" userMachine; + username = builtins.elemAt parts 0; + machine = builtins.elemAt parts 1; + 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 = ./.; + }; + } + ); + + devShells.${system}.default = import ./assets/flake/terminal_shell/devshell.nix { + inherit (nixpkgs.legacyPackages.${system}) mkShell; + }; + }; +} + +{ config, pkgs, lib, user, inputs, flakeRoot,... }: + +{ + imports = [ + ./boot.nix + ./hardware-configuration.nix + ]; + + 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; + }; +} + +{ + username = "henrov"; + hashedPassword = "$6$ISAmsPLyFi7idYXr$VmZsq.zMsyh1irSkyDNqtorNXG0oEHbbMVqTii1t8bymvrQ5ZQmbdi4OiBNeNYe/huHGrojXM.3TST2fTLz0T."; + homeDirectory = "/home/henrov"; + stateVersion = "25.11"; + locale = "nl_NL.UTF-8"; +} { description = "Droidnix: A dendritic NixOS + Home Manager configuration";