-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
130 lines (117 loc) · 4.21 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
{
description = "MPyC flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
# nixpkgs.url = "github:nixos/nixpkgs/ac718d02867a84b42522a0ece52d841188208f2c";
flake-utils.url = "github:numtide/flake-utils/main";
poetry2nix = {
url = "github:nix-community/poetry2nix/master";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};
devenv.url = "github:cachix/devenv/python-rewrite";
devenv.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs-python.url = "github:cachix/nixpkgs-python";
# nixpkgs-python.inputs.nixpkgs.follows = "nixpkgs";
};
nixConfig = {
extra-substituters = [
"https://devenv.cachix.org"
"https://nixpkgs-python.cachix.org"
"https://cache.armv7l.xyz"
];
extra-trusted-public-keys = [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"nixpkgs-python.cachix.org-1:hxjI7pFxTyuTHn2NkvWCrAUcNZLNS3ZAvfYNuYifcEU="
"cache.armv7l.xyz-1:kBY/eGnBAYiqYfg0fy0inWhshUo+pGFM3Pj7kIkmlBk="
];
};
outputs = inputs @ {
self,
nixpkgs,
flake-utils,
devenv,
...
}:
{
colmena = self.packages.x86_64-linux.colmena;
}
// flake-utils.lib.eachSystem
(flake-utils.lib.defaultSystems ++ [flake-utils.lib.system.armv7l-linux])
(system: let
pkgs = import nixpkgs {
inherit system;
config = {
# allowUnsupportedSystem = true;
allowUnfree = true;
};
overlays = [
(self: super: {
mpyc-demo = import ./nix/mpyc-demo.nix super ./.;
pwnat = import ./nix/pwnat.nix super;
tailscale = import ./nix/tailscale.nix super;
# headscale = import ./nix/headscale.nix super;
natpunch = import ./nix/natpunch.nix super;
gole = import ./nix/gole.nix super;
go-stun = import ./nix/go-stun.nix super;
pion-stun = import ./nix/pion-stun.nix super;
pssh = import ./nix/pssh.nix super;
mkDockerImage = import ./nix/docker.nix self;
mkImageConfig = import ./nix/image.nix self;
lib =
super.lib
// {
recursiveMerge =
import ./nix/recursive-merge.nix {lib = super.lib;};
};
})
];
};
digitalOceanNodeConfig = pkgs.mkImageConfig {
imports = [
"${pkgs.path}/nixos/modules/virtualisation/digital-ocean-image.nix"
];
};
digitalOceanHeadscaleConfig =
pkgs.mkImageConfig (import ./nix/headscale-config.nix pkgs);
raspberryPi2Config = {config, ...}:
pkgs.mkImageConfig (import ./nix/rpi1.nix {inherit pkgs config;});
raspberryPi4Config = {config, ...}:
pkgs.mkImageConfig {
nixpkgs.system = "aarch64-linux";
imports = [
"${pkgs.path}/nixos/modules/installer/sd-card/sd-image-aarch64-installer.nix"
];
};
in {
# devShells.default = import ./nix/shell.nix pkgs;
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [(import ./nix/devenv.nix)];
};
packages.mpyc-demo = pkgs.mpyc-demo;
packages.colmena =
{
meta = {nixpkgs = pkgs;};
# rpi1 = raspberryPi2Config;
}
// builtins.mapAttrs (name: value: digitalOceanNodeConfig)
(builtins.fromJSON (builtins.readFile ./deployments/hosts-dns.json))
// builtins.mapAttrs (name: value: digitalOceanHeadscaleConfig)
(builtins.fromJSON
(builtins.readFile ./deployments/hosts-headscale-dns.json));
packages.digitalOceanImage =
(pkgs.nixos digitalOceanNodeConfig).digitalOceanImage;
packages.digitalOceanHeadscaleImage =
(pkgs.nixos digitalOceanHeadscaleConfig).digitalOceanImage;
# packages.raspberryPi2Image = (pkgs.nixos (raspberryPi2Config)).sdImage;
packages.raspberryPi2Image = pkgs.nixos raspberryPi2Config;
packages.raspberryPi4Image = (pkgs.nixos raspberryPi4Config).sdImage;
packages.dockerImage = pkgs.mkDockerImage {
inherit self;
name = "enikolov/mpyc-demo";
tag = "v0.0.5";
dir = ./.;
};
});
}