nix-infra/flake.nix

287 lines
7.7 KiB
Nix

{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-24.05-darwin";
lix-module = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.0.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
vampysite.url = "git+https://git.lain.faith/sorceress/vampysite";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs-darwin";
};
mms = {
url = "github:mkaito/nixos-modded-minecraft-servers";
inputs.nixpkgs.follows = "nixpkgs";
};
url-eater = {
url = "github:AgathaSorceress/url-eater";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
colorpickle = {
url = "github:AgathaSorceress/colorpickle";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
matrix-ril100 = {
url = "git+https://git.lain.faith/sorceress/matrix-ril100";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
# Latest colmena + prettier loading icons
colmena = {
url = "github:AgathaSorceress/colmena";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
frq-friend = {
url = "git+https://git.xenua.me/xenua/fedi-frq-friend";
inputs.nixpkgs.follows = "nixpkgs";
};
helix = {
url = "github:helix-editor/helix";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
ccase = {
url = "github:rutrum/ccase";
inputs.nixpkgs.follows = "nixpkgs-unstable";
};
};
outputs =
{
nixpkgs,
nixpkgs-unstable,
nixpkgs-darwin,
lix-module,
home-manager,
nix-darwin,
mms,
helix,
url-eater,
colorpickle,
matrix-ril100,
frq-friend,
colmena,
vampysite,
ccase,
...
}:
let
mkOverlays = system: config: [
(final: prev: {
helix =
let
helix-pkgs = helix.packages.${final.system};
in
helix-pkgs.helix.passthru.wrapper (
helix-pkgs.helix-unwrapped.overrideAttrs {
preInstall = ''
substituteInPlace contrib/Helix.desktop \
--replace "Exec=hx %F" "Exec=kitty hx %F" \
--replace "Terminal=true" "Terminal=false"
'';
}
);
colorpickle = colorpickle.packages.${final.system}.default;
frq-friend = frq-friend.packages.${final.system}.default;
vampysite = vampysite.packages.${final.system}.default;
matrix-ril100 = matrix-ril100.packages.${final.system}.default;
ccase = ccase.packages.${final.system}.default;
# Unstable packages
unstable = import nixpkgs-unstable { inherit system config; };
})
colmena.overlay
lix-module.overlays.default
];
mkDesktop = hostname: {
imports = [
./common
./common/linux-specific.nix
./hosts/${hostname}/configuration.nix
./common/options.nix
(import "${home-manager}/nixos")
url-eater.nixosModules.default
colorpickle.nixosModules.default
];
deployment = {
targetUser = "root";
targetHost = hostname;
tags = [ "home" ];
allowLocalDeployment = true;
keys = {
"restic-password" = {
keyCommand = [
"cat"
"./secrets/restic-password"
];
destDir = "/var/lib/secrets/";
};
"restic-env" = {
keyCommand = [
"cat"
"./secrets/restic-env"
];
destDir = "/var/lib/secrets/";
};
};
};
};
in
{
colmena = {
network = {
description = "Agatha's Nix Infra";
nixpkgs = import nixpkgs rec {
system = "x86_64-linux";
config.allowUnfree = true;
overlays = mkOverlays system config;
};
};
bloodletting = {
imports = [
./common
./common/linux-specific.nix
./hosts/bloodletting/configuration.nix
(import "${home-manager}/nixos")
mms.module
];
deployment = {
targetUser = "root";
targetHost = "technogothic.net";
tags = [ "prod" ];
keys = {
"nyandroid-token" = {
keyCommand = [
"cat"
"./secrets/nyandroid-token"
];
destDir = "/var/lib/secrets/";
};
"hurricane-tokens" = {
keyCommand = [
"cat"
"./secrets/hurricane-tokens"
];
destDir = "/var/lib/secrets/";
};
"mc-status-bot-env" = {
keyCommand = [
"cat"
"./secrets/mc-status-bot-env"
];
destDir = "/var/lib/secrets";
};
"fedi-data.toml" = {
keyCommand = [
"cat"
"./secrets/frq-friend-fedi-data.toml"
];
destDir = "/var/lib/frq-friend";
};
"ril100-bot-secrets" = {
keyCommand = [
"cat"
"./secrets/ril100-bot-secrets"
];
destDir = "/var/lib/matrix-ril100";
name = ".env";
};
};
};
};
watchtower = {
imports = [
./common
./common/linux-specific.nix
./hosts/watchtower/configuration.nix
(import "${home-manager}/nixos")
];
deployment = {
targetUser = "root";
targetHost = "watchtower";
tags = [ "prod" ];
keys = {
"hetzner-env" = {
keyCommand = [
"cat"
"./secrets/hetzner-env"
];
destDir = "/var/lib/secrets/";
};
"gocryptfs-pass" = {
keyCommand = [
"cat"
"./secrets/gocryptfs-pass"
];
destDir = "/var/lib/secrets/";
};
};
};
};
ritual = mkDesktop "ritual";
tears = mkDesktop "tears";
};
darwinConfigurations."Agathas-Mac-mini" = nix-darwin.lib.darwinSystem {
pkgs = import nixpkgs-darwin rec {
system = "aarch64-darwin";
config.allowUnfree = true;
overlays = mkOverlays system config;
};
modules = [
./common
./hosts/Agathas-Mac-mini/configuration.nix
(import "${home-manager}/nix-darwin")
];
};
devShells =
let
patchedColmena =
system:
let
pkgs = import nixpkgs { inherit system; };
in
pkgs.mkShell {
buildInputs = [
(pkgs.writeShellScriptBin "colmena" ''
${colmena.defaultPackage.${pkgs.system}}/bin/colmena --disable-emoji $@
'')
];
};
in
{
"x86_64-linux".default = patchedColmena "x86_64-linux";
"aarch64-darwin".default = patchedColmena "aarch64-darwin";
};
};
}