-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
95 lines (81 loc) · 2.78 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
{
description = "Configuration du nouveau serveur Monalisa";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
deploy-rs.url = "github:serokell/deploy-rs";
sops-nix.url = "github:Mic92/sops-nix";
};
outputs = inputs@{ self, nixpkgs, ... }: let
inherit (nixpkgs) lib;
monalisa-system = "x86_64-linux";
# Utility function from deploy-rs to create a NixOS deployment configuration
activateNixos = inputs.deploy-rs.lib."${monalisa-system}".activate.nixos;
pkgs' = system: nixpkgs: import nixpkgs {
system = system;
overlays = builtins.attrValues self.overlays;
config.allowUnfree = false;
};
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSystem = lib.genAttrs supportedSystems;
in {
overlays = {
our-packages = final: prev: {
cedille-mirror = prev.callPackage ./pkgs/cedille-mirror { };
ftpsync = prev.callPackage ./pkgs/ftpsync { };
};
};
packages = forEachSystem (x: with (pkgs' x nixpkgs); {
inherit cedille-mirror ftpsync;
});
nixosConfigurations = {
monalisa = lib.nixosSystem {
system = monalisa-system;
modules = [
./hosts/monalisa/configuration.nix
./hosts/monalisa/hardware-configuration.nix
./hosts/monalisa/users.nix
./hosts/monalisa/headless.nix
./hosts/monalisa/networking.nix
./hosts/monalisa/mirror.nix
./modules/mirror.nix
];
specialArgs = {
inherit (inputs) self;
inherit inputs;
};
pkgs = pkgs' monalisa-system nixpkgs;
};
};
deploy.nodes.monalisa-mirror = {
sshOpts = [ "-p" "22" ];
hostname = "mirror.monalisa.cedille.club";
# Whether the user will upload the locally built config remotely
# If set to false, the remote machine will download the required
# files from the list of substituers configured on the host
# (By default: cache.nixos.org)
fastConnection = false;
profilesOrder = [ "system" ];
# Definition of our system configuration for this node
profiles.system = {
sshUser = "automation";
# User to sudo into
user = "root";
path = activateNixos self.nixosConfigurations.monalisa;
};
};
devShell = forEachSystem (system: let
pkgs = pkgs' system inputs.nixpkgs;
pkgsUnstable = pkgs' system inputs.nixpkgs-unstable;
in pkgs.mkShell {
name = "mirror-nixos";
buildInputs = [
inputs.sops-nix.packages.${system}.sops-import-keys-hook
inputs.deploy-rs.defaultPackage.${system}
pkgs.sops
pkgs.nixfmt
pkgsUnstable.terraform_1_0
];
});
};
}