Compare commits
22 Commits
d42de74755
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9b51398ceb | |||
| 2a97dbf7ca | |||
| d7e32c0a2f | |||
| 76cb1d078b | |||
| fb7750235f | |||
| 4c90263866 | |||
| fac9c7f5ce | |||
| a7b65e4eee | |||
| 1fe4d59ce6 | |||
| 86bb800886 | |||
| c4cf7c8096 | |||
| 863ff2d04d | |||
| bc66ec89c6 | |||
| cf02260941 | |||
| 609d2a5cca | |||
| 395e13acd2 | |||
| b6a85631f3 | |||
| f82d084030 | |||
| 3674a0e6c4 | |||
| 89a4d5a228 | |||
| fef4ff71bb | |||
| c0c1e92249 |
Generated
+50
-29
@@ -18,11 +18,11 @@
|
|||||||
},
|
},
|
||||||
"flake-file": {
|
"flake-file": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774666175,
|
"lastModified": 1774886516,
|
||||||
"narHash": "sha256-WaZxvtOvVNikiNTen2Emhds2RvzFCWIb7KU9C0eWrNA=",
|
"narHash": "sha256-w2LoQVM6DXrSdGUZBZqa1nYkMzHoB0t82DrptzZKhTs=",
|
||||||
"owner": "vic",
|
"owner": "vic",
|
||||||
"repo": "flake-file",
|
"repo": "flake-file",
|
||||||
"rev": "953d01f3ae5ba50869c5e1248062198f73e971bf",
|
"rev": "3daadf37de2bb85b0ff34e2a7ab0d71e077c2b9e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -38,11 +38,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1772408722,
|
"lastModified": 1775087534,
|
||||||
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
|
"narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "f20dc5d9b8027381c474144ecabc9034d6a839a3",
|
"rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -95,11 +95,11 @@
|
|||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774738535,
|
"lastModified": 1775080052,
|
||||||
"narHash": "sha256-2jfBEZUC67IlnxO5KItFCAd7Oc+1TvyV/jQlR+2ykGQ=",
|
"narHash": "sha256-jAB4ZZbx8ECu9GcE/PUUwT+wpooZ0Ssmn2imB8PVTdM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "769e07ef8f4cf7b1ec3b96ef015abec9bc6b1e2a",
|
"rev": "6267895e9898399f0ce2fe79b645e9ee4858aaff",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -184,11 +184,11 @@
|
|||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774777275,
|
"lastModified": 1774933469,
|
||||||
"narHash": "sha256-qogBiYFq8hZusDPeeKRqzelBAhZvREc7Cl+qlewGUCg=",
|
"narHash": "sha256-OrnCQeUO2bqaWUl0lkDWyGWjKsOhtCyd7JSfTedQNUE=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "b8f81636927f1af0cca812d22c876bad0a883ccd",
|
"rev": "f4c4c2c0c923d7811ac2a63ccc154767e4195337",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -199,11 +199,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774106199,
|
"lastModified": 1774709303,
|
||||||
"narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=",
|
"narHash": "sha256-D3Q07BbIA2KnTcSXIqqu9P586uWxN74zNoCH3h2ESHg=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655",
|
"rev": "8110df5ad7abf5d4c0f6fb0f8f978390e77f9685",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -215,11 +215,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774701658,
|
"lastModified": 1775064974,
|
||||||
"narHash": "sha256-5QVei2IIfVO3GqMkiiXlrZtaniOkXyMWnqbTVkItrco=",
|
"narHash": "sha256-PqhsO5qloSyvATi9qAIrgUcEFK67xSoacjacPw+t4H0=",
|
||||||
"rev": "b63fe7f000adcfa269967eeff72c64cafecbbebe",
|
"rev": "6ebfbc38bdc6b22822a6f991f2d922306f33cfbc",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre971056.b63fe7f000ad/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre973084.6ebfbc38bdc6/nixexprs.tar.xz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
@@ -254,11 +254,11 @@
|
|||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774736237,
|
"lastModified": 1774852850,
|
||||||
"narHash": "sha256-uQ+Was7QP9Bupr0XZyZXOAD32Ox8z2mJnevT2FmDwS8=",
|
"narHash": "sha256-7VK4v7ZbQw5apfgc+FvgRi8BUC45ERlcp8VTTTQ3tko=",
|
||||||
"owner": "notashelf",
|
"owner": "notashelf",
|
||||||
"repo": "nvf",
|
"repo": "nvf",
|
||||||
"rev": "a0636d5c977743851c91d3c2e74bfac90be48835",
|
"rev": "b4d6539e7e9948aaba5efd7a67a63672d1fa80ef",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -281,7 +281,8 @@
|
|||||||
],
|
],
|
||||||
"nvf": "nvf",
|
"nvf": "nvf",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"wrapper-modules": "wrapper-modules"
|
"wrapper-modules": "wrapper-modules",
|
||||||
|
"wrappers": "wrappers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sops-nix": {
|
"sops-nix": {
|
||||||
@@ -291,11 +292,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774760784,
|
"lastModified": 1774910634,
|
||||||
"narHash": "sha256-D+tgywBHldTc0klWCIC49+6Zlp57Y4GGwxP1CqfxZrY=",
|
"narHash": "sha256-B+rZDPyktGEjOMt8PcHKYmgmKoF+GaNAFJhguktXAo0=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "8adb84861fe70e131d44e1e33c426a51e2e0bfa5",
|
"rev": "19bf3d8678fbbfbc173beaa0b5b37d37938db301",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -339,11 +340,11 @@
|
|||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs": "nixpkgs_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774767209,
|
"lastModified": 1774879171,
|
||||||
"narHash": "sha256-bJxBN+ebX3yZj+KT/c+LeA4xIpoNghG233szgRFAWOc=",
|
"narHash": "sha256-a6JZDuBIwQmuEwYM4dziH+WyrpE8HCP8F7JFIn3CNvw=",
|
||||||
"owner": "BirdeeHub",
|
"owner": "BirdeeHub",
|
||||||
"repo": "nix-wrapper-modules",
|
"repo": "nix-wrapper-modules",
|
||||||
"rev": "70795f6eb74a69d736e41ee837cd7e1a6d46c0aa",
|
"rev": "bab35ffae25cf6f4e4fdb3c2f7f0ac80966ce737",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -351,6 +352,26 @@
|
|||||||
"repo": "nix-wrapper-modules",
|
"repo": "nix-wrapper-modules",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"wrappers": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1774293387,
|
||||||
|
"narHash": "sha256-yVekLWxKTUfUyuvo9HVihtOK8llIP3IZCrJmftxT+Nc=",
|
||||||
|
"owner": "lassulus",
|
||||||
|
"repo": "wrappers",
|
||||||
|
"rev": "3cf1e8371129e8746d37c863c5d56a81fb16caa0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "lassulus",
|
||||||
|
"repo": "wrappers",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|||||||
@@ -30,5 +30,9 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
wrapper-modules.url = "github:BirdeeHub/nix-wrapper-modules";
|
wrapper-modules.url = "github:BirdeeHub/nix-wrapper-modules";
|
||||||
|
wrappers = {
|
||||||
|
url = "github:lassulus/wrappers";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.forgejo = {config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.forgejo;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.forgejo = {
|
||||||
|
enable = lib.mkEnableOption "Enable Forgejo backed with PostgreSQL";
|
||||||
|
|
||||||
|
port = lib.mkOption {
|
||||||
|
type = lib.types.port;
|
||||||
|
default = 3000;
|
||||||
|
description = "TCP port for the Forgejo web interface.";
|
||||||
|
};
|
||||||
|
|
||||||
|
openFirewall = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = true;
|
||||||
|
description = "Open the Forgejo web interface port in the firewall.";
|
||||||
|
};
|
||||||
|
|
||||||
|
https = lib.mkEnableOption "Open the Forgejo web interface port in the firewall.";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
|
||||||
|
|
||||||
|
services.forgejo = {
|
||||||
|
enable = true;
|
||||||
|
lfs.enable = true;
|
||||||
|
settings.server = lib.mkMerge [
|
||||||
|
{
|
||||||
|
HTTP_PORT = cfg.port;
|
||||||
|
DISABLE_SSH = true;
|
||||||
|
}
|
||||||
|
(lib.mkIf cfg.https {
|
||||||
|
ROOT_URL = "https://forgejo.john-stream.com";
|
||||||
|
PROTOCOL = "https";
|
||||||
|
COOKIE_SECURE = true;
|
||||||
|
KEY_FILE = config.mtls.keyFile;
|
||||||
|
CERT_FILE = config.mtls.certFile;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
|
database = {
|
||||||
|
type = "postgres";
|
||||||
|
port = config.services.postgresql.settings.port;
|
||||||
|
# createDatabase = false;
|
||||||
|
};
|
||||||
|
# dump = {
|
||||||
|
# enable = true;
|
||||||
|
# interval = "12h";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
services.postgresql = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# https://github.com/glabrie/dotfiles/blob/main/modules/system/settings/greetd.nix
|
# https://github.com/glabrie/dotfiles/blob/main/modules/system/settings/greetd.nix
|
||||||
{ inputs, ... }: {
|
{ inputs, ... }: {
|
||||||
flake.module.nixos.greetd = { pkgs, lib, ... }: {
|
flake.modules.nixos.greetd = { pkgs, lib, ... }: {
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
|
|||||||
+56
-53
@@ -1,7 +1,7 @@
|
|||||||
{ self, inputs, lib, ... }:
|
{ self, inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
# Options that will be in common between
|
# Options that will be in common between the nixos module and the home-manager module.
|
||||||
opts = {
|
mkOpts = config: let cfg = config.mtls; in {
|
||||||
enable = lib.mkEnableOption "Enable mTLS";
|
enable = lib.mkEnableOption "Enable mTLS";
|
||||||
subject = lib.mkOption {
|
subject = lib.mkOption {
|
||||||
description = "The Common Name, DNS Name, or IP address that will be set as the Subject Common Name for the certificate. If no Subject Alternative Names (SANs) are configured (via the --san flag) then the subject will be set as the only SAN.";
|
description = "The Common Name, DNS Name, or IP address that will be set as the Subject Common Name for the certificate. If no Subject Alternative Names (SANs) are configured (via the --san flag) then the subject will be set as the only SAN.";
|
||||||
@@ -11,20 +11,25 @@ let
|
|||||||
description = "String path to the directory where the certs will be stored";
|
description = "String path to the directory where the certs will be stored";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
};
|
};
|
||||||
keyFilename = lib.mkOption {
|
caFile = lib.mkOption {
|
||||||
description = "String filename for the private key";
|
description = "String path for the root CA file";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "key.pem";
|
default = "${cfg.certDir}/root_ca.crt";
|
||||||
};
|
};
|
||||||
certFilename = lib.mkOption {
|
keyFile = lib.mkOption {
|
||||||
description = "String filename for the public certificate";
|
description = "String path for the private key";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "cert.pem";
|
default = "${cfg.certDir}/key.pem";
|
||||||
};
|
};
|
||||||
bundleFilename = lib.mkOption {
|
certFile = lib.mkOption {
|
||||||
description = "String filename for the mTLS key bundle";
|
description = "String path for the public cert";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "mtls.pem";
|
default = "${cfg.certDir}/cert.pem";
|
||||||
|
};
|
||||||
|
bundleFile = lib.mkOption {
|
||||||
|
description = "String path for the mTLS key bundle";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${cfg.certDir}/mtls.pem";
|
||||||
};
|
};
|
||||||
san = lib.mkOption {
|
san = lib.mkOption {
|
||||||
description = "List of SAN to give the mTLS cert";
|
description = "List of SAN to give the mTLS cert";
|
||||||
@@ -37,7 +42,7 @@ let
|
|||||||
};
|
};
|
||||||
lifetime = lib.mkOption {
|
lifetime = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "6h";
|
default = "24h";
|
||||||
};
|
};
|
||||||
renew = {
|
renew = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
@@ -83,9 +88,9 @@ let
|
|||||||
subject,
|
subject,
|
||||||
provisioner,
|
provisioner,
|
||||||
san,
|
san,
|
||||||
tlsCert,
|
certFile,
|
||||||
tlsKey,
|
keyFile,
|
||||||
mtlsBundle,
|
bundleFile,
|
||||||
lifetime,
|
lifetime,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
@@ -95,26 +100,26 @@ let
|
|||||||
pkgs.writeShellScriptBin "mtls-generate" ''
|
pkgs.writeShellScriptBin "mtls-generate" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
${stepCmd} ca certificate \
|
${stepCmd} ca certificate \
|
||||||
${subject} ${tlsCert} ${tlsKey} \
|
${subject} ${certFile} ${keyFile} \
|
||||||
--not-before=-5m --not-after=${lifetime} \
|
--not-before=-5m --not-after=${lifetime} \
|
||||||
--provisioner ${provisioner} \
|
--provisioner ${provisioner} \
|
||||||
${sanArgs} \
|
${sanArgs} \
|
||||||
"$@"
|
"$@"
|
||||||
cat ${tlsCert} ${tlsKey} > ${mtlsBundle}
|
cat ${certFile} ${keyFile} > ${bundleFile}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkMtlsCheckScript = { pkgs, mtlsBundle }: pkgs.writeShellScriptBin "mtls-check" ''
|
mkMtlsCheckScript = { pkgs, bundleFile }: pkgs.writeShellScriptBin "mtls-check" ''
|
||||||
${lib.getExe pkgs.openssl} x509 \
|
${lib.getExe pkgs.openssl} x509 \
|
||||||
-noout -subject -issuer \
|
-noout -subject -issuer \
|
||||||
-ext subjectAltName,extendedKeyUsage \
|
-ext subjectAltName,extendedKeyUsage \
|
||||||
-enddate -in ${mtlsBundle}
|
-enddate -in ${bundleFile}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mkMtlsRenewScript = {
|
mkMtlsRenewScript = {
|
||||||
pkgs,
|
pkgs,
|
||||||
tlsCert,
|
certFile,
|
||||||
tlsKey,
|
keyFile,
|
||||||
mtlsBundle,
|
bundleFile,
|
||||||
reloadUnits ? [ ],
|
reloadUnits ? [ ],
|
||||||
postCommands ? [ ],
|
postCommands ? [ ],
|
||||||
systemctlArgs ? [ ],
|
systemctlArgs ? [ ],
|
||||||
@@ -134,17 +139,17 @@ let
|
|||||||
pkgs.writeShellScriptBin "mtls-renew" ''
|
pkgs.writeShellScriptBin "mtls-renew" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
if ${lib.getExe pkgs.step-cli} certificate needs-renewal "${tlsCert}"; then
|
if ${lib.getExe pkgs.step-cli} certificate needs-renewal "${certFile}"; then
|
||||||
${echoCmd} "Renewing mTLS certificate"
|
${echoCmd} "Renewing mTLS certificate"
|
||||||
else
|
else
|
||||||
${echoCmd} "Skipping renew"
|
${echoCmd} "Skipping renew"
|
||||||
exit "$?"
|
exit "$?"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${lib.getExe pkgs.step-cli} ca renew --force "${tlsCert}" "${tlsKey}"
|
${lib.getExe pkgs.step-cli} ca renew --force "${certFile}" "${keyFile}"
|
||||||
|
|
||||||
umask 077
|
umask 077
|
||||||
${lib.getExe' pkgs.coreutils "cat"} "${tlsCert}" "${tlsKey}" > "${mtlsBundle}"
|
${lib.getExe' pkgs.coreutils "cat"} "${certFile}" "${keyFile}" > "${bundleFile}"
|
||||||
|
|
||||||
${echoCmd} "Reloading units:"
|
${echoCmd} "Reloading units:"
|
||||||
${renewReloadScript}
|
${renewReloadScript}
|
||||||
@@ -155,9 +160,9 @@ let
|
|||||||
|
|
||||||
mkNixosMtlsRenewService = {
|
mkNixosMtlsRenewService = {
|
||||||
pkgs,
|
pkgs,
|
||||||
tlsCert,
|
certFile,
|
||||||
tlsKey,
|
keyFile,
|
||||||
mtlsBundle,
|
bundleFile,
|
||||||
reloadUnits ? [ ],
|
reloadUnits ? [ ],
|
||||||
postCommands ? [ ],
|
postCommands ? [ ],
|
||||||
user ? "root",
|
user ? "root",
|
||||||
@@ -166,7 +171,7 @@ let
|
|||||||
let
|
let
|
||||||
serviceGroup = if group == null then user else group;
|
serviceGroup = if group == null then user else group;
|
||||||
renewScript = mkMtlsRenewScript {
|
renewScript = mkMtlsRenewScript {
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle reloadUnits postCommands;
|
inherit pkgs certFile keyFile bundleFile reloadUnits postCommands;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@@ -200,15 +205,15 @@ let
|
|||||||
|
|
||||||
mkHomeManagerMtlsRenewService = {
|
mkHomeManagerMtlsRenewService = {
|
||||||
pkgs,
|
pkgs,
|
||||||
tlsCert,
|
certFile,
|
||||||
tlsKey,
|
keyFile,
|
||||||
mtlsBundle,
|
bundleFile,
|
||||||
reloadUnits ? [ ],
|
reloadUnits ? [ ],
|
||||||
postCommands ? [ ],
|
postCommands ? [ ],
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
renewScript = mkMtlsRenewScript {
|
renewScript = mkMtlsRenewScript {
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle reloadUnits postCommands;
|
inherit pkgs certFile keyFile bundleFile reloadUnits postCommands;
|
||||||
systemctlArgs = [ "--user" ];
|
systemctlArgs = [ "--user" ];
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -249,29 +254,26 @@ in
|
|||||||
flake.modules.nixos.mtls = { config, lib, pkgs, ... }:
|
flake.modules.nixos.mtls = { config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.mtls;
|
cfg = config.mtls;
|
||||||
tlsKey = "${cfg.certDir}/${cfg.keyFilename}";
|
|
||||||
tlsCert = "${cfg.certDir}/${cfg.certFilename}";
|
|
||||||
mtlsBundle = "${cfg.certDir}/${cfg.bundleFilename}";
|
|
||||||
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mtls = opts // {
|
options.mtls = (mkOpts config) // {
|
||||||
certDir = lib.mkOption {
|
certDir = lib.mkOption {
|
||||||
description = "String path to where the mtls certs will be stored.";
|
description = "String path to where the mtls certs will be stored.";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "/etc/step/certs";
|
default = "/etc/step-ca/certs";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
environment.systemPackages = with pkgs; lib.optionals cfg.enable [
|
environment.systemPackages = with pkgs; lib.optionals cfg.enable [
|
||||||
step-cli
|
# step-cli
|
||||||
(mkMtlsGenerateScript {
|
(mkMtlsGenerateScript {
|
||||||
inherit (cfg) subject provisioner san lifetime;
|
inherit pkgs;
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
inherit (cfg) subject provisioner san certFile keyFile bundleFile lifetime;
|
||||||
})
|
})
|
||||||
(mkMtlsCheckScript { inherit pkgs mtlsBundle; })
|
(mkMtlsCheckScript { inherit pkgs; inherit (cfg) bundleFile; })
|
||||||
(mkMtlsRenewScript { inherit pkgs tlsCert tlsKey mtlsBundle; })
|
(mkMtlsRenewScript { inherit pkgs; inherit (cfg) certFile keyFile bundleFile; })
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
@@ -279,7 +281,8 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
systemd.services.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewService {
|
systemd.services.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewService {
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
inherit pkgs;
|
||||||
|
inherit (cfg) certFile keyFile bundleFile;
|
||||||
inherit (cfg.renew) reloadUnits postCommands user group;
|
inherit (cfg.renew) reloadUnits postCommands user group;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -292,13 +295,13 @@ in
|
|||||||
flake.modules.homeManager.mtls = { config, lib, pkgs, ... }:
|
flake.modules.homeManager.mtls = { config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.mtls;
|
cfg = config.mtls;
|
||||||
tlsKey = "${cfg.certDir}/${cfg.keyFilename}";
|
keyFile = cfg.keyFile;
|
||||||
tlsCert = "${cfg.certDir}/${cfg.certFilename}";
|
certFile = cfg.certFile;
|
||||||
mtlsBundle = "${cfg.certDir}/${cfg.bundleFilename}";
|
bundleFile = cfg.bundleFile;
|
||||||
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.mtls = opts // {
|
options.mtls = (mkOpts config) // {
|
||||||
certDir = lib.mkOption {
|
certDir = lib.mkOption {
|
||||||
description = "String path to where the mtls certs will be stored.";
|
description = "String path to where the mtls certs will be stored.";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -308,13 +311,13 @@ in
|
|||||||
|
|
||||||
config = {
|
config = {
|
||||||
home.packages = with pkgs; lib.optionals cfg.enable [
|
home.packages = with pkgs; lib.optionals cfg.enable [
|
||||||
step-cli
|
# step-cli
|
||||||
(mkMtlsGenerateScript {
|
(mkMtlsGenerateScript {
|
||||||
inherit (cfg) subject provisioner san lifetime;
|
inherit (cfg) subject provisioner san lifetime;
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
inherit pkgs certFile keyFile bundleFile;
|
||||||
})
|
})
|
||||||
(mkMtlsCheckScript { inherit pkgs mtlsBundle; })
|
(mkMtlsCheckScript { inherit pkgs bundleFile; })
|
||||||
(mkMtlsRenewScript { inherit pkgs tlsCert tlsKey mtlsBundle; })
|
(mkMtlsRenewScript { inherit pkgs certFile keyFile bundleFile; })
|
||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.tmpfiles.rules = lib.mkIf cfg.enable [
|
systemd.user.tmpfiles.rules = lib.mkIf cfg.enable [
|
||||||
@@ -322,7 +325,7 @@ in
|
|||||||
];
|
];
|
||||||
|
|
||||||
systemd.user.services.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewService {
|
systemd.user.services.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewService {
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
inherit pkgs certFile keyFile bundleFile;
|
||||||
inherit (cfg.renew) reloadUnits postCommands;
|
inherit (cfg.renew) reloadUnits postCommands;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -19,6 +19,11 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "john-ubuntu";
|
default = "john-ubuntu";
|
||||||
};
|
};
|
||||||
|
repoUrl = lib.mkOption {
|
||||||
|
description = "URL to the REST endpoint";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "rest:https://soteria.john-stream.com/${cfg.repoName}";
|
||||||
|
};
|
||||||
passwordFile = lib.mkOption {
|
passwordFile = lib.mkOption {
|
||||||
description = "String path to the restic password file";
|
description = "String path to the restic password file";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -44,29 +49,24 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = {
|
||||||
resticRepository = "rest:https://soteria.john-stream.com/${cfg.repoName}";
|
|
||||||
caCert = "${config.mtls.certDir}/root_ca.crt";
|
|
||||||
mtlsBundle = "${config.mtls.certDir}/${config.mtls.bundleFilename}";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
RESTIC_REPOSITORY = resticRepository;
|
RESTIC_REPOSITORY = cfg.repoUrl;
|
||||||
RESTIC_PASSWORD_FILE = cfg.passwordFile;
|
RESTIC_PASSWORD_FILE = cfg.passwordFile;
|
||||||
RESTIC_CACERT = caCert;
|
RESTIC_CACERT = config.mtls.caFile;
|
||||||
RESTIC_TLS_CLIENT_CERT = mtlsBundle;
|
RESTIC_TLS_CLIENT_CERT = config.mtls.bundleFile;
|
||||||
};
|
};
|
||||||
|
|
||||||
# This is necessary because the restic service in home manager doesn't otherwise expose these options.
|
# This is necessary because the restic service in home manager doesn't otherwise expose these options.
|
||||||
systemd.user.services."restic-backups-${cfg.repoName}".Service.Environment = [
|
systemd.user.services."restic-backups-${cfg.repoName}".Service.Environment = [
|
||||||
"RESTIC_CACERT=${caCert}"
|
"RESTIC_CACERT=${config.mtls.caFile}"
|
||||||
"RESTIC_TLS_CLIENT_CERT=${mtlsBundle}"
|
"RESTIC_TLS_CLIENT_CERT=${config.mtls.bundleFile}"
|
||||||
];
|
];
|
||||||
|
|
||||||
services.restic = {
|
services.restic = {
|
||||||
enable = true;
|
enable = true;
|
||||||
backups.${cfg.repoName} = {
|
backups.${cfg.repoName} = {
|
||||||
repository = resticRepository;
|
repository = cfg.repoUrl;
|
||||||
passwordFile = cfg.passwordFile;
|
passwordFile = cfg.passwordFile;
|
||||||
paths = cfg.paths;
|
paths = cfg.paths;
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
|
|||||||
@@ -2,12 +2,37 @@
|
|||||||
let
|
let
|
||||||
username = "john";
|
username = "john";
|
||||||
hostname = "janus";
|
hostname = "janus";
|
||||||
|
ca-url = "https://janus.john-stream.com/";
|
||||||
|
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
flake.modules.nixos.janus-ca =
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
johnHome = lib.attrByPath [ "users" "users" username "home" ] "/home/${username}" config;
|
||||||
|
johnGroup = lib.attrByPath [ "users" "users" username "group" ] username config;
|
||||||
|
mkStepRules = home: user: group: [
|
||||||
|
"d ${home}/.step 0700 ${user} ${group} -"
|
||||||
|
"d ${home}/.step/config 0700 ${user} ${group} -"
|
||||||
|
"d ${home}/.step/certs 0700 ${user} ${group} -"
|
||||||
|
"L+ ${home}/.step/config/defaults.json - - - - /etc/step/config/defaults.json"
|
||||||
|
"L+ ${home}/.step/certs/root_ca.crt - - - - /etc/step/certs/root_ca.crt"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
environment.etc."step/config/defaults.json".text = builtins.toJSON {
|
||||||
|
inherit ca-url fingerprint;
|
||||||
|
root = "/etc/step-ca/certs/root_ca.crt";
|
||||||
|
};
|
||||||
|
environment.etc."step-ca/certs/root_ca.crt".source = ./root_ca.crt;
|
||||||
|
systemd.tmpfiles.rules =
|
||||||
|
mkStepRules johnHome username johnGroup
|
||||||
|
++ mkStepRules "/root" "root" "root";
|
||||||
|
};
|
||||||
|
|
||||||
flake.modules.homeManager.janus-ca = { config, ... }: {
|
flake.modules.homeManager.janus-ca = { config, ... }: {
|
||||||
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
||||||
"ca-url" = "https://janus.john-stream.com/";
|
inherit ca-url fingerprint;
|
||||||
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
|
||||||
root = "${config.home.homeDirectory}/.step/certs/root_ca.crt";
|
root = "${config.home.homeDirectory}/.step/certs/root_ca.crt";
|
||||||
};
|
};
|
||||||
home.file.".step/certs/root_ca.crt".source = ./root_ca.crt;
|
home.file.".step/certs/root_ca.crt".source = ./root_ca.crt;
|
||||||
@@ -18,6 +43,7 @@ in
|
|||||||
nixos.lxc
|
nixos.lxc
|
||||||
nixos.mysops
|
nixos.mysops
|
||||||
nixos.step-ssh-host
|
nixos.step-ssh-host
|
||||||
|
nixos.janus-ca
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
nixos."${username}"
|
nixos."${username}"
|
||||||
nixos.docker
|
nixos.docker
|
||||||
@@ -41,7 +67,6 @@ in
|
|||||||
imports = with inputs.self.modules.homeManager; [
|
imports = with inputs.self.modules.homeManager; [
|
||||||
mysops
|
mysops
|
||||||
step-ssh-user
|
step-ssh-user
|
||||||
janus-ca
|
|
||||||
];
|
];
|
||||||
shell.program = "zsh";
|
shell.program = "zsh";
|
||||||
docker.enable = true;
|
docker.enable = true;
|
||||||
@@ -49,4 +74,23 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flake-file.inputs = {
|
||||||
|
wrappers = {
|
||||||
|
url = "github:lassulus/wrappers";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { pkgs, lib, ... }: {
|
||||||
|
packages.janus-ca = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
package = pkgs.step-cli;
|
||||||
|
binName = "janus-cert";
|
||||||
|
args = [
|
||||||
|
"ca" "certificate"
|
||||||
|
"--ca-url=${ca-url}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
hostname = "john-p14s";
|
hostname = "john-p14s";
|
||||||
homeDirectory = config.home-manager.users.john.home.homeDirectory;
|
homeDirectory = config.home-manager.users.john.home.homeDirectory;
|
||||||
flakeDir = "${homeDirectory}/Documents/dendritic";
|
flakeDir = "${homeDirectory}/Documents/dendritic";
|
||||||
|
my-neovim = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
@@ -40,6 +41,7 @@
|
|||||||
busybox
|
busybox
|
||||||
dig
|
dig
|
||||||
samba
|
samba
|
||||||
|
my-neovim
|
||||||
];
|
];
|
||||||
|
|
||||||
security.pam.services.swaylock = {};
|
security.pam.services.swaylock = {};
|
||||||
@@ -106,7 +108,6 @@
|
|||||||
home-manager.users.root = {
|
home-manager.users.root = {
|
||||||
imports = with inputs.self.modules.homeManager; [
|
imports = with inputs.self.modules.homeManager; [
|
||||||
rebuild
|
rebuild
|
||||||
janus-ca
|
|
||||||
];
|
];
|
||||||
home.stateVersion = "25.11";
|
home.stateVersion = "25.11";
|
||||||
};
|
};
|
||||||
@@ -115,7 +116,6 @@
|
|||||||
desktop
|
desktop
|
||||||
mysops
|
mysops
|
||||||
rebuild
|
rebuild
|
||||||
janus-ca
|
|
||||||
{
|
{
|
||||||
my-vscode.enable = true;
|
my-vscode.enable = true;
|
||||||
mysops.hostSecretFile = "${flakeDir}/modules/hosts/john-p14s/secrets.yaml";
|
mysops.hostSecretFile = "${flakeDir}/modules/hosts/john-p14s/secrets.yaml";
|
||||||
@@ -124,7 +124,14 @@
|
|||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
bash
|
bash
|
||||||
discord
|
discord
|
||||||
|
my-neovim
|
||||||
];
|
];
|
||||||
|
ssh.matchSets = {
|
||||||
|
appdaemon = true;
|
||||||
|
homelab = true;
|
||||||
|
dev = true;
|
||||||
|
certs = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"${inputs.nixos-hardware}/lenovo/thinkpad/p14s/amd/gen4"
|
"${inputs.nixos-hardware}/lenovo/thinkpad/p14s/amd/gen4"
|
||||||
] ++ (with self.modules.nixos; [
|
] ++ (with self.modules.nixos; [
|
||||||
p14sConfiguration
|
p14sConfiguration
|
||||||
|
janus-ca
|
||||||
rebuild
|
rebuild
|
||||||
sudo
|
sudo
|
||||||
john
|
john
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ let
|
|||||||
username = "john";
|
username = "john";
|
||||||
hostname = "john-pc-ubuntu";
|
hostname = "john-pc-ubuntu";
|
||||||
|
|
||||||
testHost = "soteria";
|
testHost = "soteria"; # which host to test build
|
||||||
testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; # test-nix
|
testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; # test-nix
|
||||||
# testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3"; # soteria
|
# testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3"; # soteria
|
||||||
|
|
||||||
@@ -12,11 +12,10 @@ in
|
|||||||
flake.modules.homeManager."${hostname}" = { config, pkgs, lib, ... }:
|
flake.modules.homeManager."${hostname}" = { config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
flakeDir = "${config.xdg.configHome}/home-manager/jsl-dendritic";
|
flakeDir = "${config.xdg.configHome}/home-manager/jsl-dendritic";
|
||||||
certDir = "${config.mtls.certDir}";
|
|
||||||
mtlsBundle = "${certDir}/${config.mtls.bundleFilename}";
|
|
||||||
resticPasswordFile = "${config.xdg.configHome}/restic/password.txt";
|
resticPasswordFile = "${config.xdg.configHome}/restic/password.txt";
|
||||||
|
|
||||||
testPushCmd = (pkgs.writeShellScriptBin "test-push" ''
|
testPushCmd = (pkgs.writeShellScriptBin "test-push" ''
|
||||||
|
${lib.getExe' pkgs.coreutils "echo"} "Pushing ${testHost} to ${testTarget}"
|
||||||
${lib.getExe' pkgs.coreutils "mkdir"} -p /var/tmp/nix-build
|
${lib.getExe' pkgs.coreutils "mkdir"} -p /var/tmp/nix-build
|
||||||
${lib.getExe' pkgs.coreutils "chmod"} 1777 /var/tmp/nix-build
|
${lib.getExe' pkgs.coreutils "chmod"} 1777 /var/tmp/nix-build
|
||||||
${lib.getExe pkgs.nixos-rebuild} switch \
|
${lib.getExe pkgs.nixos-rebuild} switch \
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, lib, ... }:
|
{ self, inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
username = "john";
|
username = "john";
|
||||||
hostname = "soteria";
|
hostname = "soteria";
|
||||||
@@ -11,11 +11,27 @@ in
|
|||||||
nixos.mysops
|
nixos.mysops
|
||||||
nixos.step-ssh-host
|
nixos.step-ssh-host
|
||||||
nixos.login-text
|
nixos.login-text
|
||||||
# nixos.mtls
|
nixos.docker
|
||||||
|
nixos.mtls
|
||||||
|
nixos.janus-ca
|
||||||
|
nixos.forgejo
|
||||||
# nixos.restic-server
|
# nixos.restic-server
|
||||||
# nixos.restic-envoy
|
# nixos.restic-envoy
|
||||||
{
|
({ pkgs, ... }: {
|
||||||
networking.hostName = hostname;
|
networking.hostName = hostname;
|
||||||
|
mtls = {
|
||||||
|
enable = true;
|
||||||
|
subject = hostname;
|
||||||
|
san = [
|
||||||
|
"${hostname}.john-stream.com"
|
||||||
|
"192.168.1.142"
|
||||||
|
];
|
||||||
|
lifetime = "1h";
|
||||||
|
renew.onCalendar = "*:3/15";
|
||||||
|
renew.postCommands = [
|
||||||
|
"${lib.getExe pkgs.docker} restart envoy"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Removes password for sudo
|
# Removes password for sudo
|
||||||
security.sudo-rs.extraRules = lib.mkAfter [
|
security.sudo-rs.extraRules = lib.mkAfter [
|
||||||
@@ -39,12 +55,20 @@ in
|
|||||||
# This provides the secrets at install time
|
# This provides the secrets at install time
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
home-manager.users."${username}" = {
|
home-manager.users."${username}" = {
|
||||||
imports = with inputs.self.modules; [
|
imports = with inputs.self.modules; [
|
||||||
homeManager."${hostname}"
|
homeManager."${hostname}"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.janus-ca
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim
|
||||||
|
];
|
||||||
|
|
||||||
|
forgejo.enable = true;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -52,9 +76,6 @@ in
|
|||||||
imports = with inputs.self.modules; [
|
imports = with inputs.self.modules; [
|
||||||
homeManager.rebuild
|
homeManager.rebuild
|
||||||
homeManager.mysops
|
homeManager.mysops
|
||||||
homeManager.janus-ca
|
|
||||||
homeManager.mtls
|
|
||||||
homeManager.docker
|
|
||||||
];
|
];
|
||||||
|
|
||||||
homeManagerFlakeDir = "${config.xdg.configHome}/home-manager";
|
homeManagerFlakeDir = "${config.xdg.configHome}/home-manager";
|
||||||
@@ -63,20 +84,6 @@ in
|
|||||||
|
|
||||||
# This will provide the edit-secrets script targeting this file
|
# This will provide the edit-secrets script targeting this file
|
||||||
mysops.hostSecretFile = "${config.homeManagerFlakeDir}/modules/hosts/soteria/secrets.yaml";
|
mysops.hostSecretFile = "${config.homeManagerFlakeDir}/modules/hosts/soteria/secrets.yaml";
|
||||||
|
|
||||||
mtls = {
|
|
||||||
enable = true;
|
|
||||||
subject = hostname;
|
|
||||||
san = [
|
|
||||||
"${hostname}.john-stream.com"
|
|
||||||
"192.168.1.142"
|
|
||||||
];
|
|
||||||
lifetime = "1h";
|
|
||||||
renew.onCalendar = "*:3/15";
|
|
||||||
renew.postCommands = [
|
|
||||||
"${lib.getExe pkgs.docker} restart envoy"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration {
|
flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
|||||||
@@ -87,6 +87,19 @@
|
|||||||
${echoCmd} "Testing the evaulation of the nixos config for $HOSTNAME"
|
${echoCmd} "Testing the evaulation of the nixos config for $HOSTNAME"
|
||||||
${lib.getExe nix} eval ${flakeDir}#nixosConfigurations.$HOSTNAME.config.system.build.toplevel.drvPath
|
${lib.getExe nix} eval ${flakeDir}#nixosConfigurations.$HOSTNAME.config.system.build.toplevel.drvPath
|
||||||
'')
|
'')
|
||||||
|
|
||||||
|
(writeShellScriptBin "cleanup" ''
|
||||||
|
set -e
|
||||||
|
DAYS=$1
|
||||||
|
if [ -z "$DAYS" ]; then
|
||||||
|
${echoCmd} "usage: cleanup <days>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
${lib.getExe home-manager} expire-generations "-$DAYS days"
|
||||||
|
${lib.getExe nix} profile wipe-history --older-than "''${DAYS}d"
|
||||||
|
${lib.getExe nix} store gc
|
||||||
|
${lib.getExe nix} store optimise
|
||||||
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,16 +18,13 @@
|
|||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
home = "/home/${username}";
|
home = "/home/${username}";
|
||||||
shell = lib.mkIf config.programs.zsh.enable pkgs.zsh;
|
shell = lib.mkIf config.programs.zsh.enable pkgs.zsh;
|
||||||
extraGroups = [
|
extraGroups = [ "input" "networkmanager" ]
|
||||||
"input"
|
++ lib.optional isAdmin "wheel"
|
||||||
"networkmanager"
|
++ lib.optional config.virtualisation.docker.enable "docker"
|
||||||
] ++ lib.optionals isAdmin [
|
++ lib.optional (isAdmin && config.services.forgejo.enable) config.services.forgejo.group
|
||||||
"docker"
|
++ lib.optional (isAdmin && config.services.postgresql.enable) "postgres";
|
||||||
"wheel"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
security.sudo-rs.enable = lib.mkIf isAdmin true;
|
security.sudo-rs.enable = lib.mkIf isAdmin true;
|
||||||
|
|
||||||
home-manager.useGlobalPkgs = true;
|
home-manager.useGlobalPkgs = true;
|
||||||
|
|||||||
@@ -8,6 +8,17 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.homeManager.ghostty = { config, pkgs, lib, ... }:
|
flake.modules.homeManager.ghostty = { config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
ghosttyPackage = pkgs.symlinkJoin {
|
||||||
|
name = "ghostty-x11";
|
||||||
|
paths = [ (config.lib.nixGL.wrap pkgs.ghostty) ];
|
||||||
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||||||
|
meta.mainProgram = "ghostty";
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/ghostty --set GDK_BACKEND x11
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
{
|
{
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
TERMINAL = "ghostty";
|
TERMINAL = "ghostty";
|
||||||
@@ -22,7 +33,7 @@
|
|||||||
programs.ghostty = {
|
programs.ghostty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
package = config.lib.nixGL.wrap pkgs.ghostty;
|
package = ghosttyPackage;
|
||||||
settings = {
|
settings = {
|
||||||
command = "TERM=xterm-256color ${lib.getExe pkgs.zsh}";
|
command = "TERM=xterm-256color ${lib.getExe pkgs.zsh}";
|
||||||
font-size = 12;
|
font-size = 12;
|
||||||
@@ -32,6 +43,7 @@
|
|||||||
shell-integration = "zsh";
|
shell-integration = "zsh";
|
||||||
shell-integration-features = [ "no-title" "sudo" ];
|
shell-integration-features = [ "no-title" "sudo" ];
|
||||||
gtk-single-instance = true;
|
gtk-single-instance = true;
|
||||||
|
mouse-scroll-multiplier = 0.375;
|
||||||
|
|
||||||
window-position-x = 25;
|
window-position-x = 25;
|
||||||
window-position-y = 25;
|
window-position-y = 25;
|
||||||
@@ -60,13 +72,12 @@
|
|||||||
# https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970
|
# https://github.com/ghostty-org/ghostty/discussions/3763#discussioncomment-11699970
|
||||||
xdg.desktopEntries."com.mitchellh.ghostty" =
|
xdg.desktopEntries."com.mitchellh.ghostty" =
|
||||||
let
|
let
|
||||||
ghosttyCmd = "nixGLMesa ${lib.getExe pkgs.ghostty}";
|
ghosttyCmd = lib.getExe ghosttyPackage;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
name = "Ghostty";
|
name = "Ghostty";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
comment = "A terminal emulator";
|
comment = "A terminal emulator";
|
||||||
# exec = "nixGLMesa ghostty";
|
|
||||||
exec = ghosttyCmd;
|
exec = ghosttyCmd;
|
||||||
icon = "com.mitchellh.ghostty";
|
icon = "com.mitchellh.ghostty";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
@@ -85,7 +96,6 @@
|
|||||||
new-window = {
|
new-window = {
|
||||||
name = "New Window";
|
name = "New Window";
|
||||||
exec = ghosttyCmd;
|
exec = ghosttyCmd;
|
||||||
# exec = "nixGLMesa ghostty";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
+137
-9
@@ -6,25 +6,153 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
perSystem = { system, pkgs, ... }: {
|
perSystem = { system, pkgs, config, ... }: {
|
||||||
packages.my-neovim = (inputs.nvf.lib.neovimConfiguration {
|
packages.my-neovim = ((inputs.nvf.lib.neovimConfiguration {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
modules = [
|
modules = [
|
||||||
{
|
{
|
||||||
|
# https://nvf.notashelf.dev/search.html
|
||||||
config.vim = {
|
config.vim = {
|
||||||
|
options = {
|
||||||
|
number = true;
|
||||||
|
relativenumber = true;
|
||||||
|
expandtab = true;
|
||||||
|
shiftwidth = 4;
|
||||||
|
tabstop = 4;
|
||||||
|
softtabstop = 4;
|
||||||
|
|
||||||
|
wrap = true;
|
||||||
|
linebreak = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
syntaxHighlighting = true;
|
||||||
|
|
||||||
# Enable custom theming options
|
# Enable custom theming options
|
||||||
theme.enable = true;
|
theme.enable = true;
|
||||||
|
theme.name = "catppuccin";
|
||||||
|
theme.style = "mocha";
|
||||||
|
|
||||||
|
git.enable = true;
|
||||||
|
# git.neogit.enable = true;
|
||||||
|
|
||||||
|
# https://github.com/akinsho/toggleterm.nvim
|
||||||
|
terminal.toggleterm.enable = true;
|
||||||
|
terminal.toggleterm.lazygit.enable = true;
|
||||||
|
terminal.toggleterm.lazygit.direction = "float";
|
||||||
|
terminal.toggleterm.lazygit.mappings.open = "<C-g>";
|
||||||
|
|
||||||
|
|
||||||
|
utility.nix-develop.enable = true;
|
||||||
|
|
||||||
|
utility.oil-nvim.enable = true;
|
||||||
|
utility.oil-nvim.gitStatus.enable = true;
|
||||||
|
|
||||||
|
filetree.neo-tree = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# lazy = {
|
||||||
|
# enable = true;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# globals = {
|
||||||
|
# SimpylFold_docstring_preview = 1;
|
||||||
|
# SimpylFold_fold_blank = 0;
|
||||||
|
# };
|
||||||
|
|
||||||
|
# extraPlugins = with pkgs.vimPlugins; {
|
||||||
|
# SimpylFold.package = SimpylFold;
|
||||||
|
# };
|
||||||
|
|
||||||
|
telescope = {
|
||||||
|
enable = true;
|
||||||
|
extensions = [
|
||||||
|
{
|
||||||
|
name = "fzf";
|
||||||
|
packages = [pkgs.vimPlugins.telescope-fzf-native-nvim];
|
||||||
|
setup = {fzf = {fuzzy = true;};};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# Enable Treesitter
|
# Enable Treesitter
|
||||||
treesitter.enable = true;
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [ python ];
|
||||||
|
};
|
||||||
|
|
||||||
# Other options will go here. Refer to the config
|
lsp.enable = true;
|
||||||
# reference in Appendix B of the nvf manual.
|
|
||||||
# ...
|
languages = {
|
||||||
|
enableTreesitter = true;
|
||||||
|
enableFormat = true;
|
||||||
|
|
||||||
|
markdown = {
|
||||||
|
enable = true;
|
||||||
|
extensions = {
|
||||||
|
# render-markdown-nvim.enable = true;
|
||||||
|
markview-nvim.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
bash.enable = true;
|
||||||
|
css.enable = true;
|
||||||
|
yaml.enable = true;
|
||||||
|
toml.enable = true;
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
python = {
|
||||||
|
enable = true;
|
||||||
|
dap.enable = true;
|
||||||
|
format.type = [ "ruff" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
desc = "Edit key mappings";
|
||||||
|
key = "<leader>ekm";
|
||||||
|
mode = [ "n" ];
|
||||||
|
silent = false;
|
||||||
|
action = "<cmd>:edit +/keymaps /home/john/.config/home-manager/jsl-dendritic/modules/programs/neovim.nix<CR>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Home Manager Switch";
|
||||||
|
key = "<leader>nhms";
|
||||||
|
mode = [ "n" ];
|
||||||
|
silent = false;
|
||||||
|
action = "<cmd>:TermExec cmd='clear && nhms && exit' name='Nix Home Manager Switch' direction=float<CR>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Key Maps [Telescope]";
|
||||||
|
key = "<leader>fkm";
|
||||||
|
mode = "n";
|
||||||
|
silent = false;
|
||||||
|
action = "<cmd>:Telescope keymaps<CR>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
desc = "Toggle Filesystem Tree [NeoTree]";
|
||||||
|
key = "<C-b>";
|
||||||
|
mode = [ "n" "v" "t" ];
|
||||||
|
silent = false;
|
||||||
|
action = "<cmd>:Neotree toggle filesystem left action=show<CR>";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<C-`>";
|
||||||
|
mode = ["n" "v" "t"];
|
||||||
|
silent = false;
|
||||||
|
action = "<cmd>:ToggleTerm<CR>";
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
})
|
}).neovim).overrideAttrs (old: {
|
||||||
.neovim;
|
pname = "my-neovim";
|
||||||
|
version = "custom";
|
||||||
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,10 @@ in
|
|||||||
|
|
||||||
matchBlocks = lib.mkMerge [
|
matchBlocks = lib.mkMerge [
|
||||||
{
|
{
|
||||||
|
"john-pc-ubuntu" = {
|
||||||
|
hostname = "192.168.1.85";
|
||||||
|
};
|
||||||
|
|
||||||
"*" = lib.mkMerge [
|
"*" = lib.mkMerge [
|
||||||
{
|
{
|
||||||
user = "john";
|
user = "john";
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
networking.nameservers = [ "192.168.1.150" ];
|
networking.nameservers = [ "192.168.1.150" ];
|
||||||
networking.dhcpcd.extraConfig = "nohook resolv.conf";
|
networking.dhcpcd.extraConfig = "nohook resolv.conf";
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
step-cli
|
# step-cli
|
||||||
(writeShellScriptBin "ssh-host-cert-renew" ''
|
(writeShellScriptBin "ssh-host-cert-renew" ''
|
||||||
${lib.getExe pkgs.step-cli} ssh certificate \
|
${lib.getExe pkgs.step-cli} ssh certificate \
|
||||||
--host --sign \
|
--host --sign \
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
wantedBy = [ ];
|
wantedBy = [ ];
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "network-online.target" ];
|
wants = [ "network-online.target" ];
|
||||||
path = [ pkgs.step-cli pkgs.openssh pkgs.coreutils pkgs.systemd ];
|
path = with pkgs; [ coreutils systemd step-cli openssh ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "root";
|
User = "root";
|
||||||
|
|||||||
@@ -17,6 +17,9 @@ in
|
|||||||
crt = "";
|
crt = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
environment.systemPackages = with pkgs; [ step-ca step-cli ];
|
environment.systemPackages = with pkgs; [
|
||||||
|
step-ca
|
||||||
|
step-cli
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user