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
./example-vm.nix
./nixos-modules.nix
./home-modules.nix
./nixvim-modules.nix
./overlays.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;
in
{
flake = {
homeManagerModules =
let
defaultModules = [
inputs.nixvim.homeManagerModules.nixvim
self.nixvimModules.homeManager
(modules + "/hm")
];
nixos = {
imports = defaultModules;
flake.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.homeModules.nixos ];
};
standalone = {
imports = defaultModules ++ [
inputs.stylix.homeManagerModules.stilyx
(
{ config, ... }:
{
stylix.image = config.jhome.sway.background;
}
)
];
};
in
{
inherit standalone nixos;
# Pin nixpkgs
nix.registry.nixpkgs.flake = inputs.nixpkgs;
};
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" ];
mkMachine = hostname: {
imports = [
nixosModule
(import (../machines + "/${hostname}"))
];
home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
};
machineModules = lib.genAttrs machines mkMachine;
in
{
default = nixosModule;
inherit nixosModule;
}
// machineModules;
};
machines = [ "vm" ];
mkMachine = hostname: {
imports = [
nixosModule
(import (../machines + "/${hostname}"))
];
home-manager.sharedModules = [ { jhome.hostName = hostname; } ];
};
machineModules = lib.genAttrs machines mkMachine;
in
{
default = nixosModule;
inherit nixosModule;
}
// machineModules;
}