-
Notifications
You must be signed in to change notification settings - Fork 4
/
flake.nix
157 lines (136 loc) · 6.12 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# ▜███▙ ▜███▙ ▟███▛
# ▜███▙ ▜███▙▟███▛
# ▜███▙ ▜██████▛
# ▟█████████████████▙ ▜████▛ ▟▙
# ▟███████████████████▙ ▜███▙ ▟██▙
# ▄▄▄▄▖ ▜███▙ ▟███▛
# ▟███▛ ▜██▛ ▟███▛
# ▟███▛ ▜▛ ▟███▛
# ▟███████████▛ ▟██████████▙
# ▜██████████▛ ▟███████████▛
# ▟███▛ ▟▙ ▟███▛
# ▟███▛ ▟██▙ ▟███▛
# ▟███▛ ▜███▙ ▝▀▀▀▀
# ▜██▛ ▜███▙ ▜██████████████████▛
# ▜▛ ▟████▙ ▜████████████████▛
# ▟██████▙ ▜███▙
# ▟███▛▜███▙ ▜███▙
# ▟███▛ ▜███▙ ▜███▙
# ▝▀▀▀ ▀▀▀▀▘ ▀▀▀▘
#
# » Implemented devices:
# • momento → Live USB stick with configs for amnesiac + installs
#
# » Implemented machines:
# • gce → Google Compute Engine image for server
# • wsl → WSL on the daily driver.
#
# A fair bit of inspiration from github:srid/nixos-config
{
description = "⚫⚫⚫s on NixOS";
inputs = rec {
# To update nixpkgs (and thus NixOS), pick the nixos-unstable rev from
# https://status.nixos.org/
#
# This ensures that we always use the official nix cache.
# nixpkgs.url = "/home/user/src/nixpkgs-local?cache-bust=4";
# TODO: Change to patch system NixOs/nix/issues#3920
nixpkgs.url = github:nixos/nixpkgs/7e7c39ea35c5cdd002cd4588b03a3fb9ece6fad9;
nixos-hardware.url = github:NixOS/nixos-hardware;
# Really just to streamline deps.
systems.url = github:nix-systems/default;
flake-utils.url = github:numtide/flake-utils;
flake-utils.inputs.systems.follows = "systems";
# Build our own wsl
nixos-wsl.url = github:nix-community/NixOS-WSL;
nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";
nixos-wsl.inputs.flake-utils.follows = "flake-utils";
home-manager.url = github:nix-community/home-manager;
home-manager.inputs.nixpkgs.follows = "nixpkgs";
# TODO: Wait for internal submodules
# see: NixOS/nix/issues/5497
# You can set this to sensitive manually with /path?cache-bush=0 but cache
# invalidation is hard. Just increment/decrement around or run the fish
# command `unlock`, which will scrub flake.lock
# Alternatively pointing to spoof and overriding the flake seems to work
# best.
sensitive.url = "path:./nix/spoof";
sensitive.inputs.nixpkgs.follows = "nixpkgs";
# dots manager
dots-manager.url = "path:./dots-manager";
dots-manager.inputs.nixpkgs.follows = "nixpkgs";
dots-manager.inputs.flake-utils.follows = "flake-utils";
# Common Grub2 themes
grub2-themes.url = github:AnotherGroupChat/grub2-themes-png;
grub2-themes.inputs.nixpkgs.follows = "nixpkgs";
# Hyprland is **such** eye candy
hyprland.url = github:hyprwm/Hyprland/v0.41.2;
hyprland.inputs.nixpkgs.follows = "nixpkgs";
hyprland.inputs.systems.follows = "systems";
# Pretty spotify
spicetify-nix.url = github:the-argus/spicetify-nix;
spicetify-nix.inputs.nixpkgs.follows = "nixpkgs";
spicetify-nix.inputs.flake-utils.follows = "flake-utils";
# Cachix for caching!
declarative-cachix.url = "github:jonascarpay/declarative-cachix";
};
outputs = inputs@{ self, home-manager, nixpkgs, sensitive, dots-manager, ... }:
let
system = "x86_64-linux";
stateVersion = "24.05";
dots-manager-path = "${dots-manager.dots-manager."${system}"}/bin";
# Add nixpkgs overlays and config here. They apply to system and home-manager builds.
pkgs = import nixpkgs {
inherit system;
overlays = import ./nix/overlays.nix { inherit sensitive inputs; };
config.allowUnfree = sensitive.lib.sellout or false;
# allow X to be installed if you don't have unfree enabled already
# You may have to flush sensitive from lock for this to work with
# changes.
config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg)
(if sensitive.lib ? unfree then sensitive.lib.unfree else [ ]);
# Hopefully empty, but needed sometimes.
config.permittedInsecurePackages =
(if sensitive.lib ? insecure then sensitive.lib.insecure else [ ]);
# Does it work ?!
# Standard cache is NOT set.
# Maybe will finish compiling by the heat death of universe.
config.contentAddressedByDefault = false;
};
utils = import ./nix/utils.nix
{
inherit inputs self home-manager
nixpkgs sensitive system
pkgs stateVersion;
};
in
rec {
# The "name" in nixosConfigurations.${name} should match the `hostname`
#
nixosConfigurations =
{
gce = utils.mkComputer {
machineConfig = ./nix/machines/gce.nix;
};
momento = utils.mkComputer {
machineConfig = ./nix/machines/momento.nix;
wm = sensitive.lib.default_wm or "none";
userConfigs = [ ./nix/home/live.nix ];
};
wsl = utils.mkComputer {
machineConfig = ./nix/machines/wsl.nix;
isContainer = true;
};
};
# For standalone configurations
#
homeConfigurations = nixpkgs.lib.foldr (a: b: a // b) { } (map utils.mkHome [
"${sensitive.lib.user}"
]);
lib.utils = utils;
# Import some scripts!
} // (import ./scripts/scripts.nix {
inherit self nixpkgs pkgs sensitive
dots-manager-path;
});
}