-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
65 lines (63 loc) · 1.68 KB
/
flake.nix
File metadata and controls
65 lines (63 loc) · 1.68 KB
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
{
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
archvsync = {
url = "github:LuNeder/archvsync-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
deploy-rs = {
url = "github:serokell/deploy-rs";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs@{ self, nixpkgs, deploy-rs, ... }: let
systems = ["x86_64-linux" "aarch64-linux"];
forAllSystems = nixpkgs.lib.genAttrs systems;
in {
nixosConfigurations = {
mirror = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./configuration.nix
inputs.disko.nixosModules.disko
];
specialArgs = {inherit inputs;};
};
};
deploy.nodes = let
activate = kind: config: deploy-rs.lib.${config.pkgs.system}.activate.${kind} config;
in {
mirror = {
hostname = "mirror.ufscar.br";
sshUser = "deploy";
activationTimeout = 600;
profiles.system = {
user = "root";
path = activate "nixos" self.outputs.nixosConfigurations.mirror;
};
};
};
apps = forAllSystems (system: rec {
deploy = {
type = "app";
program = let
pkgs = nixpkgs.legacyPackages.${system};
in pkgs.lib.getExe (pkgs.writeShellScriptBin "deploy" ''
export PATH="${pkgs.wstunnel}/bin:$PATH"
exec ${pkgs.deploy-rs}/bin/deploy "$@"
'');
};
default = deploy;
});
};
}