From d1d06e192ffb744184eab54f7eaf7c3fed765acc Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Fri, 4 Oct 2024 03:10:27 +0200 Subject: [PATCH] remove mkFlakeView shitty abstractions bad --- flake.nix | 40 +++++++++-------------------- profiles/http/docs/default.nix | 4 +-- profiles/http/services/stickers.nix | 4 +-- 3 files changed, 16 insertions(+), 32 deletions(-) diff --git a/flake.nix b/flake.nix index eb0b28b..d67a803 100644 --- a/flake.nix +++ b/flake.nix @@ -139,24 +139,11 @@ inputs-1909 = inputs-2305 // { nixpkgs = inputs'.nixpkgs-1909; }; inputs-test = inputs-edge // { nixpkgs = inputs'.nixpkgs-test; unstable = inputs'.nixpkgs-test; }; - mkFlakeView = inputs: system: inputs.nixpkgs.lib.mapAttrs (name: flake: flake // { - # TODO filter non-flake inputs - nixos = flake.nixosModules - or null; - pkgs = flake.packages.${system} - or flake.legacyPackages.${system} - or null; - lib = flake.lib.${system} - or flake.lib - or null; - }) inputs; - forSystems = systems: f: inputs-edge.nixpkgs.lib.genAttrs systems (system: f rec { inherit system; inputs = inputs-edge; pkgs = inputs.nixpkgs.legacyPackages.${system}; lib = inputs.nixpkgs.legacyPackages.${system}.lib; - flakes = mkFlakeView inputs system; }); forAllSystems = forSystems [ "x86_64-linux" @@ -185,7 +172,6 @@ home-manager.useGlobalPkgs = true; # go brrr, reuse overrides home-manager.extraSpecialArgs = { inherit inputs; - flakes = mkFlakeView inputs system; }; home-manager.sharedModules = [ inputs.sops-nix.homeManagerModules.sops @@ -215,7 +201,6 @@ inherit system; specialArgs = { inherit inputs; - flakes = mkFlakeView inputs system; }; modules = [ (mkModule extra-modules domain system inputs stateVersion modules hostname) ]; }; @@ -297,24 +282,24 @@ inputs = inputs'; lib = { - inherit mkFlakeView forSystems; + # pass } // forAllSystems ({ system, ... }: { - inherit mkFlakeView forSystems; - flakes = mkFlakeView inputs-edge system; - flakes-2311 = mkFlakeView inputs-2311 system; - flakes-2305 = mkFlakeView inputs-2305 system; + # pass }); nixosModules = mkHosts (mkModule []); nixosConfigurations = mkHosts (mkConfig []); nixosReports = mkHosts (mkReport []); - packages = forAllSystems ({ inputs, pkgs, lib, flakes, ... }: let + # TODO: overlays + + packages = forAllSystems ({ inputs, pkgs, lib, ... }: let + # TODO: by-name mk-nspawn-setup = hostname: # TODO: nspawn-tarball.nix populates /etc/nixos with junk (pkgs.callPackage ./pkgs/mk-nspawn-setup {}) (mkHosts (mkConfig [ "${nixos-nspawn}/nspawn-tarball.nix" ])).${hostname}; in { - # TODO: get faketty to work ${expect}/bin/unbuffer is bad + # TODO: get faketty to work, ${expect}/bin/unbuffer is bad nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" '' if test -t 1 && test -z "''${NIX_NO_NOM-}"; then exec ${lib.getExe pkgs.nixos-rebuild} -L "$@" |& ${lib.getExe pkgs.nix-output-monitor} @@ -330,7 +315,7 @@ nspawn-setup-brumlebasse = mk-nspawn-setup "brumlebasse"; image-brumlebasse-openstack = nixos-generators-2311.nixosGenerate { system = "x86_64-linux"; - specialArgs = { inherit inputs flakes; }; + specialArgs = { inherit inputs; }; modules = [ (mkHosts (mkModule [])).brumlebasse ]; format = "openstack"; }; @@ -352,7 +337,6 @@ }]; extraSpecialArgs = { inherit inputs; - flakes = mkFlakeView inputs system; }; }; in { @@ -367,10 +351,10 @@ pbsds-gnome-2305 = mkHome "pbsds" "/home/pbsds" inputs-2305 [ ./users/pbsds/home/gnome.nix ]; }); - devShells = forAllSystems ({ pkgs, flakes, ... }: let + devShells = forAllSystems ({ pkgs, system, ... }: let mkShell = packages: pkgs.mkShellNoCC { inherit packages; }; envrc-pkgs = [ - flakes.self.pkgs.nixos-rebuild-nom + self.packages.${system}.nixos-rebuild-nom pkgs.home-manager pkgs.nix-output-monitor pkgs.cachix @@ -384,12 +368,12 @@ in { envrc-local = mkShell envrc-pkgs; envrc-remote = mkShell (envrc-pkgs ++ [ - (pkgs.remote-exec or flakes.unstable.pkgs.remote-exec) + pkgs.remote-exec pkgs.yq pkgs.rsync ]); remoteenv = mkShell [ - flakes.self.pkgs.nixos-rebuild-nom + self.packages.${system}.nixos-rebuild-nom pkgs.age pkgs.ssh-to-age pkgs.just diff --git a/profiles/http/docs/default.nix b/profiles/http/docs/default.nix index 86f9506..65b57cb 100644 --- a/profiles/http/docs/default.nix +++ b/profiles/http/docs/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, mkDomain, flakes, ... }: +{ config, pkgs, lib, mkDomain, ... }: let cfg = config.services.docs-to-host; @@ -48,7 +48,7 @@ in services.docs-to-host.enable = mkEnableOption (lib.mdDoc "docs-to-host"); services.docs-to-host.pagefind = { enable = mkEnableOption (lib.mdDoc "pagefind default on index of docs"); - package = mkPackageOptionMD flakes.unstable.pkgs "pagefind" { }; + package = mkPackageOptionMD pkgs.unstable "pagefind" { }; }; services.docs-to-host.docs = mkOption { type = types.listOf (types.submodule { diff --git a/profiles/http/services/stickers.nix b/profiles/http/services/stickers.nix index ffe70e3..c631e88 100644 --- a/profiles/http/services/stickers.nix +++ b/profiles/http/services/stickers.nix @@ -1,7 +1,7 @@ -{ config, lib, mkDomain, flakes, ... }: +{ config, lib, mkDomain, inputs, ... }: let - myStickerPicker = flakes.maunium-stickerpicker-nix.createStickerPicker { + myStickerPicker = inputs.maunium-stickerpicker-nix.createStickerPicker { #homeserver = "https://matrix.pvv.ntnu.no"; #userId = "@stickerbot:my.matrix.server"; ## You should probably encrypt this with either agenix, sops-nix or whatever else