From a6359fdd364d9420f87e4d79f83f319579431643 Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Tue, 17 Sep 2024 18:40:15 +0100 Subject: [PATCH 1/2] export home-manager config from homeManagerModules --- common/users/qenya.nix | 5 ----- flake.nix | 20 ++++++++++++++++++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/common/users/qenya.nix b/common/users/qenya.nix index 19dc8ed..e9d11ad 100644 --- a/common/users/qenya.nix +++ b/common/users/qenya.nix @@ -11,9 +11,4 @@ in { }; programs.zsh.enable = true; - - home-manager.users.qenya = { config, lib, pkgs, osConfig, ... }: { - home.homeDirectory = osConfig.users.users.qenya.home; - imports = [ ../../home/qenya ]; - }; } diff --git a/flake.nix b/flake.nix index 98baa2a..4680f54 100644 --- a/flake.nix +++ b/flake.nix @@ -27,6 +27,19 @@ }; outputs = inputs@{ self, nixpkgs, home-manager, plasma-manager, nur, agenix, birdsong, ... }: { + # The name of this output type is not standardised. I have picked + # "homeManagerModules" as the discussion here suggests it's the most common: + # https://github.com/nix-community/home-manager/issues/1783 + # + # However, note CppNix >= 2.22.3, >= 2.24 has blessed "homeModules": + # https://github.com/NixOS/nix/pull/10858 + homeManagerModules."qenya" = { config, lib, pkgs, ... }: { + imports = [ + plasma-manager.homeManagerModules.plasma-manager + ./home/qenya + ]; + }; + colmena = { meta = { nixpkgs = import nixpkgs { system = "x86_64-linux"; }; @@ -35,7 +48,7 @@ }; }; - defaults = { name, nodes, config, ... }: { + defaults = { name, nodes, ... }: { networking.hostName = name; nix.settings.experimental-features = "nix-command flakes"; @@ -43,7 +56,10 @@ nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ nur.overlay ]; - home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ]; + + # TODO: make this or something like it work without infinite recursion + # home-manager.users."qenya" = lib.mkIf (config.users.users ? "qenya") self.homeManagerModules."qenya"; + home-manager.users."qenya" = self.homeManagerModules."qenya"; imports = [ home-manager.nixosModules.home-manager From d881607cb0b430e614ce2848c40f1e23cb0295a3 Mon Sep 17 00:00:00 2001 From: Katherina Walshe-Grey Date: Tue, 17 Sep 2024 18:41:13 +0100 Subject: [PATCH 2/2] Revert "qenya: plasma: workaround for issue in randomcat's config" This reverts commit 7189fae10971563bda9dbbb21bfd0a9d992a52b1. This didn't actually fix the issue, as it turns out mkIf still resolves the children of its attrset recursively. The longer-term solution is to export my home-manager config as a flake output, which I'm moving towards. --- home/qenya/plasma/default.nix | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/home/qenya/plasma/default.nix b/home/qenya/plasma/default.nix index 6624109..f35d05c 100644 --- a/home/qenya/plasma/default.nix +++ b/home/qenya/plasma/default.nix @@ -1,19 +1,11 @@ { config, lib, pkgs, osConfig, ... }: let - inherit (lib) mkIf; isPlasma = osConfig.services.desktopManager.plasma6.enable || osConfig.services.xserver.desktopManager.plasma5.enable; in { - # FIXME: this mkIf is necessary because home/qenya is imported into shaw here: - # https://github.com/randomnetcat/nix-configs/blob/75d491dc6904475e43a820287edf3cf2f89abcfb/hosts/shaw/birdsong.nix#L74 - # shaw doesn't understand programs.plasma because randomcat doesn't import - # plasma-manager, and is unwilling to because none of her machines run KDE. - # This probably can't be fixed until we merge our configs completely. - programs = mkIf isPlasma { - plasma.enable = isPlasma; - plasma.overrideConfig = true; - }; + programs.plasma.enable = isPlasma; + programs.plasma.overrideConfig = true; imports = [ ]; }