-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
135 lines (116 loc) · 4.53 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
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
{
description = "My systems";
inputs = {
nixpkgs.url = "nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixvim = {
url = "github:nix-community/nixvim/nixos-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nixgl.url = "github:nix-community/nixGL";
# For specific python packages, because sometimes installing
# via mise/asdf fails and it's just easier...
nixpkgs-python.url = "github:cachix/nixpkgs-python";
# For a rabbit hole: https://github.com/nix-community/NUR
# nurpkgs.url = "github:nix-community/NUR";
# Extra packages here (can't put these in another file, see
# https://github.com/NixOS/nix/issues/4945 for info)
ever-cyn.url = "github:Evertras/cynomys";
ever-quickview.url = "github:Evertras/quickview";
ever-fonts.url = "git+ssh://[email protected]/Evertras/nix-fonts";
};
outputs = { nixpkgs, nixpkgs-unstable, home-manager, nixvim, nixgl
, nixpkgs-python, ... }@inputs:
let
# Nix stuff
lib = nixpkgs.lib;
mkPkgs = system:
(import nixpkgs {
inherit system;
# Explicitly allow certain unfree software
config = {
allowUnfreePredicate = pkg:
builtins.elem (nixpkgs.lib.getName pkg) [
"discord"
"nvidia-settings"
"nvidia-x11"
"obsidian"
"steam"
"steam-original"
"steam-run"
"vagrant"
];
permittedInsecurePackages = [ "electron-25.9.0" ];
};
overlays = [
(_: _: {
cynomys = inputs.ever-cyn.packages.${system}.default;
quickview = inputs.ever-quickview.packages.${system}.default;
everfont-berkeley = inputs.ever-fonts.packages.${system}.berkeley;
everfont-berkeley-dashed =
inputs.ever-fonts.packages.${system}.berkeley-dashed;
# Version select with pythonversion."1.2.3"
pythonversion = nixpkgs-python.packages.${system};
# Allow access to some unstable packages for updates
unstable = import nixpkgs-unstable { inherit system; };
})
nixgl.overlay
];
});
# My stuff
everlib = import ./shared/everlib { inherit lib; };
mkNerdfonts = pkgs: (import ./shared/nerdfonts { inherit pkgs; });
# Helper to turn ./thing/someprofile.nix -> someprofile
nameFromNixFile = file: lib.strings.removeSuffix ".nix" (baseNameOf file);
in {
nixosConfigurations = let
# Make a system for every directory in ./system/machines
#
# Each subdirectory must contain a default.nix which
# has the "system" and "module" attributes, where "system"
# is the system to use and "module" is the home-manager
# module file to use (probably a home.nix in the directory)
machineDirs = everlib.allSubdirs ./system/machines;
mkConfig = dir:
(let
userData = import dir;
system = userData.system;
pkgs = mkPkgs system;
nerdfonts = mkNerdfonts pkgs;
in lib.nixosSystem {
inherit pkgs system;
modules = [ userData.module ];
specialArgs = { inherit everlib nerdfonts; };
});
in (builtins.listToAttrs (map (dir: {
name = builtins.baseNameOf dir;
value = mkConfig dir;
}) machineDirs));
homeConfigurations = let
# Make a profile for every subdir in ./home/users
#
# Each subdirectory must contain a default.nix which
# has the "system" and "module" attributes, where "system"
# is the system to use and "module" is the home-manager
# module file to use (probably a home.nix in the directory)
userDirs = everlib.allSubdirs ./home/users;
mkConfig = dir:
(let
userData = import dir;
pkgs = mkPkgs userData.system;
nerdfonts = mkNerdfonts pkgs;
in home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [ nixvim.homeManagerModules.nixvim userData.module ];
extraSpecialArgs = { inherit everlib nerdfonts; };
});
in (builtins.listToAttrs (map (file: {
name = nameFromNixFile file;
value = mkConfig file;
}) userDirs));
};
}