-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
93 lines (82 loc) · 2.92 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
{
description = "personal NixOS configuration";
inputs = {
dotfiles = {
url = "github:atar13/dotfiles";
# url = "file+file:///home/atarbinian/dotfiles";
flake = false;
};
dwm.url = "github:atar13/dwm";
dmenu.url = "github:atar13/dmenu";
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-old.url = "github:nixos/nixpkgs/nixos-23.05";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
agenix = {
url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs";
};
spicetify-nix.url = "github:the-argus/spicetify-nix";
compose2nix = {
url = "github:aksiksi/compose2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs @ { nixpkgs, nixpkgs-old, home-manager, nixos-hardware, ... }:
let
defaultUser = "atarbinian";
machines = [
{ name = "framework-16"; system = "x86_64-linux"; users = [ defaultUser ]; }
{ name = "envy"; system = "x86_64-linux"; users = [ defaultUser ]; }
{ name = "hopst-pi"; system = "aarch64-linux"; users = [ defaultUser ]; }
{ name = "bee-pi"; system = "x86_64-linux"; users = [ defaultUser ]; }
];
mkNixosConfig = machine:
let
pkgs = import nixpkgs {
system = machine.system;
config.allowUnfree = true;
config.segger-jlink.acceptLicense = true;
config.permittedInsecurePackages = [
"googleearth-pro-7.3.4.8248"
];
};
old-pkgs = import nixpkgs-old {
system = machine.system;
config.allowUnfree = true;
config.segger-jlink.acceptLicense = true;
config.permittedInsecurePackages = [
"electron-12.2.3"
];
};
config = config;
in
nixpkgs.lib.nixosSystem {
modules = [
inputs.agenix.nixosModules.default
({ config, lib, ... }:
(import ./hosts/${machine.name} { inherit lib config inputs pkgs old-pkgs nixos-hardware; hostname = machine.name; })
)
home-manager.nixosModules.home-manager
{
home-manager = {
users = builtins.listToAttrs (builtins.map
(username: {
name = username;
value = ({ config, lib, ... }:
import ./hosts/${machine.name}/home/${username} { inherit inputs config lib pkgs username; });
})
machine.users);
extraSpecialArgs = { nixosConfig = config; };
};
}
];
};
in
{
nixosConfigurations = builtins.listToAttrs (builtins.map (machine: { name = machine.name; value = (mkNixosConfig machine); }) machines);
};
}