Compare commits

...

2 commits

Author SHA1 Message Date
Trolli Schmittlauch 83858d6d11 thinknix: enable guest user as a module
Introduce a guest user module that sets up a guest user with the default
desktop home packages through the home-manager NixOS module.

Enabled on thinknix.
2024-08-07 00:32:03 +02:00
Trolli Schmittlauch 8911511edc flake.lock: Update
Flake lock file updates:

• Updated input 'nixos-unstable':
    'github:NixOS/nixpkgs/9f918d616c5321ad374ae6cb5ea89c9e04bf3e58' (2024-07-31)
  → 'github:NixOS/nixpkgs/d04953086551086b44b6f3c6b7eeb26294f207da' (2024-08-02)
• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/05405724efa137a0b899cce5ab4dde463b4fd30b' (2024-08-01)
  → 'github:NixOS/nixpkgs/8b5b6723aca5a51edf075936439d9cd3947b7b2c' (2024-08-04)
• Updated input 'nur':
    'github:nix-community/NUR/ac1226f223779364c73f1a450654383768dab1b7' (2024-08-03)
  → 'github:nix-community/NUR/1261ebf63933d763c7eb2e3290782cf09d045fdb' (2024-08-05)
2024-08-06 00:41:09 +02:00
5 changed files with 86 additions and 10 deletions

View file

@ -15,6 +15,7 @@ in
./nitrokey.nix
./nix-settings.nix
./upgrade-diff.nix
./guest.nix
];
services.davfs2.enable = true;

66
common/guest.nix Normal file
View file

@ -0,0 +1,66 @@
{
config,
lib,
system,
...
}:
let
inputs = config.inputInjection.flake-inputs;
in
{
# interesting: this causes an infinite recursion
#imports = [ config.inputInjection.flake-inputs.home-manager.nixosModules.home-manager ];
options.schmittlauch.guestUser.enable = lib.options.mkEnableOption "Provide a guest user account";
config = lib.mkIf config.schmittlauch.guestUser.enable {
users.extraUsers.gast = {
isNormalUser = true;
group = "gast";
hashedPassword = "$y$j9T$pPCjU8ZvVYo0aY4jtrHPj1$NxUWOP/YTcqJ1PYaP1Hy5MwTeDcNjg0k369R5rE5M48";
};
users.groups.gast = { };
# a basic home-manager configuration to share installed packages of other accounts
# reason: keeping a separate config checkout for guests and requiring them to run
# their own `home-manager` instance does not make sense.
home-manager =
let
gast = config.users.extraUsers.gast;
in
{
useGlobalPkgs = false; # to allow usage of home-level overlays
# FIXME: possibly expose home modules through flake outputs instead of brittle path traversals
users.gast = {
imports = [
inputs.nur.hmModules.nur
../home/modules/packages.nix
];
home = {
username = gast.name;
homeDirectory = gast.home;
stateVersion = "24.05";
};
schmittlauch = {
packages = {
graphics = true;
multimedia = true;
nixHelpers = true;
devTools = true;
pythonTools = true;
games = true;
desktopLinux = true;
kde = true;
};
};
};
# Optionally use extraSpecialArgs
# to pass through arguments to home.nix
extraSpecialArgs = {
inherit inputs system;
};
};
};
}

View file

@ -210,11 +210,11 @@
},
"nixos-unstable": {
"locked": {
"lastModified": 1722421184,
"narHash": "sha256-/DJBI6trCeVnasdjUo9pbnodCLZcFqnVZiLUfqLH4jA=",
"lastModified": 1722630782,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "9f918d616c5321ad374ae6cb5ea89c9e04bf3e58",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"type": "github"
},
"original": {
@ -258,11 +258,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1722519197,
"narHash": "sha256-VEdJmVU2eLFtLqCjTYJd1J7+Go8idAcZoT11IewFiRg=",
"lastModified": 1722791413,
"narHash": "sha256-rCTrlCWvHzMCNcKxPE3Z/mMK2gDZ+BvvpEVyRM4tKmU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "05405724efa137a0b899cce5ab4dde463b4fd30b",
"rev": "8b5b6723aca5a51edf075936439d9cd3947b7b2c",
"type": "github"
},
"original": {
@ -274,11 +274,11 @@
},
"nur": {
"locked": {
"lastModified": 1722709906,
"narHash": "sha256-I27FkJ3qSsxc5aZSwpYHMqJwLpvQt6eV4MrwGfVjCvM=",
"lastModified": 1722894411,
"narHash": "sha256-OUOJ/dglPQ/YAN/zYAdEzzhSUv84QF8px9JT4eQb4GA=",
"owner": "nix-community",
"repo": "NUR",
"rev": "ac1226f223779364c73f1a450654383768dab1b7",
"rev": "1261ebf63933d763c7eb2e3290782cf09d045fdb",
"type": "github"
},
"original": {

View file

@ -59,7 +59,13 @@
flake-inputs = inputs;
};
};
defaultModules = system: [ inputInjection ];
defaultModules = system: [
inputInjection
# for some reason, `imports`-ing the home-manager module via inputInjection
# from a sub-module causes infinite recursion, so importing it here instead
home-manager.nixosModules.home-manager
];
mkSystem =
system: extraModules:
nixpkgs.lib.nixosSystem rec {
@ -115,6 +121,7 @@
modules = [
./darwin/configuration.nix
inputInjection
];
};
homeConfigurations = {

View file

@ -22,6 +22,8 @@
speed = 180;
};
schmittlauch.guestUser.enable = true;
networking.hostName = "thinknix";
# This value determines the NixOS release with which your system is to be