2023-06-11 23:09:59 +02:00
|
|
|
# SPDX-FileCopyrightText: 2022 Richard Brežák <richard@brezak.sk>
|
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
2023-07-10 23:35:56 +02:00
|
|
|
nixpkgs-hashicorp.url = "github:NixOS/nixpkgs?ref=nixos-unstable";
|
2023-06-11 23:09:59 +02:00
|
|
|
nixinate.url = "github:MagicRB/nixinate";
|
|
|
|
home-manager.url = "github:nix-community/home-manager?ref=master";
|
|
|
|
nixng.url = "github:nix-community/NixNG";
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
|
|
nil.url = "github:oxalica/nil";
|
2023-06-19 01:14:39 +02:00
|
|
|
uterranix.url = "sourcehut:~magic_rb/uterranix";
|
2023-06-11 23:09:59 +02:00
|
|
|
dwarffs.url = "github:edolstra/dwarffs";
|
2023-07-27 20:57:26 +02:00
|
|
|
haskell-nix.url = "github:input-output-hk/haskell.nix";
|
|
|
|
serokell-nix.url = "github:magicrb/serokell.nix";
|
|
|
|
serokell-nix.inputs.haskell-nix.follows = "haskell-nix";
|
2023-07-10 21:31:17 +02:00
|
|
|
website.url = "sourcehut:~magic_rb/website";
|
2023-06-11 23:09:59 +02:00
|
|
|
|
2023-06-28 14:17:17 +02:00
|
|
|
disko.url = "github:nix-community/disko";
|
|
|
|
nixos-anywhere.url = "github:numtide/nixos-anywhere";
|
|
|
|
|
2023-06-11 23:09:59 +02:00
|
|
|
tuxedo-rs.url = "github:AaronErhardt/tuxedo-rs";
|
|
|
|
tuxedo-rs.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
tuxedo-nixos.url = "github:blitz/tuxedo-nixos";
|
|
|
|
tuxedo-nixos.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
emacs.url = "sourcehut:~magic_rb/emacs";
|
|
|
|
emacs.flake = false;
|
|
|
|
|
|
|
|
vtermModule.url = "github:akermu/emacs-libvterm";
|
|
|
|
vtermModule.flake = false;
|
|
|
|
|
2023-06-18 20:12:05 +02:00
|
|
|
secret.url = "path:///home/main/dotfiles2/secret";
|
2023-06-11 23:09:59 +02:00
|
|
|
secret.flake = false;
|
|
|
|
|
|
|
|
ical2org.url = "git+https://git.sr.ht/~magic_rb/ical2orgpy";
|
|
|
|
ical2org.flake = false;
|
|
|
|
|
|
|
|
udp-over-tcp.url = "github:mullvad/udp-over-tcp";
|
|
|
|
udp-over-tcp.flake = false;
|
|
|
|
};
|
|
|
|
|
2023-06-18 20:07:47 +02:00
|
|
|
outputs = inputs@{ flake-parts, self, secret, ... }:
|
|
|
|
flake-parts.lib.mkFlake { inherit inputs; } ({ config, lib', ... }: {
|
2023-06-11 23:09:59 +02:00
|
|
|
imports = [
|
2023-06-13 23:00:56 +02:00
|
|
|
modules/nixngConfigurations.nix
|
2023-06-18 20:07:47 +02:00
|
|
|
modules/lib_overlays.nix
|
|
|
|
lib/load_secrets.nix
|
2023-06-13 23:00:56 +02:00
|
|
|
|
2023-06-11 23:09:59 +02:00
|
|
|
nixos/systems/omen
|
|
|
|
nixos/systems/heater
|
|
|
|
nixos/systems/toothpick
|
|
|
|
nixos/systems/liveusb
|
2023-06-12 23:25:40 +02:00
|
|
|
nixos/systems/blowhole
|
2023-06-28 14:17:17 +02:00
|
|
|
nixos/systems/altra
|
2023-07-18 20:40:57 +02:00
|
|
|
nixos/systems/gooseberry
|
2023-06-11 23:09:59 +02:00
|
|
|
|
2023-06-13 23:06:10 +02:00
|
|
|
nixng/containers/ingress-blowhole
|
2023-06-19 01:19:55 +02:00
|
|
|
nixng/containers/ingress-toothpick
|
2023-06-13 23:05:35 +02:00
|
|
|
nixng/containers/matrix/mautrix-signal
|
|
|
|
nixng/containers/matrix/mautrix-discord
|
|
|
|
nixng/containers/matrix/mautrix-facebook
|
|
|
|
nixng/containers/matrix/heisenbridge
|
|
|
|
nixng/containers/matrix/synapse
|
2023-06-13 23:05:08 +02:00
|
|
|
nixng/containers/website
|
2023-06-13 23:07:02 +02:00
|
|
|
nixng/containers/home-assistant
|
2023-06-13 23:05:53 +02:00
|
|
|
nixng/containers/email/getmail
|
|
|
|
nixng/containers/email/dovecot.nix
|
|
|
|
nixng/containers/email/postfix
|
2023-06-13 23:04:43 +02:00
|
|
|
nixng/containers/ds3os
|
2023-06-13 23:07:18 +02:00
|
|
|
nixng/containers/gitea
|
2023-06-13 23:07:31 +02:00
|
|
|
nixng/containers/hydra
|
2023-06-13 23:06:34 +02:00
|
|
|
nixng/containers/syncthing
|
2023-07-18 23:11:45 +02:00
|
|
|
nixng/containers/minecraft/vanilla
|
|
|
|
nixng/containers/minecraft/ftb-infinity
|
2023-07-20 12:52:48 +02:00
|
|
|
nixng/containers/minecraft/ftb-integrations
|
2023-06-13 23:06:34 +02:00
|
|
|
|
2023-06-11 23:09:59 +02:00
|
|
|
overlays/udp-over-tcp.nix
|
|
|
|
overlays/emacsclient-remote
|
|
|
|
overlays/magic-screenshot
|
|
|
|
overlays/emacs-rofi
|
|
|
|
overlays/tree-sitter-grammars.nix
|
|
|
|
overlays/emacs-master-nativecomp
|
2023-06-12 23:25:40 +02:00
|
|
|
overlays/zfs-relmount
|
|
|
|
overlays/ical2org.nix
|
2023-06-13 23:01:25 +02:00
|
|
|
overlays/mautrix-discord.nix
|
2023-06-13 23:03:01 +02:00
|
|
|
overlays/getmail6
|
2023-06-13 23:02:11 +02:00
|
|
|
overlays/maildrop
|
2023-06-13 23:03:45 +02:00
|
|
|
overlays/courier-unicode.nix
|
2023-06-13 23:04:10 +02:00
|
|
|
overlays/ds3os.nix
|
2023-06-14 12:27:08 +02:00
|
|
|
overlays/terraform-provider-vault.nix
|
2023-06-14 12:22:27 +02:00
|
|
|
overlays/terraform-provider-influxdb-v2.nix
|
2023-06-15 23:02:23 +02:00
|
|
|
overlays/bootloadHID.nix
|
2023-06-15 23:04:14 +02:00
|
|
|
|
|
|
|
inputs.uterranix.flakeModule
|
|
|
|
];
|
|
|
|
|
2023-06-18 20:07:47 +02:00
|
|
|
_module.args.lib' =
|
|
|
|
let
|
|
|
|
inherit (inputs.nixpkgs) lib;
|
|
|
|
inherit (inputs.nixpkgs.lib)
|
|
|
|
extend;
|
|
|
|
in
|
|
|
|
lib.foldl (acc: x: acc.extend x) lib (with config.flake.libOverlays; [
|
|
|
|
loadSecrets
|
|
|
|
]);
|
|
|
|
|
2023-06-16 16:43:11 +02:00
|
|
|
flake.hydraJobs =
|
|
|
|
let
|
2023-06-18 20:07:47 +02:00
|
|
|
inherit (lib')
|
2023-06-16 16:43:11 +02:00
|
|
|
mapAttrs;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixng = mapAttrs (_: v: v.config.system.build.toplevel) config.flake.nixngConfigurations;
|
|
|
|
nixos = mapAttrs (_: v: v.config.system.build.toplevel) config.flake.nixosConfigurations;
|
|
|
|
};
|
|
|
|
|
2023-06-15 23:04:14 +02:00
|
|
|
uterranix.config = [
|
|
|
|
./terranix/default.nix
|
|
|
|
{
|
2023-06-18 20:12:05 +02:00
|
|
|
_module.args.secret = lib'.loadSecrets secret;
|
2023-06-15 23:04:14 +02:00
|
|
|
_module.args.vars = {
|
2023-06-22 23:25:09 +02:00
|
|
|
flake_rev = self.rev or (lib'.warn "No flake revision available, do not deploy containers!" "");
|
|
|
|
flake_sha = self.narHash or (lib'.warn "No flake nar hash available, do not deploy containers!" "");
|
2023-06-18 20:12:05 +02:00
|
|
|
flake_ref = "master";
|
2023-06-19 00:53:38 +02:00
|
|
|
flake_host = "git+https://git.sr.ht/~magic_rb/dotfiles-2.0";
|
2023-06-15 23:04:14 +02:00
|
|
|
};
|
2023-06-29 19:11:39 +02:00
|
|
|
_module.args.config' = config;
|
2023-06-15 23:04:14 +02:00
|
|
|
}
|
2023-06-11 23:09:59 +02:00
|
|
|
];
|
|
|
|
|
2023-06-15 23:04:14 +02:00
|
|
|
uterranix.terraform = pkgs:
|
|
|
|
let
|
|
|
|
hpkgs = inputs.nixpkgs.legacyPackages.${pkgs.stdenv.system}.appendOverlays (with config.flake.overlays; [
|
|
|
|
terraform-provider-vault
|
|
|
|
terraform-provider-influxdb-v2
|
|
|
|
]);
|
|
|
|
in
|
|
|
|
hpkgs.terraform.withPlugins (p: [
|
|
|
|
p.consul
|
|
|
|
p.nomad
|
|
|
|
p.local
|
|
|
|
p.vault
|
|
|
|
p.random
|
|
|
|
p.null
|
|
|
|
p.influxdb-v2
|
2023-06-22 23:25:39 +02:00
|
|
|
p.hcloud
|
2023-06-15 23:04:14 +02:00
|
|
|
] );
|
|
|
|
|
2023-06-11 23:09:59 +02:00
|
|
|
flake.nixosModules = {
|
|
|
|
hashicorp = nixos/modules/hashicorp.nix;
|
2023-06-12 23:25:40 +02:00
|
|
|
hashicorp-envoy = nixos/modules/hashicorp-envoy.nix;
|
|
|
|
telegraf = nixos/modules/telegraf.nix;
|
|
|
|
grafana = nixos/modules/grafana.nix;
|
2023-06-11 23:09:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
flake.apps = inputs.nixpkgs.lib.genAttrs config.systems (system: {
|
2023-06-28 14:17:17 +02:00
|
|
|
nixos-anywhere.program = (inputs.nixos-anywhere.packages.${system}.nixos-anywhere);
|
|
|
|
nixos-anywhere.type = "app";
|
2023-06-11 23:09:59 +02:00
|
|
|
});
|
|
|
|
|
2023-06-16 16:40:38 +02:00
|
|
|
perSystem = { system, pkgs, ... }:
|
|
|
|
{
|
2023-06-16 16:42:40 +02:00
|
|
|
packages =
|
|
|
|
let
|
2023-06-18 20:07:47 +02:00
|
|
|
inherit (lib')
|
2023-06-16 16:42:40 +02:00
|
|
|
attrValues;
|
|
|
|
pkgs' = pkgs.appendOverlays (attrValues config.flake.overlays);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
inherit (pkgs')
|
|
|
|
emacsclient-remote
|
|
|
|
emacs-master-nativecomp
|
|
|
|
emacs-rofi
|
|
|
|
getmail6
|
|
|
|
magic-screenshot
|
|
|
|
maildrop
|
|
|
|
zfs-relmount
|
|
|
|
bootloadHID
|
|
|
|
ds3os
|
|
|
|
ical2org
|
|
|
|
terraform-provider-influxdb-v2
|
|
|
|
terrafrom-provider-vault
|
|
|
|
tree-sitter-grammars
|
|
|
|
udp-over-tcp;
|
|
|
|
};
|
|
|
|
|
2023-06-16 16:40:38 +02:00
|
|
|
devShells.default = pkgs.mkShell {
|
|
|
|
nativeBuildInputs = with pkgs; [
|
2023-06-18 20:49:43 +02:00
|
|
|
(pkgs.writeShellScriptBin "update-secret" ''
|
|
|
|
nix flake lock --update-input secret
|
|
|
|
'')
|
2023-06-16 16:40:38 +02:00
|
|
|
nil
|
2023-06-18 23:17:12 +02:00
|
|
|
nomad consul vault
|
2023-06-16 16:40:38 +02:00
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-06-11 23:09:59 +02:00
|
|
|
flake.patches = {
|
|
|
|
hashicorp-nomad.revert-change-consul-si-tokens-to-be-local = patches/0001-Revert-Change-consul-SI-tokens-to-be-local.patch;
|
|
|
|
hashicorp-nomad.add-nix-integration = patches/0001-Add-Nix-integration.patch;
|
2023-06-12 23:25:40 +02:00
|
|
|
hostapd.intel_lar-and-noscan = patches/0001-intel_lar-and-noscan.patch;
|
|
|
|
hostapd.hostapd-2_10-lar = patches/999-hostapd-2.10-lar.patch;
|
|
|
|
hostapd.hostapd-2_10-lar-2 = patches/hostapd-2.10-lar.patch;
|
2023-06-14 12:27:08 +02:00
|
|
|
terraform-provider-nomad.allow-null-in-authMountTuneSchema = patches/vault-provider-Allow-null-in-authMountTuneSchema.patch;
|
2023-06-11 23:09:59 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
systems = [
|
|
|
|
"x86_64-linux"
|
|
|
|
"armv8-linux"
|
|
|
|
"riscv64-linux"
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|