From 5add79250b29b32c7c4fe04adf8447abd04e3223 Mon Sep 17 00:00:00 2001 From: Fabian Hauser Date: Tue, 12 Apr 2022 09:23:59 +0200 Subject: [PATCH] Remove separate homeConfiguration from flake and minor cleanup --- flake.nix | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/flake.nix b/flake.nix index b13f6aa..ebda0a2 100644 --- a/flake.nix +++ b/flake.nix @@ -34,13 +34,16 @@ # Build with `nixos-rebuild --flake .#` or # `nix build .#nixosConfigurations..config.system.build.toplevel nixosConfigurations = let + sharedSpecialArgs = { + threemaModules = threema.nixosModules; + inherit pkgsUnstable; + + }; home-manager-config = { home-manager = { useGlobalPkgs = true; useUserPackages = true; - extraSpecialArgs = { - inherit pkgsUnstable; - threemaModules = threema.nixosModules; + extraSpecialArgs = sharedSpecialArgs // { pkgsEtaxesSg = fabianhauser-etaxes-sg.packages.${system}; }; users.fhauser = import ./home/fhauser/default.nix; @@ -49,9 +52,8 @@ mapHostnameToAttr = host: nixpkgs-stable.lib.nixosSystem { inherit system; - specialArgs = { + specialArgs = sharedSpecialArgs // { hardwareModules = nixos-hardware.nixosModules; - threemaModules = threema.nixosModules; }; modules = [ qois-infrastructure.nixosModule @@ -62,30 +64,20 @@ }; in pkgsUnstable.lib.genAttrs hosts mapHostnameToAttr; - homeConfigurations = { - fhauser = home-manager.lib.homeManagerConfiguration rec { - inherit system; - username = "fhauser"; - configuration = import ./home/${username}/default.nix; - extraSpecialArgs = { - inherit pkgsUnstable; - threemaModules = threema.nixosModules; - }; - - # Update the state version as needed. - # See the changelog here: - # https://nix-community.github.io/home-manager/release-notes.html#sec-release-21.05 - stateVersion = "21.11"; - }; - }; + # Nix development shell devShell.${system} = import ./shell.nix { pkgs = pkgsUnstable; }; - packages.${system}.defaultPackage.${system} = let - configs = map (host: self.nixosConfigurations.${host}.config.system.build.toplevel) hosts; - in pkgsUnstable.linkFarmFromDrvs "allHosts" configs; - + # Run checks and build all hosts as default package + packages.${system}.defaultPackage.${system} = with pkgsUnstable.lib; + let + checks = attrValues self.checks.${system}; + nixosConfigs = mapAttrsToList (n: v: v.config.system.build.toplevel) + self.nixosConfigurations; + in pkgsUnstable.linkFarmFromDrvs "allHosts" (checks ++ nixosConfigs); apps.${system} = { + + # Execute nixfmt on the repository format = let pkgs = pkgsUnstable; formatter = pkgsUnstable.writeShellScriptBin "formatter" ''