-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
119 lines (103 loc) · 3.67 KB
/
flake.nix
File metadata and controls
119 lines (103 loc) · 3.67 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small";
utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, utils
, ...
}@inputs: utils.lib.eachDefaultSystem
(system:
let
base-pkgs = (import nixpkgs {
inherit system;
config.permittedInsecurePackages = [
# TODO: this is for haxe
"mbedtls2-no-checks-2.28.10"
];
});
common = base-pkgs.callPackage ./lib/common-nix { };
root-mod = { config, pkgs, ... }: {
options.nixpkgs.overlays = nixpkgs.lib.mkOption { default = [ ]; };
options.output = {
packfuncs = nixpkgs.lib.mkOption {
default = { };
type = with nixpkgs.lib.types; attrsOf (functionTo package);
};
packages = nixpkgs.lib.mkOption {
default = { };
type = with nixpkgs.lib.types; attrsOf package;
};
devShells = nixpkgs.lib.mkOption {
default = { };
type = with nixpkgs.lib.types; attrsOf package;
};
mzteinit = nixpkgs.lib.mkOption {
default = { };
type = with nixpkgs.lib.types; anything;
};
overlay = nixpkgs.lib.mkOption {
default = { };
type = with nixpkgs.lib.types; anything;
};
};
config._module.args = rec {
pkgs = base-pkgs.appendOverlays config.nixpkgs.overlays;
inherit inputs;
inherit system;
inherit (pkgs) lib stdenv stdenvNoCC;
};
# devshell for the dotfiles
config.output.devShells.default = nixpkgs.legacyPackages.${system}.mkShell {
buildInputs = with pkgs;
[
# packages required to build scripts
ddcutil # libddcutil for brightness script
gdk-pixbuf
gtk3.dev
libGL
libgit2
luajit
luajitPackages.luafilesystem
pkg-config
wayland
wayland-protocols
wayland-scanner
haxe
mpv-unwrapped
zig_0_15
] ++ (with pkgs.haskellPackages; [ ghc haskell-language-server ]);
};
config.nixpkgs.overlays = [
(final: prev: {
# Some test fail here. It's just a build dependency, so who cares.
# This is currently a transitive dependency through Haxe. They've upgraded upstream,
# but that hasn't made it to nixpkgs yet.
mbedtls_2 = prev.mbedtls_2.overrideAttrs {
pname = "mbedtls2-no-checks";
doCheck = false;
checkPhase = null;
};
})
];
config.output.mzteinit = base-pkgs.callPackage ./scripts/mzteinit/package.nix { };
config.output.packages = builtins.mapAttrs
(_: f: pkgs.callPackage f { })
config.output.packfuncs;
# TODO: This causes infinite recursion, but copying exactly the same code to the caller
# works. I call bullshit.
#config.output.overlay = final: prev: builtins.mapAttrs
# (_: f: final.callPackage f { })
# config.output.packfuncs;
};
modopt = nixpkgs.lib.evalModules {
modules = [ root-mod ./nix ] ++ common.localconf;
specialArgs = { inherit common; };
};
in
modopt.config.output // {
config = modopt;
}) // { nixosModules.default = ./nix/nixos; };
}