From 1405e7f020fa0414bd171347b6d10f3b84332e84 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Tue, 20 Jun 2023 01:36:49 +0200 Subject: [PATCH] refactor --- flake.nix | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/flake.nix b/flake.nix index 029c26c..2031676 100644 --- a/flake.nix +++ b/flake.nix @@ -47,7 +47,12 @@ "aarch64-linux" #"riscv64-linux" ]; - forAllSystems = f: nixlib.genAttrs systems (system: f system); + #forAllSystems = f: nixlib.genAttrs systems (system: f system); + forAllSystems = f: nixlib.genAttrs systems (system: f { + inherit system; + pkgs = nixpkgs.legacyPackages.${system}; + lib = nixpkgs.legacyPackages.${system}.lib; + }); overlays = nixlib.mapAttrsToList (name: val: val) self.overlays; # TODO: move unstable and nur here? @@ -90,13 +95,8 @@ inherit inputs; - overlays.remote-exec = (final: prev: { - remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {}; - }); - - packages = forAllSystems(system: - let pkgs = nixpkgs.legacyPackages.${system}; in { - inherit (self.overlays.remote-exec null pkgs) remote-exec; + packages = forAllSystems({ pkgs, ... }: { + remote-exec = pkgs.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" {}; }); nixosConfigurations = let nm = nixos-hardware.nixosModules; in { @@ -107,19 +107,17 @@ sopp = mkConfig "sopp" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel common-gpu-nvidia-nonprime ]); }; - homeConfigurations = forAllSystems (system: let + homeConfigurations = forAllSystems ({ pkgs, ... }: let mkHome = modules: home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - inherit modules; + inherit pkgs modules; }; in { pbsds = mkHome [ ./users/pbsds/home ]; pbsds-gnome = mkHome [ ./users/pbsds/home/gnome.nix ]; }); - devShells = forAllSystems (system: let - pkgs = nixpkgs.legacyPackages.${system}; - remote-exec = pkgs.remote-exec or (self.overlays.remote-exec pkgs pkgs).remote-exec; + devShells = forAllSystems ({ system, pkgs, ... }: let + inherit (self.packages.${system}) remote-exec; nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" '' exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom '';