-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
72 lines (68 loc) · 2.51 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
{
description = "Trabalho de Admnistracao de Sistemas em Rede";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
home-manager.url = "github:nix-community/home-manager";
};
outputs = { self, nixpkgs, home-manager }@inputs:
let
linuxSystems = [ "x86_64-linux" "aarch64-linux" ];
darwinSystems = [ "x86_64-darwin" "aarch64-darwin" ];
mkApp = scriptName: system: {
type = "app";
program = "${(nixpkgs.legacyPackages.${system}.writeScriptBin scriptName ''
#!/usr/bin/env bash
PATH=${nixpkgs.legacyPackages.${system}.git}/bin:$PATH
echo "Running ${scriptName} for ${system}"
exec ${self}/apps/${system}/${scriptName}
'')}/bin/${scriptName}";
};
mkDarwinApps = system: {
"run" = mkApp "run" system;
};
mkLinuxApps = system: {
"run" = mkApp "run" system;
};
in
{
formatter = nixpkgs.lib.genAttrs (linuxSystems ++ darwinSystems) (system: nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
apps = nixpkgs.lib.genAttrs linuxSystems mkLinuxApps // nixpkgs.lib.genAttrs darwinSystems mkDarwinApps;
nixosConfigurations.vm =
nixpkgs.lib.genAttrs (darwinSystems ++ linuxSystems) (s:
let sys = if s == "aarch64-darwin" || s == "aarch64-linux" then "aarch64-linux" else "x86_64-linux"; in
nixpkgs.lib.nixosSystem {
system = sys;
specialArgs = inputs;
modules = [
home-manager.nixosModules.home-manager {
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users."guest" = import ./hosts/home.nix;
};
}
{
virtualisation = {
vmVariant.virtualisation = {
cores = 6;
memorySize = 8000;
graphics = false;
resolution = { x = 1900; y = 1200; };
host.pkgs = nixpkgs.legacyPackages.${s};
};
};
}
./hosts/system.nix
./containers/websites.nix # includes email server
./containers/log.nix
./containers/dns.nix
./containers/log.nix
./containers/proxy.nix
./containers/dhcp.nix
./containers/backup.nix
./containers/outside.nix
./containers/guest.nix
];
});
};
}