infrastructure/flake.nix

159 lines
4.4 KiB
Nix
Raw Normal View History

2021-10-13 16:49:41 +02:00
{
2022-09-13 14:57:48 +02:00
description = "0x76's infrastructure";
2021-10-13 16:49:41 +02:00
2023-01-15 19:31:14 +01:00
# For minecraft use:
# * https://github.com/Infinidoge/nix-minecraft
2021-11-16 16:28:55 +01:00
inputs = {
2023-12-29 13:00:08 +01:00
nixpkgs.url = "nixpkgs/nixos-unstable";
2023-06-13 10:15:19 +02:00
nixpkgs_stable.url = "nixpkgs/nixos-23.05";
2024-01-03 12:06:11 +01:00
flake-utils-plus.url = "github:gytis-ivaskevicius/flake-utils-plus/v1.4.0";
2022-12-06 21:56:38 +01:00
nur.url = "github:nix-community/NUR";
2022-05-27 11:41:22 +02:00
colmena.url = "github:zhaofengli/colmena";
2023-12-29 17:35:24 +01:00
deploy.url = "github:serokell/deploy-rs";
2021-11-16 16:28:55 +01:00
vault-secrets.url = "github:serokell/vault-secrets";
2022-05-24 21:06:38 +02:00
2023-12-23 12:46:35 +01:00
microvm.url = "github:astro/microvm.nix";
2022-08-25 13:33:35 +02:00
home-manager.url = "github:nix-community/home-manager";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
2022-08-24 18:17:29 +02:00
2023-01-28 21:06:34 +01:00
riff.url = "github:DeterminateSystems/riff";
2022-09-10 19:49:04 +02:00
webcord.url = "github:fufexan/webcord-flake";
2022-09-21 18:00:51 +02:00
2022-09-26 13:52:32 +02:00
comma.url = "github:nix-community/comma";
2022-09-21 18:00:51 +02:00
mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver";
mailserver.inputs.nixpkgs.follows = "nixpkgs";
2022-10-08 16:34:25 +02:00
2023-02-21 11:15:03 +01:00
nixvim.url = "github:pta2002/nixvim";
2022-11-06 22:13:48 +01:00
2023-01-17 13:49:31 +01:00
nixos-generators.url = "github:nix-community/nixos-generators";
2023-02-24 15:00:58 +01:00
nixos-generators.inputs.nixpkgs.follows = "nixpkgs";
2022-11-29 09:48:23 +01:00
2023-09-01 21:06:09 +02:00
nixos-hardware.url = "github:nixos/nixos-hardware";
2023-04-28 15:55:06 +02:00
2023-05-30 08:41:42 +02:00
lanzaboote = {
url = "github:nix-community/lanzaboote";
# Optional but recommended to limit the size of your system closure.
inputs.nixpkgs.follows = "nixpkgs";
};
2023-04-28 15:55:06 +02:00
vault-unseal.url = "git+https://git.0x76.dev/v/vault-unseal.git";
2024-01-03 11:33:00 +01:00
gnome-autounlock-keyring.url =
"git+https://git.0x76.dev/v/gnome-autounlock-keyring.git";
2023-06-02 17:16:36 +02:00
attic.url = "github:zhaofengli/attic";
2023-12-28 18:45:12 +01:00
# Website(s)
essentials.url = "github:jdonszelmann/essentials";
2021-11-16 16:28:55 +01:00
};
2021-10-13 16:49:41 +02:00
2024-01-03 12:06:11 +01:00
outputs = { self, nixpkgs, nixpkgs_stable, flake-utils-plus, nur, attic
2024-01-03 17:01:29 +01:00
, deploy, home-manager, gnome-autounlock-keyring, lanzaboote, ... }@inputs:
2021-11-16 21:52:43 +01:00
let
2024-01-03 12:06:11 +01:00
# fast-repl = pkgs.writeShellScriptBin "fast-repl" ''
# source /etc/set-environment
# nix repl --file "${./.}/repl.nix" $@
# '';
pkgs = self.pkgs.x86_64-linux.nixpkgs;
in flake-utils-plus.lib.mkFlake {
# `self` and `inputs` arguments are required
inherit self inputs;
# Supported systems, used for packages, apps, devShell and multiple other definitions. Defaults to `flake-utils.lib.defaultSystems`.
supportedSystems = [ "x86_64-linux" ];
# Channels config
channelsConfig = { allowUnfree = true; };
2024-01-03 15:50:11 +01:00
sharedOverlays = [ (import ./pkgs) nur.overlay ];
2024-01-03 12:06:11 +01:00
# host defaults
hostDefaults = {
system = "x86_64-linux";
modules = [
home-manager.nixosModules.home-manager
2024-01-03 15:49:32 +01:00
gnome-autounlock-keyring.nixosModules.default
2024-01-03 12:06:11 +01:00
./common
];
2024-01-03 17:01:29 +01:00
specialArgs = { inherit inputs; };
2022-10-30 11:43:52 +01:00
};
2022-08-21 12:01:19 +02:00
2024-01-03 12:06:11 +01:00
# hosts
2024-01-03 17:01:29 +01:00
hosts = {
"bastion.olympus" = {
modules = [ ./common/generic-vm.nix ./hosts/olympus/bastion ];
};
2023-01-15 13:34:09 +01:00
2024-01-03 17:01:29 +01:00
aoife = {
modules =
[ lanzaboote.nixosModules.lanzaboote ./hosts/thalassa/aoife ];
};
2024-01-03 11:33:00 +01:00
};
2024-01-03 12:06:11 +01:00
# deploy-rs
2024-01-03 11:33:00 +01:00
deploy = {
user = "root";
2024-01-03 17:01:29 +01:00
nodes = {
"bastion.olympus" = {
hostname = "olympus.0x76.dev";
fastConnection = true;
remoteBuild = true;
profiles = {
system = {
path = deploy.lib.x86_64-linux.activate.nixos
self.nixosConfigurations."bastion.olympus";
};
2024-01-03 11:33:00 +01:00
};
};
2024-01-03 17:01:29 +01:00
aoife = {
remoteBuild = true;
fastConnection = true;
hostname = "localhost";
profiles.system.path = deploy.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.aoife;
};
2023-12-18 15:49:08 +01:00
};
2022-09-13 14:57:48 +02:00
};
2022-08-21 12:01:19 +02:00
2024-01-03 12:06:11 +01:00
# Outputs
outputsBuilder = channels: {
2024-01-03 15:49:32 +01:00
devShells.default = channels.nixpkgs.mkShell {
2024-01-03 12:06:11 +01:00
name = "devShell";
VAULT_ADDR = "http://vault.olympus:8200/";
packages = with pkgs; [
attic.packages.${pkgs.system}.attic
# apply-local
deploy.packages.${system}.deploy-rs
deadnix
statix
# nixfmt
# nixpkgs-fmt
nixUnstable
# nil
vault
yamllint
jq
# (vault-push-approle-envs self { })
# (vault-push-approles self { })
# fast-repl
fup-repl
];
};
};
# Checks
2024-01-03 11:33:00 +01:00
checks = builtins.mapAttrs
(system: deployLib: deployLib.deployChecks self.deploy) deploy.lib;
2021-11-16 16:28:55 +01:00
};
2024-01-03 12:06:11 +01:00
2021-10-13 16:49:41 +02:00
}