refactor(home-manager): use flake-parts module
Some checks failed
/ check (nvimDev) (push) Failing after 1s
/ check (nvimHeadless) (push) Failing after 1s
/ check (nvimNoBundledBins) (push) Failing after 1s
/ check (nvimNoLsp) (push) Failing after 1s
/ check (nvimNoTSGrammars) (push) Failing after 1s
/ check (treefmt) (push) Successful in 3s
/ check-renovaterc (push) Successful in 3s
/ build (audiomenu) (push) Has been skipped
/ build (docs) (push) Has been skipped
/ build (jpassmenu) (push) Has been skipped
/ build (nixosConfigurations.vm.config.system.build.toplevel) (push) Has been skipped
/ build (nvim) (push) Has been skipped
/ report-size (push) Has been skipped

This is only available in the unstable HM branch, so we are stuck with
the non flake-parts version
This commit is contained in:
Jalil David Salamé Messina 2025-03-16 17:24:56 +01:00
parent eacd1a0520
commit 981fa9ae78
Signed by: jalil
GPG key ID: F016B9E770737A0B
3 changed files with 64 additions and 56 deletions

View file

@ -10,6 +10,7 @@ in
./docs.nix ./docs.nix
./example-vm.nix ./example-vm.nix
./nixos-modules.nix ./nixos-modules.nix
./home-modules.nix
./nixvim-modules.nix ./nixvim-modules.nix
./overlays.nix ./overlays.nix
./scripts.nix ./scripts.nix

View file

@ -0,0 +1,34 @@
{ self, inputs, ... }:
let
modules = ../modules;
in
{
# FIXME(25.05): this version of HM should have the flake module
# imports = [ inputs.home-manager.flakeModules.home-manager ];
flake.homeModules =
let
defaultModules = [
inputs.nixvim.homeManagerModules.nixvim
self.nixvimModules.homeManager
(modules + "/hm")
];
nixos = {
imports = defaultModules;
};
standalone = {
imports = defaultModules ++ [
inputs.stylix.homeManagerModules.stilyx
(
{ config, ... }:
{
stylix.image = config.jhome.sway.background;
}
)
];
};
in
{
inherit standalone nixos;
};
}

View file

@ -8,63 +8,36 @@ let
modules = ../modules; modules = ../modules;
in in
{ {
flake = { flake.nixosModules =
homeManagerModules = let
let nixosModule = {
defaultModules = [ imports = [
inputs.nixvim.homeManagerModules.nixvim inputs.stylix.nixosModules.stylix
self.nixvimModules.homeManager inputs.home-manager.nixosModules.home-manager
(modules + "/hm") (modules + "/nixos")
]; ] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
nixos = { home-manager = {
imports = defaultModules; useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ self.homeModules.nixos ];
}; };
standalone = { # Pin nixpkgs
imports = defaultModules ++ [ nix.registry.nixpkgs.flake = inputs.nixpkgs;
inputs.stylix.homeManagerModules.stilyx
(
{ config, ... }:
{
stylix.image = config.jhome.sway.background;
}
)
];
};
in
{
inherit standalone nixos;
}; };
nixosModules =
let
nixosModule = {
imports = [
inputs.stylix.nixosModules.stylix
inputs.home-manager.nixosModules.home-manager
(modules + "/nixos")
] ++ lib.optional (inputs.lix-module != null) inputs.lix-module.nixosModules.default;
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
sharedModules = [ self.homeManagerModules.nixos ];
};
# Pin nixpkgs
nix.registry.nixpkgs.flake = inputs.nixpkgs;
};
machines = [ "vm" ]; machines = [ "vm" ];
mkMachine = hostname: { mkMachine = hostname: {
imports = [ imports = [
nixosModule nixosModule
(import (../machines + "/${hostname}")) (import (../machines + "/${hostname}"))
]; ];
home-manager.sharedModules = [ { jhome.hostName = hostname; } ]; home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
}; };
machineModules = lib.genAttrs machines mkMachine; machineModules = lib.genAttrs machines mkMachine;
in in
{ {
default = nixosModule; default = nixosModule;
inherit nixosModule; inherit nixosModule;
} }
// machineModules; // machineModules;
};
} }