Skip to content

Commit

Permalink
flake: Remove flake-utils
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis authored and jian-lin committed Nov 3, 2024
1 parent 7cd35bf commit 711566e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 62 deletions.
34 changes: 0 additions & 34 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 30 additions & 28 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
};

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-24.05";
};
Expand All @@ -16,13 +15,37 @@
{ self
, nixpkgs
, nixpkgs-stable
, flake-utils
}:
let
inherit (nixpkgs) lib;
forAllSystems = lib.genAttrs lib.systems.flakeExposed;

importPkgs = path: attrs: import path (attrs // {
config.allowAliases = false;
overlays = [ self.overlays.default ];
});

packages' = forAllSystems (system: (
let
pkgs = importPkgs nixpkgs { inherit system; };
inherit (pkgs) lib;

overlayAttributes = lib.pipe (import ./. pkgs pkgs) [
builtins.attrNames
(lib.partition (n: lib.isDerivation pkgs.${n}))
];
attributesToAttrset = attributes: lib.pipe attributes [
(map (n: lib.nameValuePair n pkgs.${n}))
lib.listToAttrs
];

in
{
lib = attributesToAttrset overlayAttributes.wrong;
packages = attributesToAttrset overlayAttributes.right;
}
));

in
{
# self: super: must be named final: prev: for `nix flake check` to be happy
Expand All @@ -34,12 +57,8 @@
# for backward compatibility, is safe to delete, not referenced anywhere
overlay = self.overlays.default;

# Run Hercules CI for these systems.
herculesCI.ciSystems = [ "x86_64-linux" ];

} // flake-utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
{
hydraJobs =
lib.genAttrs [ "x86_64-linux" "aarch64-linux" ] (system:
let
mkHydraJobs = pkgs:
let
Expand All @@ -66,26 +85,9 @@
{
"stable" = mkHydraJobs (importPkgs nixpkgs-stable { inherit system; });
"unstable" = mkHydraJobs (importPkgs nixpkgs { inherit system; });
};
}) // flake-utils.lib.eachDefaultSystem (system: (
let
pkgs = importPkgs nixpkgs { inherit system; };
inherit (pkgs) lib;

overlayAttributes = lib.pipe (import ./. pkgs pkgs) [
builtins.attrNames
(lib.partition (n: lib.isDerivation pkgs.${n}))
];
attributesToAttrset = attributes: lib.pipe attributes [
(map (n: lib.nameValuePair n pkgs.${n}))
lib.listToAttrs
];

in
{
lib = attributesToAttrset overlayAttributes.wrong;
packages = attributesToAttrset overlayAttributes.right;
}
));
});

packages = forAllSystems (system: packages'.${system}.packages);
lib = forAllSystems (system: packages'.${system}.lib);
};
}

0 comments on commit 711566e

Please sign in to comment.