flake: home-manager: convert to 'flake-parts'

This commit is contained in:
Bruno BELANYI 2023-03-08 18:11:59 +00:00
parent 59b1ab59dd
commit c82eb57070
2 changed files with 43 additions and 44 deletions

View file

@ -9,7 +9,7 @@
let
inherit (self) lib;
inherit (futils.lib) eachSystem system;
inherit (futils.lib) system;
mySystems = [
system.aarch64-darwin
@ -17,47 +17,6 @@ let
system.x86_64-darwin
system.x86_64-linux
];
eachMySystem = eachSystem mySystems;
systemDependant = system: {
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
nur.overlay
];
};
modules = [
"${self}/home"
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
};
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = mySystems;
@ -66,11 +25,10 @@ flake-parts.lib.mkFlake { inherit inputs; } {
./apps.nix
./checks.nix
./dev-shells.nix
./home-manager.nix
./lib.nix
./nixos.nix
./overlays.nix
./packages.nix
];
flake = (eachMySystem systemDependant);
}

41
flake/home-manager.nix Normal file
View file

@ -0,0 +1,41 @@
{ self, inputs, ... }:
{
perSystem = { system, ... }: {
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = inputs.home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import inputs.nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlay
];
};
modules = [
"${self}/home"
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
};
}