-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
142 lines (131 loc) · 4.69 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
{
inputs = {
oldstable.url = "github:NixOS/nixpkgs/nixos-23.11";
stable.url = "github:NixOS/nixpkgs/nixos-24.05";
unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
untested.url = "github:NixOS/nixpkgs/master";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "stable";
darwin.url = "github:LnL7/nix-darwin";
darwin.inputs.nixpkgs.follows = "stable";
sops-nix.url = "github:Mic92/sops-nix";
sops-nix.inputs.nixpkgs.follows = "stable";
};
outputs = inputs@{self, darwin, home-manager, sops-nix, ...}:
let
machines = {
main = {
hostName = "nixos";
user = "one";
nixConfigRoot = "/etc/nixos";
system = "x86_64-linux";
};
macbook = {
hostName = "ncns-MacBook-Pro";
user = "ncn";
nixConfigRoot = "/Users/ncn/nix2";
system = "aarch64-darwin";
};
};
drives = {
shape = {
location = "/mnt/shape";
};
};
defineConfigBySystem = system:
let
passPksImportInput = { inherit system; config.allowUnfree = true; };
oldstable = import inputs.oldstable passPksImportInput;
stable = import inputs.stable passPksImportInput;
unstable = import inputs.unstable passPksImportInput;
untested = import inputs.untested passPksImportInput;
lib = inputs.stable.lib;
overrides = import ./helpers/apply-overrides.nix {packages = stable; lib = lib;};
imports = {inherit stable unstable untested overrides oldstable;};
mkShell = stable.mkShell;
devShellInputs = { inherit mkShell imports; };
in {
devShells = {
${system} = {
default = stable.mkShell { packages = [unstable.azure-functions-core-tools]; };
node = import ./dev-shells/node.nix devShellInputs;
py = import ./dev-shells/py.nix devShellInputs;
dotnet = import ./dev-shells/dotnet.nix devShellInputs;
dnrb = import ./dev-shells/dn-rb.nix devShellInputs;
rust = import ./dev-shells/rust.nix devShellInputs;
};
};
packages = {
azure = unstable.azure-functions-core-tools;
};
nixosConfigurations =
let
machine = machines.main;
packages = import ./modules/package-dump.nix { inherit imports machine lib; };
in {
${machine.hostName} = lib.nixosSystem {
specialArgs = {
inherit sops-nix imports drives machine;
};
modules = [
home-manager.nixosModules.home-manager
./modules/foundation.nix
./modules/foundation.main.nix
./modules/sops.nix
./modules/cli.nix
./modules/desktop.cinnamon.nix
./modules/vscode.nix
./modules/vm.nix
./modules/server.firewall.nix
./modules/server.plex.nix
./modules/server.syncthing.nix
./modules/server.tailscale.nix
./modules/server.vaultwarden.nix
./modules/server.caddy.nix
./modules/server.ssh.nix
./modules/server.calendar.nix
./modules/server.rclone.nix
./modules/server.logging.nix
./modules/play.nix
{
users.users.${machine.user}.packages =
packages.all
++ packages.work
++ packages.personal
++ packages.personalLinux
++ packages.experimenting;
}
];
};
};
darwinConfigurations =
let
machine = machines.macbook;
packages = import ./modules/package-dump.nix { inherit stable unstable lib; name = machine.user; };
in {
${machine.hostName} = darwin.lib.darwinSystem {
inherit system;
specialArgs = {
inherit self unstable stable machine;
name = machine.user;
};
modules = [
home-manager.darwinModules.home-manager
./modules/foundation.macbook.nix
./modules/cli.nix
./modules/vscode.nix
];
};
};
};
linux64Config = defineConfigBySystem "x86_64-linux";
macM1Config = defineConfigBySystem "aarch64-darwin";
final = {
eval = 2+2;
devShells = linux64Config.devShells // macM1Config.devShells;
nixosConfigurations = linux64Config.nixosConfigurations;
darwinConfigurations = macM1Config.darwinConfigurations;
packages = linux64Config.packages;
};
in final;
}