foo
Some checks failed
Test Nix flake / Test nix flake (push) Has been cancelled

This commit is contained in:
XenGi 2026-09-13 14:43:21 +02:00
commit bb37ae5907
Signed by: xengi
SSH key fingerprint: SHA256:EvLbWxFCtfmd+8Xa6RkzkhIga+wFkKCekfFacYVn63M
4 changed files with 413 additions and 306 deletions

View file

@ -10,4 +10,4 @@ charset = utf-8
[*.nix] [*.nix]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
insert_final_newline = false

96
.gitignore vendored
View file

@ -1,7 +1,5 @@
result # Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv,pycharm+all,vim
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,direnv,pycharm+all,vim
# Created by https://www.toptal.com/developers/gitignore/api/linux,windows,macos,vim,direnv
# Edit at https://www.toptal.com/developers/gitignore?templates=linux,windows,macos,vim,direnv,nix
### direnv ### ### direnv ###
.direnv .direnv
@ -54,7 +52,93 @@ Temporary Items
# iCloud generated files # iCloud generated files
*.icloud *.icloud
#!! ERROR: nix is undefined. Use list command to see defined gitignore types !!# ### PyCharm+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### PyCharm+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.
.idea/*
!.idea/codeStyles
!.idea/runConfigurations
### Vim ### ### Vim ###
# Swap # Swap
@ -102,4 +186,4 @@ $RECYCLE.BIN/
# Windows shortcuts # Windows shortcuts
*.lnk *.lnk
# End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos,vim,direnv,nix # End of https://www.toptal.com/developers/gitignore/api/linux,windows,macos,direnv,pycharm+all,vim

42
flake.lock generated
View file

@ -45,6 +45,24 @@
"type": "github" "type": "github"
} }
}, },
"flake-utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
@ -68,16 +86,16 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1784432872, "lastModified": 1789233862,
"narHash": "sha256-n3gKTBIV4ZA5VQpUakffBe3KGu4+mhPoA34rrqS0GkA=", "narHash": "sha256-mka8SFIzRsHoxBh6LGCFizdp8N1B81clSSe3wzid6Yc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "fd1462031fdee08f65fd0b4c6b64e22239a77870", "rev": "6eb0f007b69f39ababe79d7025d8d0484553d163",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "owner": "NixOS",
"ref": "nixos-26.05", "ref": "nixos-26.05-small",
"repo": "nixpkgs", "repo": "nixpkgs",
"type": "github" "type": "github"
} }
@ -85,6 +103,7 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },
@ -102,6 +121,21 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -2,7 +2,7 @@
description = "CCCB services"; description = "CCCB services";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05-small"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05-small";
#flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
agenix = { agenix = {
url = "github:ryantm/agenix"; url = "github:ryantm/agenix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -12,19 +12,19 @@
{ {
self, self,
nixpkgs, nixpkgs,
#flake-utils, flake-utils,
agenix, agenix,
}: }:
#flake-utils.lib.eachDefaultSystem ( flake-utils.lib.eachDefaultSystem (
# system: system:
let let
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
system = "x86_64-linux";
in in
{ {
formatter.${system} = pkgs.nixfmt-tree; formatter = pkgs.nixfmt-tree;
apps.${system} = { apps = {
nixos-diff = { nixos-diff = {
meta.description = "Compare the current system with the configuration from the updated flake";
type = "app"; type = "app";
program = "${pkgs.writeShellScript "nixos-diff.sh" '' program = "${pkgs.writeShellScript "nixos-diff.sh" ''
${pkgs.git}/bin/git checkout flake.lock ${pkgs.git}/bin/git checkout flake.lock
@ -35,31 +35,34 @@
''}"; ''}";
}; };
deploy = { deploy = {
meta.description = "Deploy a NixOS configuration to a remote host";
type = "app"; type = "app";
program = "${pkgs.writeShellScript "deploy.sh" '' program = "${pkgs.writeShellScript "deploy.sh" ''
set -e set -e
host="''${1:?usage: nix run .#apps.deploy -- <host>}" host="''${1:?usage: nix run .#deploy -- <host>}"
${pkgs.openssh}/bin/ssh -t "$host" 'bash -s' <<'EOF' ${pkgs.openssh}/bin/ssh -tt "$host" 'bash -s' <<'EOF'
set -e set -e
cd /etc/nixos cd /etc/nixos
nix run .#apps.nixos-diff && nixos-rebuild switch nix run .#nixos-diff && nixos-rebuild switch
EOF EOF
''}"; ''}";
}; };
}; };
devShells.${system}.default = pkgs.mkShell { devShells.default = pkgs.mkShell {
packages = [ packages = [
(agenix.packages.${system}.default) (agenix.packages.${system}.default)
pkgs.age pkgs.age
]; ];
}; };
nixosConfigurations."matrix" = nixpkgs.lib.nixosSystem { }
#system = "x86_64-linux";d )
#pkgs = import nixpkgs { inherit system; }; // {
inherit system; nixosConfigurations = {
matrix = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
matrix_registration_shared_secret = { matrix_registration_shared_secret = {
@ -91,13 +94,11 @@
./hosts/matrix ./hosts/matrix
]; ];
}; };
nixosConfigurations."md" = nixpkgs.lib.nixosSystem { md = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets.hedgedoc_db_password = { age.secrets.hedgedoc_db_password = {
file = ./secrets/hedgedoc_db_password.age; file = ./secrets/hedgedoc_db_password.age;
@ -109,13 +110,11 @@
./hosts/md ./hosts/md
]; ];
}; };
nixosConfigurations."www" = nixpkgs.lib.nixosSystem { www = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
www-staging-htpasswd = { www-staging-htpasswd = {
@ -135,13 +134,11 @@
./hosts/www ./hosts/www
]; ];
}; };
nixosConfigurations."monitoring" = nixpkgs.lib.nixosSystem { monitoring = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
grafana_secret_key = { grafana_secret_key = {
@ -179,13 +176,11 @@
./hosts/monitoring ./hosts/monitoring
]; ];
}; };
nixosConfigurations."sql" = nixpkgs.lib.nixosSystem { sql = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
postgres-matrix-synapse = { postgres-matrix-synapse = {
@ -223,13 +218,11 @@
./hosts/sql ./hosts/sql
]; ];
}; };
nixosConfigurations."dav" = nixpkgs.lib.nixosSystem { dav = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
#radicale-htpasswd = { #radicale-htpasswd = {
@ -243,13 +236,11 @@
./hosts/dav ./hosts/dav
]; ];
}; };
nixosConfigurations."git" = nixpkgs.lib.nixosSystem { git = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
postgres-forgejo = { postgres-forgejo = {
@ -293,13 +284,11 @@
./hosts/git ./hosts/git
]; ];
}; };
nixosConfigurations."forgejo-runner" = nixpkgs.lib.nixosSystem { forgejo-runner = nixpkgs.lib.nixosSystem {
#system = "x86_64-linux"; system = "x86_64-linux";
#pkgs = import nixpkgs { inherit system; };
inherit system;
modules = [ modules = [
agenix.nixosModules.default agenix.nixosModules.default
{ environment.systemPackages = [ (agenix.packages.${system}.default) ]; } { environment.systemPackages = [ (agenix.packages.x86_64-linux.default) ]; }
{ {
age.secrets = { age.secrets = {
forgejo-runner-token = { forgejo-runner-token = {
@ -320,5 +309,5 @@
]; ];
}; };
}; };
#); };
} }