-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
121 lines (105 loc) · 3.8 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
{
description = "more modular configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
darwin.url = "github:lnl7/nix-darwin/master";
darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-24.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
devenv.url = "github:cachix/devenv";
devenv.inputs.nixpkgs.follows = "nixpkgs";
nixvim.url = "github:tstachl/mynixvim/master";
nixvim.inputs.nixpkgs.follows = "nixpkgs-unstable";
nix-bitcoin.url = "github:fort-nix/nix-bitcoin/release";
impermanence.url = "github:nix-community/impermanence";
sops-nix.url = "github:mic92/sops-nix";
};
outputs = { self, nixpkgs, darwin, devenv, ... }@inputs:
let
inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [
"aarch64-linux" "x86_64-linux" "aarch64-darwin" "x86_64-darwin"
];
in
{
lib = {
readSecret = (secret:
nixpkgs.lib.removeSuffix "\n"
(builtins.readFile "${self}/secrets/${secret}")
);
};
templates = {
rust-toolchain = {
path = ./templates/rust-toolchain;
description = "a rust toolchain template";
};
basic = {
path = ./templates/basic;
description = "a basic template to get started";
};
};
packages = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in import ./pkgs { inherit pkgs; } // {
simpleVM = self.nixosConfigurations.simple.config.system.build.vm;
odinSD = self.nixosConfigurations.odin-sdcard.config.system.build.sdImage;
odinImage = self.nixosConfigurations.odin-sdcard.config.system.build.diskoImagesScript;
}
);
overlays = import ./overlays { inherit inputs; };
nixosModules = import ./modules/nixos;
darwinModules = import ./modules/darwin;
homeManagerModules = import ./modules/home-manager;
nixosConfigurations = {
loki = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/loki ];
};
simple = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/simple ];
};
sting = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/sting ];
};
stingos-installer = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/sting/installer.nix ];
};
thor = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/thor ];
};
odin-sdcard = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/odin/sdcard.nix ];
};
};
darwinConfigurations = {
meili = darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = { inherit inputs; inherit outputs; };
modules = [ ./machines/meili ];
};
};
# homeConfigurations = {
# thomas = home-manager.lib.homeManagerConfiguration {
# inherit pkgs;
# extraSpecialArgs = { inherit inputs; inherit (self) outputs; };
# modules = [ ./users/thomas ];
# };
# };
devShells = forAllSystems(system:
let pkgs = nixpkgs.legacyPackages.${system};
in
{
default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [ ./devenv.nix ];
};
}
);
};
}