-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
128 lines (124 loc) · 3.36 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
inputs.flake-compat.follows = "flake-compat";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
home-manager,
sops-nix,
deploy-rs,
...
}@inputs:
let
inherit (nixpkgs) lib;
inherit (flake-utils.lib) eachDefaultSystem mkApp;
systems = flake-utils.lib.system;
myPkgs = import ./packages;
in
eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
appPkgs =
(
if system == systems.x86_64-linux then
{
home-manager = home-manager.defaultPackage.${system};
}
else
{ }
)
// {
deploy = deploy-rs.defaultPackage.${system};
};
platformPackages = myPkgs.packages {
inherit pkgs inputs;
filterByPlatform = true;
};
shellPackages =
if system == systems.x86_64-linux then
platformPackages
else if system == systems.aarch64-linux then
lib.getAttrs [
"einat"
"kcptun"
"mosdns"
"rtl8152-led-ctrl"
"ubootNanopiR2s"
"vlmcsd"
] platformPackages
else
{ };
in
rec {
packages = platformPackages;
checks = platformPackages;
apps = builtins.mapAttrs (name: drv: mkApp { inherit name drv; }) appPkgs;
devShells.default = pkgs.mkShell {
buildInputs = builtins.filter (f: f != null) (
(builtins.attrValues shellPackages) ++ (builtins.attrValues appPkgs)
);
};
}
)
// {
overlays = myPkgs.overlays;
nixosModules = import ./modules;
homeConfigurations.eh5 = import ./homes/eh5 {
system = systems.x86_64-linux;
username = "eh5";
inherit
self
nixpkgs
home-manager
inputs
;
};
nixosConfigurations = {
nixos-r2s = import ./machines/r2s {
system = systems.aarch64-linux;
inherit self nixpkgs sops-nix;
};
nixos-srv-m = import ./machines/srv-m {
system = systems.x86_64-linux;
inherit self nixpkgs sops-nix;
};
};
deploy.nodes.r2s = with deploy-rs.lib.aarch64-linux; {
hostname = "r2s";
sshUser = "root";
fastConnection = true;
profiles.system.path = activate.nixos self.nixosConfigurations.nixos-r2s;
};
deploy.nodes.srv-m = with deploy-rs.lib.x86_64-linux; {
hostname = "srv-m";
sshUser = "root";
profiles.system.path = activate.nixos self.nixosConfigurations.nixos-srv-m;
};
};
}