From 7a63e7adc4f929d958cd6bb1d784b640a4af6eba Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 13 Jan 2023 21:06:39 +0100 Subject: home-manager late activation --- accounts/gkleen@eostre.nix | 2 ++ accounts/gkleen@installer.nix | 8 +++++++- accounts/gkleen@sif/default.nix | 2 ++ accounts/gkleen@surtr.nix | 4 +++- accounts/gkleen@vidhar.nix | 2 ++ accounts/mherold@eostre.nix | 2 ++ accounts/mherold@surtr.nix | 2 ++ accounts/mherold@vidhar.nix | 5 ++++- accounts/mkleen@surtr.nix | 4 +++- accounts/mwagner@surtr.nix | 4 +++- accounts/root@eostre.nix | 7 +++++++ accounts/root@installer.nix | 7 +++++++ accounts/root@sif.nix | 2 ++ accounts/root@surtr.nix | 3 +++ accounts/root@vidhar.nix | 2 ++ accounts/some@surtr.nix | 4 +++- accounts/tkleen@surtr.nix | 4 +++- accounts/vkleen@surtr.nix | 4 +++- flake.lock | 12 ++++++------ flake.nix | 7 +++++-- hosts/eostre/default.nix | 39 --------------------------------------- user-profiles/core.nix | 9 +++++++-- 22 files changed, 78 insertions(+), 57 deletions(-) create mode 100644 accounts/root@eostre.nix create mode 100644 accounts/root@installer.nix create mode 100644 accounts/root@surtr.nix diff --git a/accounts/gkleen@eostre.nix b/accounts/gkleen@eostre.nix index e8423976..e97fdab5 100644 --- a/accounts/gkleen@eostre.nix +++ b/accounts/gkleen@eostre.nix @@ -6,6 +6,8 @@ config = { home-manager.users.${userName} = { + home.stateVersion = "20.09"; + nixpkgs.config = { allowUnfree = true; }; diff --git a/accounts/gkleen@installer.nix b/accounts/gkleen@installer.nix index 64629674..c7a418f8 100644 --- a/accounts/gkleen@installer.nix +++ b/accounts/gkleen@installer.nix @@ -1 +1,7 @@ -{...}: {} +{ userName, ... }: + +{ + home-manager.users.${userName} = { config, ... } : { + home.stateVersion = config.home.version.release; + }; +} diff --git a/accounts/gkleen@sif/default.nix b/accounts/gkleen@sif/default.nix index de315ede..6df87347 100644 --- a/accounts/gkleen@sif/default.nix +++ b/accounts/gkleen@sif/default.nix @@ -64,6 +64,8 @@ in { }; home-manager.users.${userName} = { + home.stateVersion = "20.09"; + nixpkgs.config = { allowUnfree = true; zathura.useMupdf = false; diff --git a/accounts/gkleen@surtr.nix b/accounts/gkleen@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/gkleen@surtr.nix +++ b/accounts/gkleen@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/gkleen@vidhar.nix b/accounts/gkleen@vidhar.nix index 52a32d8a..ced75a2c 100644 --- a/accounts/gkleen@vidhar.nix +++ b/accounts/gkleen@vidhar.nix @@ -8,6 +8,8 @@ }; home-manager.users.${userName} = { + home.stateVersion = "20.09"; + programs.ssh.matchBlocks = { "git.ymir" = { hostname = "ymir.yggdrasil.li"; diff --git a/accounts/mherold@eostre.nix b/accounts/mherold@eostre.nix index 9eb9e738..b93cadbd 100644 --- a/accounts/mherold@eostre.nix +++ b/accounts/mherold@eostre.nix @@ -5,6 +5,8 @@ }; home-manager.users.${userName} = { + home.stateVersion = "20.09"; + nixpkgs.config = { allowUnfree = true; }; diff --git a/accounts/mherold@surtr.nix b/accounts/mherold@surtr.nix index ba41d65f..7805eefb 100644 --- a/accounts/mherold@surtr.nix +++ b/accounts/mherold@surtr.nix @@ -1,6 +1,8 @@ { userName, ... }: { users.users.${userName} = { + home.stateVersion = "20.09"; + extraGroups = ["webdav"]; }; } diff --git a/accounts/mherold@vidhar.nix b/accounts/mherold@vidhar.nix index 7b25cc12..0fab263e 100644 --- a/accounts/mherold@vidhar.nix +++ b/accounts/mherold@vidhar.nix @@ -1,3 +1,6 @@ { userName, ... }: { - config.users.users.${userName}.uid = 1001; + config = { + users.users.${userName}.uid = 1001; + home-manager.users.${userName}.home.stateVersion = "20.09"; + }; } diff --git a/accounts/mkleen@surtr.nix b/accounts/mkleen@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/mkleen@surtr.nix +++ b/accounts/mkleen@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/mwagner@surtr.nix b/accounts/mwagner@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/mwagner@surtr.nix +++ b/accounts/mwagner@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/root@eostre.nix b/accounts/root@eostre.nix new file mode 100644 index 00000000..c7a418f8 --- /dev/null +++ b/accounts/root@eostre.nix @@ -0,0 +1,7 @@ +{ userName, ... }: + +{ + home-manager.users.${userName} = { config, ... } : { + home.stateVersion = config.home.version.release; + }; +} diff --git a/accounts/root@installer.nix b/accounts/root@installer.nix new file mode 100644 index 00000000..c7a418f8 --- /dev/null +++ b/accounts/root@installer.nix @@ -0,0 +1,7 @@ +{ userName, ... }: + +{ + home-manager.users.${userName} = { config, ... } : { + home.stateVersion = config.home.version.release; + }; +} diff --git a/accounts/root@sif.nix b/accounts/root@sif.nix index 979463ba..c9e129a0 100644 --- a/accounts/root@sif.nix +++ b/accounts/root@sif.nix @@ -1,6 +1,8 @@ { userName, ... }: { home-manager.users.${userName} = { + home.stateVersion = "20.09"; + programs.ssh.matchBlocks = { "git.yggdrasil.li" = { user = "gitolite"; diff --git a/accounts/root@surtr.nix b/accounts/root@surtr.nix new file mode 100644 index 00000000..58c4f21d --- /dev/null +++ b/accounts/root@surtr.nix @@ -0,0 +1,3 @@ +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/root@vidhar.nix b/accounts/root@vidhar.nix index 0b5fb6ec..e82414a8 100644 --- a/accounts/root@vidhar.nix +++ b/accounts/root@vidhar.nix @@ -1,6 +1,8 @@ { config, userName, ... }: { home-manager.users.${userName} = { + home.stateVersion = "20.09"; + programs.ssh.matchBlocks = { "yggdrasil.borgbase" = { hostname = "nx69hpl8.repo.borgbase.com"; diff --git a/accounts/some@surtr.nix b/accounts/some@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/some@surtr.nix +++ b/accounts/some@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/tkleen@surtr.nix b/accounts/tkleen@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/tkleen@surtr.nix +++ b/accounts/tkleen@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/accounts/vkleen@surtr.nix b/accounts/vkleen@surtr.nix index 64629674..58c4f21d 100644 --- a/accounts/vkleen@surtr.nix +++ b/accounts/vkleen@surtr.nix @@ -1 +1,3 @@ -{...}: {} +{ userName, ... }: { + home-manager.users.${userName}.home.stateVersion = "20.09"; +} diff --git a/flake.lock b/flake.lock index e390cec0..48705cb0 100644 --- a/flake.lock +++ b/flake.lock @@ -80,17 +80,17 @@ "utils": "utils_2" }, "locked": { - "lastModified": 1673343300, - "narHash": "sha256-5Xdj6kpXYMie0MlnGwqK5FaMdsedxvyuakWtyKB3zaQ=", - "owner": "nix-community", + "lastModified": 1672858401, + "narHash": "sha256-0Dd6c95/n6MVdqaHnIItK+d9UMJlYlPX2eMUHTsr/kc=", + "owner": "pasqui23", "repo": "home-manager", - "rev": "176e455371a8371586e8a3ff0d56ee9f3ca2324e", + "rev": "3d0d3a2bc3b8f279dec0355e3fcc24001e9fb085", "type": "github" }, "original": { - "owner": "nix-community", - "ref": "master", + "owner": "pasqui23", "repo": "home-manager", + "rev": "3d0d3a2bc3b8f279dec0355e3fcc24001e9fb085", "type": "github" } }, diff --git a/flake.nix b/flake.nix index d098f4b1..20cf2942 100644 --- a/flake.nix +++ b/flake.nix @@ -16,9 +16,12 @@ }; home-manager = { type = "github"; - owner = "nix-community"; + # owner = "nix-community"; + # repo = "home-manager"; + # ref = "master"; + owner = "pasqui23"; repo = "home-manager"; - ref = "master"; + rev = "3d0d3a2bc3b8f279dec0355e3fcc24001e9fb085"; inputs = { nixpkgs.follows = "nixpkgs"; }; diff --git a/hosts/eostre/default.nix b/hosts/eostre/default.nix index c8964d99..01dee9ae 100644 --- a/hosts/eostre/default.nix +++ b/hosts/eostre/default.nix @@ -96,44 +96,5 @@ with lib; videoDrivers = [ "nvidia" ]; }; - - systemd.services = mapAttrs' (userName: _: nameValuePair "home-manager-${userName}" { enable = mkForce false; }) config.home-manager.users; - - systemd.user.services."home-manager" = let - cfg = config.home-manager; - in { - description = "Home Manager environment"; - wantedBy = [ "basic.target" ]; - before = [ "basic.target" ]; - - environment = optionalAttrs (cfg.backupFileExtension != null) { - HOME_MANAGER_BACKUP_EXT = cfg.backupFileExtension; - } // optionalAttrs cfg.verbose { VERBOSE = "1"; }; - - stopIfChanged = false; - - unitConfig.DefaultDependencies = false; - - serviceConfig = { - Type = "oneshot"; - RemainAfterExit = "yes"; - TimeoutStartSec = 90; - SyslogIdentifier = "hm-activate"; - - ExecStart = pkgs.writeScript "hm-activate" '' - #! ${pkgs.runtimeShell} -el - - case $USER in - ${concatStringsSep "\n " (mapAttrsToList (_: usercfg: builtins.replaceStrings ["\n"] ["\n "] '' - ${usercfg.home.username}) - ${usercfg.home.activationPackage}/activate - systemctl --user daemon-reload - ;; - '') cfg.users)} - *) exit 0; ;; - esac - ''; - }; - }; }; } diff --git a/user-profiles/core.nix b/user-profiles/core.nix index 29891d12..acd61b9a 100644 --- a/user-profiles/core.nix +++ b/user-profiles/core.nix @@ -1,15 +1,20 @@ { flake, userName, config, lib, utils, ... }: -{ + +with lib; + +{ config = { users.users.${userName} = {}; # Just make sure the user is created + home-manager.useUserService = true; home-manager.users.${userName} = { imports = lib.attrValues flake.homeModules; config = { manual.manpages.enable = true; - home.stateVersion = "20.09"; systemd.user.startServices = "sd-switch"; + + programs.ssh.internallyManaged = mkForce true; }; }; -- cgit v1.2.3