-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
executable file
·110 lines (109 loc) · 2.85 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
{
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
nixos-hardware = {
url = "github:NixOS/nixos-hardware/master";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
chaotic-nyx = {
url = "github:chaotic-cx/nyx/nyxpkgs-unstable";
inputs = {
nixpkgs.follows = "nixpkgs";
home-manager.follows = "home-manager";
};
};
};
outputs =
{
nixpkgs,
nixos-hardware,
home-manager,
sops-nix,
chaotic-nyx,
...
}@inputs:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
nixos-hardware = inputs.nixos-hardware.nixosModules;
home-manager = inputs.home-manager.nixosModules.home-manager;
sops-nix = inputs.sops-nix.nixosModules.sops;
chaotic-nyx = inputs.chaotic-nyx.nixosModules.default;
createSystem =
{
name,
config,
base,
home,
system,
extraModules,
}:
let
version = "25.05";
specialArgs = {
inherit
inputs
system
version
name
;
};
in
nixpkgs.lib.nixosSystem {
inherit specialArgs;
modules = [
base
system
config
home-manager
sops-nix
chaotic-nyx
{
imports = [ ./cachix.nix ];
home-manager = {
backupFileExtension = "bak";
extraSpecialArgs = specialArgs;
users.${name} = {
imports = [ home ];
home.stateVersion = version;
};
useGlobalPkgs = true;
useUserPackages = true;
};
}
] ++ extraModules;
};
in
{
# Set default formatter for `nix fmt`
formatter.${system} = pkgs.nixfmt-rfc-style;
# Declare system configurations
nixosConfigurations = {
"nyan" = createSystem {
name = "binary";
config = ./hosts/nyan/configuration.nix;
base = ./hosts/nyan/base.nix;
home = ./hosts/nyan/home.nix;
system = ./hosts/nyan/system.nix;
extraModules = [ nixos-hardware.framework-13-7040-amd ];
};
"binary" = createSystem {
name = "nyan";
config = ./hosts/binary/configuration.nix;
base = ./hosts/binary/base.nix;
home = ./hosts/binary/home.nix;
system = ./hosts/binary/system.nix;
extraModules = [ nixos-hardware.framework-16-7040-amd ];
};
};
};
}