Properly export all packages for CI builds

We now properly handle deeply merging attributes, allowing us to export both the home-manager configuration and other packages.

This additionally modifies `./pkgs/default.nix` to take a single argument, `pkgs`.
This commit is contained in:
Spotlight 2024-10-07 20:38:59 -05:00
parent c81fcb987f
commit 67cf3adb8e
Signed by: spotlight
GPG key ID: 874AA355B3209BDC
3 changed files with 42 additions and 54 deletions

18
flake.lock generated
View file

@ -55,11 +55,11 @@
]
},
"locked": {
"lastModified": 1727383923,
"narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=",
"lastModified": 1728337164,
"narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ffe2d07e771580a005e675108212597e5b367d2d",
"rev": "038630363e7de57c36c417fd2f5d7c14773403e4",
"type": "github"
},
"original": {
@ -90,11 +90,11 @@
]
},
"locked": {
"lastModified": 1727707210,
"narHash": "sha256-8XZp5XO2FC6INZEZ2WlwErtvFVpl45ACn8CJ2hfTA0Y=",
"lastModified": 1727999297,
"narHash": "sha256-LTJuQPCsSItZ/8TieFeP30iY+uaLoD0mT0tAj1gLeyQ=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "f61d5f2051a387a15817007220e9fb3bbead57b3",
"rev": "8c8388ade72e58efdeae71b4cbb79e872c23a56b",
"type": "github"
},
"original": {
@ -105,11 +105,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1727634051,
"narHash": "sha256-S5kVU7U82LfpEukbn/ihcyNt2+EvG7Z5unsKW9H/yFA=",
"lastModified": 1728018373,
"narHash": "sha256-NOiTvBbRLIOe5F6RbHaAh6++BNjsb149fGZd1T4+KBg=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "06cf0e1da4208d3766d898b7fdab6513366d45b9",
"rev": "bc947f541ae55e999ffdb4013441347d83b00feb",
"type": "github"
},
"original": {

View file

@ -42,21 +42,24 @@
};
in
{
# There's a few things going on here that are all merged in the end.
# We start with a generalized package overlay, providing several packages
# First, we provide a generalized package overlay, providing several packages
# for e.g. nix-darwin, NixOS, and home-manager usage.
overlays.default = (import ./pkgs/default.nix);
# ./pkgs/default.nix's singular argument, `pkgs`, is provided by our `final`.
overlays.default = (final: prev: import ./pkgs/default.nix {
pkgs = final;
});
# Secondly, we create system-specific home-manager configurations.
# Next, we provide Linux-specific home-manager configurations,
# and expose our default packages to the world.
packages =
##########################
# Linux-specific options #
##########################
linuxSystems
(system: {
let
##########################
# Linux-specific options #
##########################
linuxConfiguration = linuxSystems (system: {
homeConfigurations = {
# First, we currently assume that Linux devices
# only require dotfiles and utilize the username `spotlight`.
# We currently assume that Linux devices only require
# dotfiles and utilize the username `spotlight`.
#
# For now, this is effectively true, sans a few specific configurations :)
spotlight = homeManager {
@ -73,37 +76,23 @@
};
};
};
})
});
//
# For all platforms, export our packages for CI to build.
exportedPackages = allSystems (system: import ./pkgs/default.nix {
pkgs = nixpkgs.legacyPackages.${system};
});
###########################
# Darwin-specific options #
###########################
darwinSystems (system: {
# We use the username `spot` under Darwin.
# We also assume that desktop applications should be made available, alongside GPG.
homeConfigurations.spot = homeManager {
system = system;
specialArgs = {
desktop = true;
gpg = true;
};
};
});
# //
#
# ####################
# # Generic packages #
# ####################
# # We'll export some of our overlay's packages for CI to build.
# allSystems (system: {
# packages = {
# swiftformat = import ./pkgs/swiftformat.nix;
# monaco-powerline = import ./monaco-powerline/default.nix;
# };
# });
# We must use recursiveUpdate in order to go deeper beyond one level.
# For example, `linuxConfiguration` provides `packages.x86_64-linux.homeConfiguration`
# and `exportedPackages` provides `packages.x86_64-linux.<package name>`.
#
# With the normal `//` syntax, `packages.x86_64-linux` is not recursively merged,
# and either packages or the home-manager configuration end up being replaced.
# This is not ideal :(
recursiveUpdate = nixpkgs.lib.recursiveUpdate;
in
recursiveUpdate linuxConfiguration exportedPackages;
# We provide a NixOS module for easy usage within other system flakes.
# (Again, we assume a default name of `spotlight` under Linux.)

View file

@ -1,6 +1,5 @@
self: super:
{
ipsw = super.callPackage ./ipsw.nix { };
monaco-powerline = super.callPackage ./monaco-powerline/default.nix { };
swiftformat = super.callPackage ./swiftformat.nix { };
{ pkgs, ... }: {
ipsw = pkgs.callPackage ./ipsw.nix { };
monaco-powerline = pkgs.callPackage ./monaco-powerline/default.nix { };
swiftformat = pkgs.callPackage ./swiftformat.nix { };
}