feat: pre-activate standalone Home Manager environment in VM and Live ISO
This commit is contained in:
@@ -1,6 +1,20 @@
|
|||||||
{ inputs, lib, ... }:
|
{ inputs, lib, pkgs, homeActivationPackage ? null, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Pre-activate standalone home-manager if provided
|
||||||
|
system.activationScripts.home-manager-activate = lib.mkIf (homeActivationPackage != null) {
|
||||||
|
text = ''
|
||||||
|
USER_HOME="/home/nomarchy"
|
||||||
|
if [ ! -d "$USER_HOME" ]; then
|
||||||
|
mkdir -p "$USER_HOME"
|
||||||
|
chown nomarchy:users "$USER_HOME"
|
||||||
|
fi
|
||||||
|
# Run activation as the nomarchy user
|
||||||
|
${pkgs.sudo}/bin/sudo -u nomarchy ${homeActivationPackage}/activate
|
||||||
|
'';
|
||||||
|
deps = [ "users" ];
|
||||||
|
};
|
||||||
|
|
||||||
# Shared VM configuration
|
# Shared VM configuration
|
||||||
virtualisation.vmVariant = {
|
virtualisation.vmVariant = {
|
||||||
virtualisation.graphics = true;
|
virtualisation.graphics = true;
|
||||||
|
|||||||
61
flake.nix
61
flake.nix
@@ -22,7 +22,26 @@
|
|||||||
walker.url = "github:abenz1267/walker";
|
walker.url = "github:abenz1267/walker";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, nixos-hardware, disko, impermanence, home-manager, nix-colors, stylix, walker, ... } @ inputs: {
|
outputs = { self, nixpkgs, nixos-hardware, disko, impermanence, home-manager, nix-colors, stylix, walker, ... } @ inputs: let
|
||||||
|
# Helper to create standalone home configurations
|
||||||
|
mkHome = { username, modules ? [] }: home-manager.lib.homeManagerConfiguration {
|
||||||
|
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
||||||
|
extraSpecialArgs = { inherit inputs; };
|
||||||
|
modules = [
|
||||||
|
./features
|
||||||
|
{
|
||||||
|
home.username = username;
|
||||||
|
home.homeDirectory = "/home/${username}";
|
||||||
|
home.stateVersion = "25.11";
|
||||||
|
}
|
||||||
|
] ++ modules;
|
||||||
|
};
|
||||||
|
|
||||||
|
homeConfigs = {
|
||||||
|
"nixos" = mkHome { username = "nixos"; };
|
||||||
|
"nomarchy" = mkHome { username = "nomarchy"; };
|
||||||
|
};
|
||||||
|
in {
|
||||||
# Expose inputs for downstream use
|
# Expose inputs for downstream use
|
||||||
inherit inputs;
|
inherit inputs;
|
||||||
|
|
||||||
@@ -48,7 +67,10 @@
|
|||||||
|
|
||||||
# Graphical installer ISO (legacy, for users who prefer GUI)
|
# Graphical installer ISO (legacy, for users who prefer GUI)
|
||||||
installerIsoGraphical = nixpkgs.lib.nixosSystem {
|
installerIsoGraphical = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
homeActivationPackage = homeConfigs."nixos".activationPackage;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
||||||
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix"
|
"${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-base.nix"
|
||||||
@@ -64,7 +86,10 @@
|
|||||||
|
|
||||||
# Default configuration (VM and testing)
|
# Default configuration (VM and testing)
|
||||||
default = nixpkgs.lib.nixosSystem {
|
default = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs; };
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
homeActivationPackage = homeConfigs."nomarchy".activationPackage;
|
||||||
|
};
|
||||||
modules = [
|
modules = [
|
||||||
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
{ nixpkgs.hostPlatform = "x86_64-linux"; }
|
||||||
./core/default.nix
|
./core/default.nix
|
||||||
@@ -90,34 +115,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
homeConfigurations = {
|
homeConfigurations = homeConfigs;
|
||||||
# Standalone Home Manager configuration for Live ISO
|
|
||||||
"nixos" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = { inherit inputs; };
|
|
||||||
modules = [
|
|
||||||
./features
|
|
||||||
{
|
|
||||||
home.username = "nixos";
|
|
||||||
home.homeDirectory = "/home/nixos";
|
|
||||||
home.stateVersion = "25.11";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
# Standalone Home Manager configuration for VM testing
|
|
||||||
"nomarchy" = home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = nixpkgs.legacyPackages.x86_64-linux;
|
|
||||||
extraSpecialArgs = { inherit inputs; };
|
|
||||||
modules = [
|
|
||||||
./features
|
|
||||||
{
|
|
||||||
home.username = "nomarchy";
|
|
||||||
home.homeDirectory = "/home/nomarchy";
|
|
||||||
home.stateVersion = "25.11";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,20 @@
|
|||||||
{ config, pkgs, inputs, lib, ... }:
|
{ config, pkgs, inputs, lib, homeActivationPackage, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
# Pre-activate standalone home-manager for the live environment
|
||||||
|
system.activationScripts.home-manager-activate = {
|
||||||
|
text = ''
|
||||||
|
USER_HOME="/home/nixos"
|
||||||
|
if [ ! -d "$USER_HOME" ]; then
|
||||||
|
mkdir -p "$USER_HOME"
|
||||||
|
chown nixos:users "$USER_HOME"
|
||||||
|
fi
|
||||||
|
# Run activation as the nixos user
|
||||||
|
${pkgs.sudo}/bin/sudo -u nixos ${homeActivationPackage}/activate
|
||||||
|
'';
|
||||||
|
deps = [ "users" ];
|
||||||
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
git
|
git
|
||||||
gum
|
gum
|
||||||
|
|||||||
Reference in New Issue
Block a user