-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
38 lines (38 loc) · 1.6 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{
description = "aasg's Nix expressions";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, flake-utils, nixpkgs }:
let
inherit (flake-utils.lib) defaultSystems flattenTree;
inherit (nixpkgs.lib.attrsets) filterAttrs genAttrs mapAttrs;
inherit (nixpkgs.lib.strings) hasPrefix hasSuffix;
inherit (nixpkgs.lib.trivial) id flip pipe;
in
{
lib = import ./lib { inherit (nixpkgs) lib; };
packages = genAttrs defaultSystems
(system: pipe (import ./. { pkgs = nixpkgs.legacyPackages.${system}; }) [
# Remove non–package attributes.
(flip builtins.removeAttrs [ "lib" "modules" "overlays" "packageSets" ])
# Filter out linuxPackages before it gets evaluated.
(if ! hasSuffix "linux" system
then filterAttrs (attr: drv: ! hasPrefix "linuxPackages" attr)
else id)
# Flatten package sets.
flattenTree
# Remove packages not compatible with this system.
(filterAttrs (attr: drv: drv ? meta.platforms -> builtins.elem system drv.meta.platforms))
]);
legacyPackages = genAttrs defaultSystems (system: (import ./. { pkgs = nixpkgs.legacyPackages.${system}; }));
nixosModules = mapAttrs (name: path: import path) (import ./modules);
overlays = {
pkgs = import ./pkgs/overlay.nix;
patches = import ./patches/overlay.nix;
};
overlay = final: prev:
nixpkgs.lib.composeExtensions self.overlays.pkgs self.overlays.patches final prev;
};
}