Skip to content

Commit 0e3d25f

Browse files
bryangoarxanas
authored andcommitted
feat(nix): flatten the flake outputs for clarity
Also, use updated flake outputs instead of the deprecated ones: - `packages.${system}.default` instead of `defaultPackage` - `overlays.default` instead of `overlay`. See: https://nixos.org/manual/nix/unstable/release-notes/rl-2.7.html
1 parent 2c2eaff commit 0e3d25f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

flake.nix

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
"x86_64-darwin"
1212
"x86_64-linux"
1313
];
14-
foreachSystem = f: lib.foldl' (attrs: system: lib.recursiveUpdate attrs (f system)) { } systems;
14+
foreachSystem = lib.genAttrs systems;
1515
in
1616
{
17-
overlay = (final: prev: {
17+
overlays.default = (final: prev: {
1818
git-branchless = final.callPackage
1919
(
2020
{ lib
@@ -110,27 +110,27 @@
110110
inherit (final.darwin.apple_sdk.frameworks) Security SystemConfiguration;
111111
};
112112
});
113-
} //
114-
(foreachSystem (system:
115-
let
116-
pkgs = import nixpkgs {
117-
inherit system;
118-
overlays = [ self.overlay ];
119-
};
120-
in
121-
{
122-
packages.${system} = {
113+
114+
packages = foreachSystem (system:
115+
let
116+
pkgs = nixpkgs.legacyPackages.${system}.extend self.overlays.default;
117+
in
118+
{
123119
inherit (pkgs)
124120
git-branchless scm-diff-editor;
125-
};
121+
default = pkgs.git-branchless;
122+
}
123+
);
126124

127-
defaultPackage.${system} = self.packages.${system}.git-branchless;
128-
checks.${system}.git-branchless = pkgs.git-branchless.overrideAttrs ({ preCheck, ... }: {
129-
cargoBuildType = "debug";
130-
cargoCheckType = "debug";
131-
preCheck = ''
132-
export RUST_BACKTRACE=1
133-
'' + preCheck;
134-
});
135-
}));
125+
checks = foreachSystem (system: {
126+
git-branchless =
127+
self.packages.${system}.git-branchless.overrideAttrs ({ preCheck, ... }: {
128+
cargoBuildType = "debug";
129+
cargoCheckType = "debug";
130+
preCheck = ''
131+
export RUST_BACKTRACE=1
132+
'' + preCheck;
133+
});
134+
});
135+
};
136136
}

0 commit comments

Comments
 (0)