blob: 9143de710ee7319f7ea180317380e7283937935c (
plain)
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
|
{
inputs.devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.url = "nixpkgs";
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-trusted-substituters = "https://devenv.cachix.org";
};
outputs = {
self,
nur,
nixpkgs,
flake-parts,
devenv,
...
} @ inputs:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [flake-parts.flakeModules.easyOverlay devenv.flakeModule];
systems = [
"x86_64-linux"
"i686-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
flake = {
devenvModules.personal = import ./modules/devenv;
nixosModules.personal = import ./modules/nixos;
homeModules.personal = import ./modules/home-manager;
overlays.personal = _: super: let
my-packages = import ./pkgs (super.extend nur.overlay);
in {
inherit
(super.lib.recursiveUpdate super {
personal = my-packages;
lib.personal = my-packages.lib;
})
personal
lib
;
};
lib = import ./lib;
templates = let
welcomeText = ''
# `.devenv` should be added to `.gitignore`
```sh
echo .devenv >> .gitignore
```
'';
mkDevenvTemplate = path: {inherit welcomeText path;};
devenv = mkDevenvTemplate ./templates/devenv/simple;
devenvModular = mkDevenvTemplate ./templates/devenv/flake-parts;
in {
inherit devenv devenvModular;
default = devenv;
};
};
perSystem = {
config,
system,
pkgs,
lib,
...
}: let
flatten = let
aux = path: attrs:
if lib.isAttrs attrs && !lib.isDerivation attrs
then
lib.foldlAttrs
(prev: name: value: prev // aux (path ++ [name]) value) {}
attrs
else
(
if lib.isDerivation attrs
then {
"${lib.concatStringsSep "_" path}" = attrs;
}
else {}
);
in
aux [];
in {
_module.args.pkgs = import nixpkgs {
inherit system;
overlays = [self.overlays.personal];
config = {};
};
packages = flatten pkgs.personal;
devenv.shells.default = {
imports = [self.devenvModules.personal];
languages.nix = {
enable = true;
packaging.enable = true;
};
};
};
};
}
|