flake: refactor to differentiate common modules

This commit is contained in:
Bruno BELANYI 2021-03-07 18:26:20 +00:00
parent e09da8505e
commit 21d7604861

View file

@ -9,19 +9,17 @@
outputs = { self, nixpkgs, nur, home-manager }: outputs = { self, nixpkgs, nur, home-manager }:
let let
buildHost = name: system: nixpkgs.lib.nixosSystem { inherit (nixpkgs) lib;
inherit system;
modules = [ defaultModules = [
({ pkgs, ... }: { ({ pkgs, ... }: {
# Let 'nixos-version --json' know about the Git revision # Let 'nixos-version --json' know about the Git revision
# of this flake.
system.configurationRevision = system.configurationRevision =
if self ? rev if self ? rev
then self.rev then self.rev
else throw "Refusing to build from a dirty Git tree!"; else throw "Refusing to build from a dirty Git tree!";
}) })
{ nixpkgs.overlays = [ nur.overlay ]; } { nixpkgs.overlays = [ nur.overlay ]; }
(./. + "/${name}.nix")
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.users.ambroisie = import ./home; home-manager.users.ambroisie = import ./home;
@ -30,6 +28,12 @@
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
} }
]; ];
buildHost = name: system: lib.nixosSystem {
inherit system;
modules = defaultModules ++ [
(./. + "/${name}.nix")
];
}; };
in in
{ {