From 446f2ac62e23507dc704471987388382fb238f6d Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Thu, 10 Feb 2022 17:46:13 -0800 Subject: home-manager: split the configuration --- lib/default.nix | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 lib/default.nix (limited to 'lib') diff --git a/lib/default.nix b/lib/default.nix new file mode 100644 index 0000000..7f0f8ed --- /dev/null +++ b/lib/default.nix @@ -0,0 +1,62 @@ +{ inputs, overlays }: +{ + mkSystem = + { hostname + , system + , desktop ? false + }: + inputs.nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { + inherit inputs system hostname desktop; + }; + modules = [ + ../modules/deskop + ../modules/system + ../hosts/${hostname} + { + networking.hostName = hostname; + # Apply overlay and allow unfree packages + nixpkgs = { + inherit overlays; + config.allowUnfree = true; + }; + # Add each input as a registry + nix.registry = inputs.nixpkgs.lib.mapAttrs' + (n: v: + inputs.nixpkgs.lib.nameValuePair (n) ({ flake = v; })) + inputs; + } + ] + }; + + mkHome = + { username + , system + , hostname + , desktop ? false + }: + inputs.home-manager.lib.homeManagerConfiguration { + inherit username system; + extraSpecialArgs = { + inherit system hostname graphical; + }; + homeDirectory = "/home/${username}"; + configuration = ../users/${username}; + extraModules = [ + ../modules/home-manager + # Base configuration + { + nixpkgs = { + inherit overlays; + config.allowUnfree = true; + }; + programs = { + home-manager.enable = true; + git.enable = true; + }; + systemd.user.startServices = "sd-switch"; + } + ]; + }; +} -- cgit 1.4.1