Add HM bootstrap script and tidy installer workflow

This commit is contained in:
randogoth 2026-02-02 14:04:56 +02:00
parent dd15c09fdd
commit d1713bdc99
10 changed files with 184 additions and 43 deletions

View file

@ -0,0 +1,48 @@
{ ... }:
let
flakeText = ''
{
description = "Home Manager configuration of admin";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, home-manager, ... }: {
homeConfigurations."admin" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
modules = [ ./home.nix ];
};
};
}
'';
homeText = ''
{ config, pkgs, ... }:
{
home.username = "admin";
home.homeDirectory = "/home/admin";
home.stateVersion = "25.05";
home.packages = [ pkgs.ptyxis ];
home.file = { };
home.sessionVariables = { };
programs.home-manager.enable = true;
}
'';
in
{
environment.etc = {
"skel/.config/home-manager/flake.nix".text = flakeText;
"skel/.config/home-manager/home.nix".text = homeText;
};
}

View file

@ -0,0 +1,10 @@
{ lib, pkgs, ... }:
{
# Baseline system tools available everywhere; users run Home Manager standalone.
config.environment.systemPackages = lib.mkAfter [
pkgs.home-manager
pkgs.ghostty
pkgs.libnotify
];
}

View file

@ -1,4 +1,4 @@
{ lib, ... }:
{ lib, pkgs, ... }:
{
users.users.admin = {
@ -8,4 +8,24 @@
};
security.sudo.wheelNeedsPassword = lib.mkDefault true;
# Bootstrap Home Manager for admin on first login (per-user, standalone)
systemd.user.services.hm-bootstrap = {
description = "One-time Home Manager bootstrap for admin";
unitConfig = {
ConditionPathExists = "!%h/.config/home-manager/.hm_bootstrap_done";
After = [ "graphical-session.target" ];
Wants = [ "graphical-session.target" ];
PartOf = [ "graphical-session.target" ];
};
serviceConfig = {
Type = "simple";
TimeoutStartSec = "30min";
Environment = [ "PATH=/run/current-system/sw/bin:/etc/profiles/per-user/%u/bin" ];
StandardOutput = "journal";
StandardError = "journal";
ExecStart = pkgs.writeShellScript "hm-bootstrap.sh" (builtins.readFile ../../scripts/hm-bootstrap.sh);
};
wantedBy = [ "graphical-session.target" ];
};
}