blob: 764279dd860e62b90d1ebf6ea4aeceeaaa20e453 (
plain) (
blame)
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# This holds configuration common across hosts
{
inputs,
outputs,
lib,
config,
pkgs,
...
}: {
# You can import other NixOS modules here
imports = [
inputs.home-manager.nixosModules.home-manager
inputs.impermanence.nixosModules.impermanence
./sops.nix
];
#home-manager.useGlobalPkgs = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = {
inherit inputs outputs;
};
nixpkgs = {
# You can add overlays here
overlays = [
# Add overlays your own flake exports (from overlays and pkgs dir):
outputs.overlays.additions
# outputs.overlays.modifications
outputs.overlays.stable-packages
# You can also add overlays exported from other flakes:
# neovim-nightly-overlay.overlays.default
# Or define it inline, for example:
# (final: prev: {
# hi = final.hello.overrideAttrs (oldAttrs: {
# patches = [ ./change-hello-to-hi.patch ];
# });
# })
];
config = {
allowUnfree = true;
};
};
nix = let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in {
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes ca-derivations";
accept-flake-config = true;
# Opinionated: disable global registry
flake-registry = "";
# Workaround for https://github.com/NixOS/nix/issues/9574
nix-path = config.nix.nixPath;
substituters = [
"https://cache.nixos.org/"
];
trusted-substituters = [
"https://cache.nixos.org"
"https://nixpkgs-ruby.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nixpkgs-ruby.cachix.org-1:vrcdi50fTolOxWCZZkw0jakOnUI1T19oYJ+PRYdK4SM="
];
};
gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
};
# Opinionated: disable channels
channel.enable = false;
# Opinionated: make flake registry and nix path match flake inputs
registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
time.timeZone = "America/Los_Angeles";
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "emacs2";
};
programs = {
sway.enable = true;
zsh.enable = true;
git.enable = true;
fuse.userAllowOther = true;
};
users.mutableUsers = false;
users.users.sadbeast = {
hashedPasswordFile = config.sops.secrets.sadbeast-password.path;
isNormalUser = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGpEusv/bS34Q1JQxZXikdcwnq1vToz2d+HgV+E8NRX"
];
extraGroups = ["wheel" "audio" "video" "docker"];
shell = pkgs.zsh;
packages = [pkgs.home-manager];
};
sops.secrets.sadbeast-password = {
sopsFile = ../secrets.yaml;
neededForUsers = true;
};
home-manager.users.sadbeast = import ../../../home/sadbeast/${config.networking.hostName}.nix;
services = {
avahi = {
enable = true;
nssmdns4 = true;
openFirewall = true;
};
openssh = {
enable = true;
settings = {
# Opinionated: forbid root login through SSH.
PermitRootLogin = "no";
# Opinionated: use keys only.
PasswordAuthentication = false;
X11Forwarding = true;
};
};
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
printing.enable = true;
};
security = {
polkit.enable = true;
# rtkit is optional but recommended
rtkit.enable = true;
sudo.wheelNeedsPassword = false;
pam.services = {
swaylock = {};
};
};
# environment.persistence."/persistent" = {
# hideMounts = true;
# directories = [
# "/var/log"
# "/var/lib/nixos"
# "/var/lib/systemd"
# ];
# files = [
# "/etc/machine-id"
# "/var/lib/sops-nix/keys.txt"
# ];
# };
# system.activationScripts.persistent-dirs.text = let
# mkHomePersist = user:
# lib.optionalString user.createHome ''
# mkdir -p /persistent/${user.home}
# chown ${user.name}:${user.group} /persistent/${user.home}
# chmod ${user.homeMode} /persistent/${user.home}
# '';
# users = lib.attrValues config.users.users;
# in
# lib.concatLines (map mkHomePersist users);
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "24.11";
}
|