From 7c8767f035e079da930b65bfeea9ec495dbfac85 Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Mon, 12 Aug 2024 01:40:30 -0400 Subject: [PATCH] expose packages output, add it to global nixpkgs Signed-off-by: ahuston-0 --- flake.nix | 4 +++- lib/systems.nix | 19 +++++++++++++++---- modules/nix.nix | 14 +++++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/flake.nix b/flake.nix index 3a49483..305db2a 100644 --- a/flake.nix +++ b/flake.nix @@ -151,6 +151,7 @@ ); inherit (lib.rad-dev.systems) genSystems getImages; inherit (self) outputs; # for hydra + in rec { inherit lib; # for allowing use of custom functions in nix repl @@ -158,13 +159,14 @@ hydraJobs = import ./hydra/jobs.nix { inherit inputs outputs systems; }; formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); - nixosConfigurations = genSystems inputs src (src + "/systems"); + nixosConfigurations = genSystems inputs outputs src (src + "/systems"); images = { install-iso = getImages nixosConfigurations "install-iso"; iso = getImages nixosConfigurations "iso"; qcow = getImages nixosConfigurations "qcow"; }; + packages = import ./packages { pkgs = nixpkgs.legacyPackages.x86_64-linux; }; checks = import ./checks.nix { inherit inputs forEachSystem formatter; }; devShells = import ./shell.nix { inherit inputs forEachSystem checks; }; }; diff --git a/lib/systems.nix b/lib/systems.nix index 656bc20..8f2f8d4 100644 --- a/lib/systems.nix +++ b/lib/systems.nix @@ -149,6 +149,7 @@ rec { configPath, hostname, inputs, + outputs ? { }, src, users, home ? true, @@ -160,7 +161,12 @@ rec { lib.nixosSystem { inherit system; specialArgs = { - inherit inputs server system; + inherit + inputs + outputs + server + system + ; }; modules = [ @@ -194,7 +200,7 @@ rec { # type: # genSystems :: AttrSet -> Path -> Path -> AttrSet genSystems = - inputs: src: path: + inputs: outputs: src: path: builtins.listToAttrs ( map ( name: @@ -205,10 +211,15 @@ rec { inherit name; value = constructSystem ( { - inherit inputs src configPath; + inherit + inputs + src + configPath + outputs + ; hostname = name; } - // import configPath { inherit inputs; } + // import configPath { inherit inputs outputs; } ); } ) (lib.rad-dev.lsdir path) diff --git a/modules/nix.nix b/modules/nix.nix index 9912ed7..f259e17 100644 --- a/modules/nix.nix +++ b/modules/nix.nix @@ -1,4 +1,9 @@ -{ lib, pkgs, ... }: +{ + lib, + pkgs, + outputs, + ... +}: { nix = { package = pkgs.nixVersions.latest; @@ -50,4 +55,11 @@ dates = [ "01:00" ]; }; }; + + nixpkgs.overlays = [ + (_: _: { + # bring all packages into a namespace called rad-pkgs + rad-pkgs = lib.genAttrs (lib.attrNames outputs.packages) (pkg: outputs.packages.${pkg}); + }) + ]; }