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-06-26 16:36:35 +02:00
|
|
|
nixpkgs.url = "nixpkgs/nixos-unstable-small";
|
2023-05-09 09:33:28 +02:00
|
|
|
|
2023-06-13 10:15:19 +02:00
|
|
|
nixpkgs_stable.url = "nixpkgs/nixos-23.05";
|
2022-06-12 12:25:46 +02:00
|
|
|
|
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";
|
2022-06-12 12:25:46 +02:00
|
|
|
|
2021-11-16 16:28:55 +01:00
|
|
|
vault-secrets.url = "github:serokell/vault-secrets";
|
2022-05-24 21:06:38 +02:00
|
|
|
|
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-03-25 13:07:28 +01:00
|
|
|
nixos-hardware.url = "github:toastal/nixos-hardware/z-series-no-hidpi";
|
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";
|
2023-06-02 17:16:36 +02:00
|
|
|
|
|
|
|
attic.url = "github:zhaofengli/attic";
|
2021-11-16 16:28:55 +01:00
|
|
|
};
|
2021-10-13 16:49:41 +02:00
|
|
|
|
2023-06-13 10:15:19 +02:00
|
|
|
outputs = { self, nixpkgs, nixpkgs_stable, vault-secrets, colmena
|
2023-06-05 10:20:08 +02:00
|
|
|
, nixos-generators, nur, attic, ... }@inputs:
|
2021-11-16 21:52:43 +01:00
|
|
|
let
|
2021-11-21 15:50:29 +01:00
|
|
|
inherit (nixpkgs) lib;
|
2022-08-21 11:42:17 +02:00
|
|
|
|
2022-10-08 16:34:25 +02:00
|
|
|
util = import ./nixos/util.nix inputs;
|
2023-05-04 15:14:36 +02:00
|
|
|
inherit (util) hosts flat_hosts nixHosts;
|
2022-08-21 11:42:17 +02:00
|
|
|
|
2021-11-16 21:52:43 +01:00
|
|
|
system = "x86_64-linux";
|
2022-08-21 11:42:17 +02:00
|
|
|
|
2022-10-30 11:43:52 +01:00
|
|
|
pkgs = import nixpkgs {
|
|
|
|
inherit system;
|
2023-05-24 16:58:51 +02:00
|
|
|
config.allowUnfree = true;
|
2023-05-03 16:52:43 +02:00
|
|
|
overlays = [ (import ./nixos/pkgs) vault-secrets.overlay nur.overlay ];
|
2022-10-30 11:43:52 +01:00
|
|
|
};
|
2022-08-21 12:01:19 +02:00
|
|
|
|
2023-06-13 10:15:19 +02:00
|
|
|
pkgs_stable = import nixpkgs_stable {
|
2023-01-15 13:34:09 +01:00
|
|
|
inherit system;
|
|
|
|
config.allowUnfree = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
# Define args each module gets access to (access to hosts is useful for DNS/DHCP)
|
2023-06-13 10:15:19 +02:00
|
|
|
specialArgs = { inherit hosts flat_hosts inputs pkgs_stable; };
|
2023-01-15 13:34:09 +01:00
|
|
|
|
2022-08-21 12:01:19 +02:00
|
|
|
# Script to apply local colmena deployments
|
2022-11-06 13:04:41 +01:00
|
|
|
apply-local = pkgs.writeShellScriptBin "apply-local" ''
|
2022-10-15 13:44:27 +02:00
|
|
|
"${
|
|
|
|
colmena.packages.${system}.colmena
|
2023-06-07 14:03:42 +02:00
|
|
|
}"/bin/colmena apply-local --sudo $@
|
2022-08-21 12:01:19 +02:00
|
|
|
'';
|
2022-11-06 13:04:41 +01:00
|
|
|
|
|
|
|
fast-repl = pkgs.writeShellScriptBin "fast-repl" ''
|
|
|
|
source /etc/set-environment
|
|
|
|
nix repl --file "${./.}/repl.nix" $@
|
|
|
|
'';
|
2023-05-31 16:45:10 +02:00
|
|
|
in {
|
2023-04-29 15:25:11 +02:00
|
|
|
# Make the nixosConfigurations for compat reasons (e.g. vault)
|
2022-10-15 13:44:27 +02:00
|
|
|
nixosConfigurations =
|
|
|
|
(import (inputs.colmena + "/src/nix/hive/eval.nix") {
|
|
|
|
rawFlake = self;
|
|
|
|
colmenaOptions =
|
|
|
|
import (inputs.colmena + "/src/nix/hive/options.nix");
|
|
|
|
colmenaModules =
|
|
|
|
import (inputs.colmena + "/src/nix/hive/modules.nix");
|
|
|
|
}).nodes;
|
2022-07-30 16:42:46 +02:00
|
|
|
|
2022-10-08 12:53:14 +02:00
|
|
|
# Make the colmena configuration
|
2023-05-31 16:45:10 +02:00
|
|
|
colmena = lib.foldr (el: acc: acc // util.mkColmenaHost el) {
|
|
|
|
meta = {
|
|
|
|
inherit specialArgs;
|
|
|
|
nixpkgs = pkgs;
|
|
|
|
};
|
|
|
|
} nixHosts;
|
2022-06-12 17:06:32 +02:00
|
|
|
|
2022-09-13 14:57:48 +02:00
|
|
|
packages.${system} = {
|
2022-10-15 13:44:27 +02:00
|
|
|
inherit apply-local;
|
2022-10-30 11:43:52 +01:00
|
|
|
|
2022-09-13 14:57:48 +02:00
|
|
|
default = colmena.packages.${system}.colmena;
|
2022-10-08 16:34:25 +02:00
|
|
|
|
2023-02-14 10:59:38 +01:00
|
|
|
proxmox-lxc = nixos-generators.nixosGenerate {
|
2023-05-31 16:45:10 +02:00
|
|
|
inherit system pkgs specialArgs;
|
2023-02-14 10:59:38 +01:00
|
|
|
format = "proxmox-lxc";
|
2023-04-28 16:24:00 +02:00
|
|
|
modules = util.base_imports
|
2023-04-28 10:28:06 +02:00
|
|
|
++ [ (import ./nixos/templates/proxmox-lxc.nix) ];
|
2023-02-14 10:59:38 +01:00
|
|
|
};
|
2023-02-04 16:40:01 +01:00
|
|
|
|
2023-05-12 15:00:03 +02:00
|
|
|
# Broken
|
|
|
|
# proxmox-vm = nixos-generators.nixosGenerate {
|
2023-05-31 16:45:10 +02:00
|
|
|
# inherit system pkgs specialArgs;
|
2023-05-12 15:00:03 +02:00
|
|
|
# format = "proxmox";
|
|
|
|
# modules = util.base_imports
|
|
|
|
# ++ [ (import ./nixos/templates/proxmox-vm.nix) ];
|
|
|
|
# };
|
2022-09-13 14:57:48 +02:00
|
|
|
};
|
2022-08-21 12:01:19 +02:00
|
|
|
|
2021-11-16 21:52:43 +01:00
|
|
|
# Use by running `nix develop`
|
2022-07-30 18:02:40 +02:00
|
|
|
devShells.${system}.default = pkgs.mkShell {
|
2021-11-23 17:44:00 +01:00
|
|
|
VAULT_ADDR = "http://vault.olympus:8200/";
|
2022-08-21 12:01:19 +02:00
|
|
|
buildInputs = with pkgs; [
|
2023-06-05 10:20:08 +02:00
|
|
|
attic.packages.${pkgs.system}.attic
|
2022-08-21 12:01:19 +02:00
|
|
|
apply-local
|
2022-09-13 14:43:23 +02:00
|
|
|
colmena.packages.${system}.colmena
|
2022-10-02 20:51:08 +02:00
|
|
|
cachix
|
2023-05-04 15:14:36 +02:00
|
|
|
deadnix
|
2021-11-21 15:50:29 +01:00
|
|
|
fluxcd
|
|
|
|
k9s
|
|
|
|
kubectl
|
|
|
|
kubectx
|
2022-12-02 12:18:21 +01:00
|
|
|
statix
|
2021-11-21 16:32:30 +01:00
|
|
|
terraform
|
2021-11-21 15:50:29 +01:00
|
|
|
nixfmt
|
|
|
|
nixUnstable
|
2023-01-21 12:32:47 +01:00
|
|
|
nil
|
2021-11-21 15:50:29 +01:00
|
|
|
vault
|
2023-05-18 15:04:23 +02:00
|
|
|
yamllint
|
2023-05-24 16:58:51 +02:00
|
|
|
jq
|
2022-10-15 13:44:27 +02:00
|
|
|
(vault-push-approle-envs self { })
|
|
|
|
(vault-push-approles self { })
|
2022-11-06 13:04:41 +01:00
|
|
|
fast-repl
|
2023-06-20 11:20:10 +02:00
|
|
|
weave-gitops
|
2021-11-16 16:28:55 +01:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
2021-10-13 16:49:41 +02:00
|
|
|
}
|