-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
117 lines (99 loc) · 3.19 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
{
description = "Fleetyards related nix config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
nix.url = "github:NixOS/nix";
colmena.url = "github:zhaofengli/colmena";
devenv = {
url = "github:cachix/devenv";
inputs.nixpkgs.follows = "/nixpkgs";
};
kloenk = {
url = "github:kloenk/nixfiles";
inputs.nixpkgs.follows = "/nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "/nixpkgs";
};
};
outputs =
inputs@{ self, nixpkgs, nix, colmena, devenv, kloenk, sops-nix, ... }:
let
overlayCombinded = system: [
(final: prev: { nix = nix.packages.${system}.nix; })
colmena.overlay
];
systems =
[ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
# Memoize nixpkgs for different platforms
nixpkgsFor = forAllSystems (system:
import nixpkgs {
inherit system;
overlays = (overlayCombinded system);
});
in {
legacyPackages = nixpkgsFor;
nixosConfigurations =
let hive = inputs.colmena.lib.makeHive self.outputs.colmena;
in hive.nodes;
nixosModules = { restic-backups = import ./modules/restic-backups.nix; };
colmena = {
meta = {
nixpkgs = import nixpkgs {
system = "aarch64-linux";
overlays = (overlayCombinded "aarch64-linux");
};
#nodeNixpkgs.social.nixpkgs = import nixpkgs {
# system = "aarch64-linux";
# overlays = (overlayCombinded "aaarch64-linux");
#};
specialArgs.inputs = inputs;
};
defaults = { pkgs, ... }: {
imports = [
./profiles/base
(kloenk + "/profiles/base/nixos")
(kloenk + "/profiles/users/kloenk")
./profiles/users/mortik
sops-nix.nixosModules.sops
kloenk.nixosModules.nftables
kloenk.nixosModules.helix
self.nixosModules.restic-backups
];
nix.channel.enable = false;
deployment = {
buildOnTarget = true;
allowLocalDeployment = true;
};
};
social = { pkgs, nodes, ... }: {
deployment = {
targetHost = "starcitizen.social";
tags = [ "hetzner" "remote" ];
};
imports = [ ./hosts/social ];
};
};
devShells = forAllSystems (system:
let pkgs = nixpkgsFor.${system};
in {
devenv = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({ pkgs, ... }: { packages = [ pkgs.colmena ]; })
{
languages.nix.enable = true;
pre-commit.hooks.actionlint.enable = true;
pre-commit.hooks.nixfmt.enable = true;
}
];
};
default = self.devShells.${system}.devenv;
});
formatter = forAllSystems (system: self.legacyPackages.${system}.nixfmt);
checks = forAllSystems
(system: { devenv = self.devShells.${system}.devenv.ci; });
};
}