1
0
Fork 0
forked from pub-solar/infra
infra/flake.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

171 lines
5.2 KiB
Nix
Raw Normal View History

2023-07-30 14:50:11 +00:00
{
inputs = {
# Track channels with commits tested and built by hydra
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2023-07-30 14:50:11 +00:00
nix-darwin.url = "github:lnl7/nix-darwin/master";
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
home-manager.url = "github:nix-community/home-manager/release-24.05";
2023-07-30 14:50:11 +00:00
home-manager.inputs.nixpkgs.follows = "nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
2023-10-27 21:06:55 +00:00
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
2023-10-28 10:38:14 +00:00
disko.url = "github:nix-community/disko";
disko.inputs.nixpkgs.follows = "nixpkgs";
2023-10-28 10:38:14 +00:00
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.darwin.follows = "nix-darwin";
agenix.inputs.home-manager.follows = "home-manager";
2023-10-28 13:05:30 +00:00
keycloak-theme-pub-solar.url = "git+https://git.pub.solar/pub-solar/keycloak-theme?ref=main";
keycloak-theme-pub-solar.inputs.nixpkgs.follows = "nixpkgs";
2023-11-06 20:28:05 +00:00
2023-11-19 14:49:57 +00:00
element-themes.url = "github:aaronraimist/element-themes/master";
element-themes.flake = false;
2024-04-29 22:52:07 +00:00
maunium-stickerpicker.url = "github:maunium/stickerpicker?ref=master&dir=web";
maunium-stickerpicker.flake = false;
element-stickers.url = "git+https://git.pub.solar/pub-solar/maunium-stickerpicker-nix?ref=main";
element-stickers.inputs.maunium-stickerpicker.follows = "maunium-stickerpicker";
element-stickers.inputs.nixpkgs.follows = "nixpkgs";
2024-05-22 19:49:34 +00:00
simple-nixos-mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver/nixos-24.05";
simple-nixos-mailserver.inputs.nixpkgs-24_05.follows = "nixpkgs";
simple-nixos-mailserver.inputs.nixpkgs.follows = "unstable";
2023-07-30 14:50:11 +00:00
};
outputs =
inputs@{ self, ... }:
2023-07-30 14:50:11 +00:00
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
2023-10-28 11:48:56 +00:00
systems = [
"x86_64-linux"
"aarch64-linux"
];
2023-07-30 14:50:11 +00:00
imports = [
2024-04-03 18:54:40 +00:00
./logins
2023-10-27 21:06:55 +00:00
./lib
./overlays
./hosts
2023-07-30 14:50:11 +00:00
];
2023-10-28 10:38:14 +00:00
perSystem =
{
system,
pkgs,
config,
lib,
2023-10-28 10:38:14 +00:00
...
}:
{
_module.args = {
inherit inputs;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.agenix.overlays.default ];
2024-05-08 20:57:07 +00:00
};
2023-10-28 10:38:14 +00:00
unstable = import inputs.unstable { inherit system; };
master = import inputs.master { inherit system; };
2024-05-08 20:57:07 +00:00
};
checks =
let
nixos-lib = import (inputs.nixpkgs + "/nixos/lib") { };
testDir = builtins.attrNames (builtins.readDir ./tests);
testFiles = builtins.filter (n: builtins.match "^.*.nix$" n != null) testDir;
in
builtins.listToAttrs (
map (x: {
name = "test-${lib.strings.removeSuffix ".nix" x}";
value = nixos-lib.runTest (
import (./tests + "/${x}") {
inherit self;
inherit pkgs;
inherit lib;
inherit config;
}
);
}) testFiles
);
2023-10-28 10:38:14 +00:00
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
deploy-rs
nixpkgs-fmt
2024-05-08 20:57:07 +00:00
agenix
2024-04-03 18:54:40 +00:00
age-plugin-yubikey
2024-05-08 20:57:07 +00:00
cachix
2023-10-28 10:38:14 +00:00
editorconfig-checker
nodePackages.prettier
nvfetcher
shellcheck
2024-05-08 20:57:07 +00:00
shfmt
treefmt
2023-10-28 10:38:14 +00:00
nixos-generators
inputs.unstable.legacyPackages.${system}.opentofu
terraform-backend-git
2024-08-25 00:37:36 +00:00
terraform-ls
2024-05-08 20:57:07 +00:00
jq
2023-10-28 10:38:14 +00:00
];
};
2024-05-30 13:21:44 +00:00
devShells.ci = pkgs.mkShell { buildInputs = with pkgs; [ nodejs ]; };
2023-10-28 10:38:14 +00:00
};
2023-07-30 14:50:11 +00:00
flake =
let
2023-10-27 21:06:55 +00:00
username = "barkeeper";
in
{
inherit username;
2023-07-30 14:50:11 +00:00
2024-04-28 17:05:12 +00:00
nixosModules = builtins.listToAttrs (
map (x: {
name = x;
value = import (./modules + "/${x}");
}) (builtins.attrNames (builtins.readDir ./modules))
);
checks = builtins.mapAttrs (
system: deployLib: deployLib.deployChecks self.deploy
) inputs.deploy-rs.lib;
formatter."x86_64-linux" = inputs.unstable.legacyPackages."x86_64-linux".nixfmt-rfc-style;
2023-11-06 21:05:54 +00:00
deploy.nodes = self.lib.deploy.mkDeployNodes self.nixosConfigurations {
2023-10-27 21:06:55 +00:00
nachtigall = {
2024-06-06 10:50:24 +00:00
hostname = "nachtigall.wg.pub.solar";
2023-10-27 21:06:55 +00:00
sshUser = username;
2023-07-30 14:50:11 +00:00
};
2024-05-22 19:49:34 +00:00
metronom = {
2024-06-06 10:50:24 +00:00
hostname = "metronom.wg.pub.solar";
2024-05-22 19:49:34 +00:00
sshUser = username;
};
2024-05-29 12:08:59 +00:00
tankstelle = {
2024-06-06 10:50:24 +00:00
hostname = "tankstelle.wg.pub.solar";
2024-05-29 12:08:59 +00:00
sshUser = username;
};
trinkgenossin = {
hostname = "trinkgenossin.wg.pub.solar";
sshUser = username;
};
delite = {
hostname = "delite.wg.pub.solar";
sshUser = username;
};
blue-shell = {
hostname = "blue-shell.wg.pub.solar";
sshUser = username;
};
2023-07-30 14:50:11 +00:00
};
};
};
}