Tristan Daniël Maat
9654d599e9
Flake lock file updates: • Updated input 'deploy-rs': 'github:serokell/deploy-rs/88b3059b020da69cbe16526b8d639bd5e0b51c8b' (2024-04-01) → 'github:serokell/deploy-rs/3867348fa92bc892eba5d9ddb2d7a97b9e127a8a' (2024-06-12) • Updated input 'disko': 'github:nix-community/disko/285e26465a0bae510897ca04da26ce6307c652b4' (2024-04-26) → 'github:nix-community/disko/115311bc395f24c1b553338fec4b3aa28cbf5ae2' (2024-06-28) • Updated input 'foundryvtt': 'github:reckenrode/nix-foundryvtt/6025615b431170558c3c13f16b549fc0126425e1' (2024-04-09) → 'github:reckenrode/nix-foundryvtt/1176cc325e5e1d46c7a018663a8e02e699e838ec' (2024-06-28) • Updated input 'nixpkgs': 'github:nixos/nixpkgs/cc54fb41d13736e92229c21627ea4f22199fee6b' (2024-06-12) → 'github:nixos/nixpkgs/89c49874fb15f4124bf71ca5f42a04f2ee5825fd' (2024-06-26) • Updated input 'nixpkgs-unstable': 'github:nixos/nixpkgs/58a1abdbae3217ca6b702f03d3b35125d88a2994' (2024-04-27) → 'github:nixos/nixpkgs/2893f56de08021cffd9b6b6dfc70fd9ccd51eb60' (2024-06-24) • Updated input 'nvfetcher': 'github:berberman/nvfetcher/2a824322dc6a755ffda83a13b948d42304521e4d' (2024-04-17) → 'github:berberman/nvfetcher/fa7609950023462c6f91c425de7610c0bb6b86ba' (2024-06-13) • Updated input 'sops-nix': 'github:Mic92/sops-nix/f1b0adc27265274e3b0c9b872a8f476a098679bd' (2024-04-23) → 'github:Mic92/sops-nix/c2ea1186c0cbfa4d06d406ae50f3e4b085ddc9b3' (2024-06-24) • Updated input 'sops-nix/nixpkgs-stable': 'github:NixOS/nixpkgs/74574c38577914733b4f7a775dd77d24245081dd' (2024-04-20) → 'github:NixOS/nixpkgs/5e8e3b89adbd0be63192f6e645e0a54080004924' (2024-06-22)
162 lines
4.3 KiB
Nix
162 lines
4.3 KiB
Nix
{
|
|
description = "tlater.net host configuration";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05-small";
|
|
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable-small";
|
|
disko = {
|
|
url = "github:nix-community/disko";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
deploy-rs.url = "github:serokell/deploy-rs";
|
|
sops-nix = {
|
|
url = "github:Mic92/sops-nix";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
nvfetcher = {
|
|
url = "github:berberman/nvfetcher";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
tlaternet-webserver = {
|
|
url = "git+https://gitea.tlater.net/tlaternet/tlaternet.git";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
foundryvtt = {
|
|
url = "github:reckenrode/nix-foundryvtt";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
sonnenshift = {
|
|
url = "git+ssh://git@github.com/sonnenshift/battery-manager?ref=tlater/implement-nix-module";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{ self
|
|
, nixpkgs
|
|
, sops-nix
|
|
, nvfetcher
|
|
, deploy-rs
|
|
, ...
|
|
} @ inputs:
|
|
let
|
|
system = "x86_64-linux";
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
in
|
|
{
|
|
##################
|
|
# Configurations #
|
|
##################
|
|
nixosConfigurations = {
|
|
# The actual system definition
|
|
hetzner-1 = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
specialArgs.flake-inputs = inputs;
|
|
|
|
modules = [
|
|
./configuration
|
|
./configuration/hardware-specific/hetzner
|
|
];
|
|
};
|
|
};
|
|
|
|
############################
|
|
# Deployment configuration #
|
|
############################
|
|
deploy.nodes = {
|
|
hetzner-1 = {
|
|
hostname = "116.202.158.55";
|
|
|
|
profiles.system = {
|
|
user = "root";
|
|
path = deploy-rs.lib.${system}.activate.nixos self.nixosConfigurations.hetzner-1;
|
|
};
|
|
|
|
sshUser = "tlater";
|
|
sshOpts = [ "-p" "2222" "-o" "ForwardAgent=yes" ];
|
|
};
|
|
};
|
|
|
|
#########
|
|
# Tests #
|
|
#########
|
|
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;
|
|
|
|
###################
|
|
# Utility scripts #
|
|
###################
|
|
apps.${system} = {
|
|
default = self.apps.${system}.run-vm;
|
|
|
|
run-vm = {
|
|
type = "app";
|
|
program =
|
|
let
|
|
vm = nixpkgs.lib.nixosSystem {
|
|
inherit system;
|
|
specialArgs.flake-inputs = inputs;
|
|
|
|
modules = [
|
|
./configuration
|
|
./configuration/hardware-specific/vm.nix
|
|
];
|
|
};
|
|
in
|
|
(pkgs.writeShellScript "" ''
|
|
${vm.config.system.build.vm.outPath}/bin/run-testvm-vm
|
|
'').outPath;
|
|
};
|
|
|
|
update-pkgs = {
|
|
type = "app";
|
|
program =
|
|
let
|
|
nvfetcher-bin = "${nvfetcher.packages.${system}.default}/bin/nvfetcher";
|
|
in
|
|
(pkgs.writeShellScript "update-pkgs" ''
|
|
cd "$(git rev-parse --show-toplevel)/pkgs"
|
|
${nvfetcher-bin} -o _sources_pkgs -c nvfetcher.toml
|
|
'').outPath;
|
|
};
|
|
|
|
update-nextcloud-apps = {
|
|
type = "app";
|
|
program =
|
|
let
|
|
nvfetcher-bin = "${nvfetcher.packages.${system}.default}/bin/nvfetcher";
|
|
in
|
|
(pkgs.writeShellScript "update-nextcloud-apps" ''
|
|
cd "$(git rev-parse --show-toplevel)/pkgs"
|
|
${nvfetcher-bin} -o _sources_nextcloud -c nextcloud-apps.toml
|
|
'').outPath;
|
|
};
|
|
};
|
|
|
|
###########################
|
|
# Development environment #
|
|
###########################
|
|
devShells.${system}.default = nixpkgs.legacyPackages.${system}.mkShell {
|
|
sopsPGPKeyDirs = [ "./keys/hosts/" "./keys/users/" ];
|
|
nativeBuildInputs = [
|
|
sops-nix.packages.${system}.sops-import-keys-hook
|
|
];
|
|
|
|
packages = with pkgs; [
|
|
sops-nix.packages.${system}.sops-init-gpg-key
|
|
deploy-rs.packages.${system}.default
|
|
|
|
nixpkgs-fmt
|
|
|
|
cargo
|
|
clippy
|
|
rustc
|
|
rustfmt
|
|
rust-analyzer
|
|
pkg-config
|
|
openssl
|
|
];
|
|
};
|
|
};
|
|
}
|