refactor: make nanuqsaurus module-based; keep btrfs install profile
This commit is contained in:
parent
e640b43b2f
commit
bb138278f1
13 changed files with 218 additions and 173 deletions
21
modules/profile/nanuqsaurus.nix
Normal file
21
modules/profile/nanuqsaurus.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ inputs }:
|
||||
{ ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.lix-module.nixosModules.lixFromNixpkgs
|
||||
inputs.nix-index-database.nixosModules.nix-index
|
||||
inputs.nix-flatpak.nixosModules.nix-flatpak
|
||||
../system/flatpak.nix
|
||||
../system/base.nix
|
||||
../system/packages.nix
|
||||
../system/shell.nix
|
||||
../system/home-manager-skel.nix
|
||||
../system/fonts.nix
|
||||
../system/printer.nix
|
||||
../desktop/desktop-entries.nix
|
||||
../desktop/file-manager.nix
|
||||
../desktop/gnome-minimal.nix
|
||||
../development/flox.nix
|
||||
../users/admin.nix
|
||||
];
|
||||
}
|
||||
|
|
@ -1,8 +1,15 @@
|
|||
{ ... }:
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
flakeText = (builtins.readFile ../../templates/home-flake.nix);
|
||||
homeText = (builtins.readFile ../../templates/home-home.nix);
|
||||
adminUser = lib.attrByPath [ "nanuqsaurus" "admin" "username" ] "admin" config;
|
||||
substitute = text: lib.replaceStrings [ "@ADMIN_USER@" ] [ adminUser ] text;
|
||||
|
||||
flakeText = substitute (builtins.readFile ../../templates/home-flake.nix);
|
||||
homeText = substitute (builtins.readFile ../../templates/home-home.nix);
|
||||
in
|
||||
{
|
||||
environment.etc = {
|
||||
|
|
|
|||
|
|
@ -1,57 +1,79 @@
|
|||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
users.groups = {
|
||||
docker = { };
|
||||
podman = { };
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.nanuqsaurus.admin;
|
||||
in
|
||||
{
|
||||
options.nanuqsaurus.admin = {
|
||||
username = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "admin";
|
||||
description = "Primary admin user account name.";
|
||||
};
|
||||
};
|
||||
|
||||
users.users.admin = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"podman"
|
||||
"docker"
|
||||
"libvirtd"
|
||||
"lpadmin"
|
||||
];
|
||||
hashedPassword = "$6$HrwFoHtYRwiTZsYo$gKNOvkQhjalczOLgoTXvVu1MaihYP4BdBnVpWkdoAf.5MAiV2mMPRibYyGv9ti1Q63AhGK7n4wOPjAU0O74mK0";
|
||||
subGidRanges = [
|
||||
{
|
||||
count = 65536;
|
||||
startGid = 100000;
|
||||
}
|
||||
];
|
||||
subUidRanges = [
|
||||
{
|
||||
count = 65536;
|
||||
startUid = 100000;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
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" ];
|
||||
config = {
|
||||
users.groups = {
|
||||
docker = { };
|
||||
podman = { };
|
||||
};
|
||||
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
|
||||
);
|
||||
|
||||
users.users.${cfg.username} = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"podman"
|
||||
"docker"
|
||||
"libvirtd"
|
||||
"lpadmin"
|
||||
];
|
||||
hashedPassword = "$6$HrwFoHtYRwiTZsYo$gKNOvkQhjalczOLgoTXvVu1MaihYP4BdBnVpWkdoAf.5MAiV2mMPRibYyGv9ti1Q63AhGK7n4wOPjAU0O74mK0";
|
||||
subGidRanges = [
|
||||
{
|
||||
count = 65536;
|
||||
startGid = 100000;
|
||||
}
|
||||
];
|
||||
subUidRanges = [
|
||||
{
|
||||
count = 65536;
|
||||
startUid = 100000;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
security.sudo.wheelNeedsPassword = lib.mkDefault true;
|
||||
|
||||
# Bootstrap Home Manager for the primary admin user on first login (per-user, standalone)
|
||||
systemd.user.services.hm-bootstrap = {
|
||||
description = "One-time Home Manager bootstrap";
|
||||
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"
|
||||
"NANUQSAURUS_ADMIN_USER=${cfg.username}"
|
||||
"NANUQSAURUS_HM_TARGET=${cfg.username}"
|
||||
];
|
||||
StandardOutput = "journal";
|
||||
StandardError = "journal";
|
||||
ExecStart = pkgs.writeShellScript "hm-bootstrap.sh" (
|
||||
builtins.readFile ../../scripts/hm-bootstrap.sh
|
||||
);
|
||||
};
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
wantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue