Compare commits

21 Commits

Author SHA1 Message Date
John Lancaster 244519f406 rest server 2026-04-16 17:31:57 -05:00
John Lancaster 213d97d13e added quotes to fix error 2026-04-15 23:20:08 -05:00
John Lancaster 51a2b8078f added joplin desktop to john-p14s 2026-04-15 23:20:08 -05:00
John Lancaster 5d5ad75c06 added proton vpn to john-p14s 2026-04-14 17:30:22 -05:00
John Lancaster e63ca7b244 removed proton vpn from desktop feature 2026-04-14 17:30:11 -05:00
John Lancaster ff7d03ecfd modernized homeConfig call 2026-04-14 17:29:56 -05:00
John Lancaster c6b1361a68 update eza config 2026-04-14 17:29:28 -05:00
John Lancaster 934aeb429c prune 2026-04-13 09:28:33 -05:00
John Lancaster dbbdf8991f moved wrapper inputs 2026-04-13 08:58:49 -05:00
John Lancaster 70315d5020 nvim-web-devicons 2026-04-12 23:21:57 -05:00
John Lancaster 7080410c0c more writeShellApplication 2026-04-12 23:21:12 -05:00
John Lancaster 35e1d5ee61 writeShellApplication updates 2026-04-12 23:21:12 -05:00
John Lancaster ec5ff115ce writeShellApplication reworks 2026-04-12 23:21:12 -05:00
John Lancaster 58066d2a08 flake.lock update 2026-04-12 21:18:35 -05:00
John Lancaster bf478b5f38 enabled ssh certs for laptop 2026-04-12 21:17:51 -05:00
John Lancaster e18c28905d fixes 2026-04-11 09:16:54 -05:00
John Lancaster e8ac1fb552 added octo-nvim 2026-04-11 09:13:53 -05:00
John Lancaster 630e385fb1 neovim-min 2026-04-11 00:21:46 -05:00
John Lancaster 6df0f8d1ab persystem wrapper 2026-04-10 09:35:35 -05:00
John Lancaster c044f2aa5a fix 2026-04-10 08:49:56 -05:00
John Lancaster 1caf0fa10d started zsh wrapper 2026-04-10 08:48:40 -05:00
15 changed files with 360 additions and 174 deletions
Generated
+19 -19
View File
@@ -18,11 +18,11 @@
}, },
"flake-file": { "flake-file": {
"locked": { "locked": {
"lastModified": 1774886516, "lastModified": 1775848911,
"narHash": "sha256-w2LoQVM6DXrSdGUZBZqa1nYkMzHoB0t82DrptzZKhTs=", "narHash": "sha256-dqva/tlWxsXj32wYPdt06UrrR4l2QdK9JWyvPooWRi4=",
"owner": "vic", "owner": "vic",
"repo": "flake-file", "repo": "flake-file",
"rev": "3daadf37de2bb85b0ff34e2a7ab0d71e077c2b9e", "rev": "b36cbd5fc01e9794a001ccb0c58b314efaabae08",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -95,11 +95,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1775781825, "lastModified": 1776046499,
"narHash": "sha256-L5yKTpR+alrZU2XYYvIxCeCP4LBHU5jhwSj7H1VAavg=", "narHash": "sha256-Wzc4nn07/0RL21ypPHRzNDQZcjhIC8LaYo7QJQjM5T4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "e35c39fca04fee829cecdf839a50eb9b54d8a701", "rev": "287f84846c1eb3b72c986f5f6bebcff0bd67440d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -215,11 +215,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1775763530, "lastModified": 1775888245,
"narHash": "sha256-QIGMZuG5QK1Z4OEMDSpEJc7JRonbemZ9S+xpBIsQuNE=", "narHash": "sha256-qTVvODr6edFBLD2lncXPF8yTQeCafZUuKVtpV3Xb3yM=",
"rev": "b0188973b4b2a5b6bdba8b65381d6cd09a533da0", "rev": "13043924aaa7375ce482ebe2494338e058282925",
"type": "tarball", "type": "tarball",
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre977728.b0188973b4b2/nixexprs.tar.xz" "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre978638.13043924aaa7/nixexprs.tar.xz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@@ -254,11 +254,11 @@
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1775756052, "lastModified": 1775892726,
"narHash": "sha256-B2O9vV5uLeXfUdDxMz3e1g1A1T9XXTl6hav0BOZzoFU=", "narHash": "sha256-1TK1pe33cEHNvGW41TP5xAzrbG1Gp7LfyFL6c3+xf+I=",
"owner": "notashelf", "owner": "notashelf",
"repo": "nvf", "repo": "nvf",
"rev": "fee5ed510e9b1648bda3764b4009682dbbff90f4", "rev": "5ab359ee7dfd3fa09a5c6f863efaf810bb9a9436",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -292,11 +292,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1775682595, "lastModified": 1775971308,
"narHash": "sha256-0E9PohY/VuESLq0LR4doaH7hTag513sDDW5n5qmHd1Q=", "narHash": "sha256-VKp9bhVSm0bT6JWctFy06ocqxGGnWHi1NfoE90IgIcY=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "d2e8438d5886e92bc5e7c40c035ab6cae0c41f76", "rev": "31ac5fe5d015f76b54058c69fcaebb66a55871a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -340,11 +340,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1775724285, "lastModified": 1775940860,
"narHash": "sha256-/ukfzDYzcuz7i+unH7XioPS3Acam6FC935XsOCaJDmY=", "narHash": "sha256-8Jxnn2uoFhm2H579ycVxFWDtrywJ6Mc8RmqWbZwk5So=",
"owner": "BirdeeHub", "owner": "BirdeeHub",
"repo": "nix-wrapper-modules", "repo": "nix-wrapper-modules",
"rev": "d79d2f910dd0d8bffd11113865923199cb304f86", "rev": "fb62851ffc5f6a4d53ebc00b93743e29b41e6224",
"type": "github" "type": "github"
}, },
"original": { "original": {
-1
View File
@@ -10,7 +10,6 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
mangohud mangohud
sublime4 sublime4
proton-vpn
]; ];
}; };
} }
+44 -45
View File
@@ -96,32 +96,35 @@ let
group, group,
}: }:
let let
catCmd = lib.getExe' pkgs.coreutils "cat";
chownCmd = lib.getExe' pkgs.coreutils "chown";
chmodCmd = lib.getExe' pkgs.coreutils "chmod";
stepCmd = lib.getExe pkgs.step-cli;
sanArgs = lib.concatMapStringsSep " " (s: "--san \"${s}\"") san; sanArgs = lib.concatMapStringsSep " " (s: "--san \"${s}\"") san;
in in
pkgs.writeShellScriptBin "mtls-generate" '' pkgs.writeShellApplication {
set -euo pipefail name = "mtls-generate";
${stepCmd} ca certificate \ runtimeInputs = with pkgs; [ coreutils step-cli ];
${subject} ${certFile} ${keyFile} \ text = ''
--not-before=-5m --not-after=${lifetime} \ set -euo pipefail
--provisioner ${provisioner} \ step ca certificate ${subject} ${certFile} ${keyFile} \
${sanArgs} \ --provisioner ${provisioner} \
"$@" --not-before=-5m --not-after=${lifetime} \
(umask 077; ${catCmd} ${certFile} ${keyFile} > ${bundleFile}) ${sanArgs} \
${chownCmd} ${user}:${group} ${certFile} ${keyFile} ${bundleFile} "$@"
${chmodCmd} 640 ${certFile} ${keyFile} ${bundleFile} (umask 077; cat ${certFile} ${keyFile} > ${bundleFile})
printf '\033[32m\033[0m \033[1mmTLS Bundle:\033[0m %s\n' ${lib.escapeShellArg bundleFile} chown ${user}:${group} ${certFile} ${keyFile} ${bundleFile}
''; chmod 640 ${certFile} ${keyFile} ${bundleFile}
printf '\033[32m\033[0m \033[1mmTLS Bundle:\033[0m %s\n' ${lib.escapeShellArg bundleFile}
'';
};
mkMtlsCheckScript = { pkgs, bundleFile }: pkgs.writeShellScriptBin "mtls-check" '' mkMtlsCheckScript = { pkgs, bundleFile }: pkgs.writeShellApplication {
${lib.getExe pkgs.openssl} x509 \ name = "mtls-check";
-noout -subject -issuer \ runtimeInputs = with pkgs; [ openssl ];
-ext subjectAltName,extendedKeyUsage \ text = ''
-enddate -in ${bundleFile} openssl x509 -noout -in ${bundleFile} \
''; -subject -issuer \
-ext subjectAltName,extendedKeyUsage \
-enddate
'';
};
mkMtlsRenewScript = { mkMtlsRenewScript = {
pkgs, pkgs,
@@ -129,12 +132,7 @@ let
systemctlArgs ? [ ], systemctlArgs ? [ ],
}: }:
let let
catCmd = lib.getExe' pkgs.coreutils "cat"; systemctlCmd = "systemctl ${lib.escapeShellArgs systemctlArgs}";
echoCmd = lib.getExe' pkgs.coreutils "echo";
chownCmd = lib.getExe' pkgs.coreutils "chown";
chmodCmd = lib.getExe' pkgs.coreutils "chmod";
stepCmd = lib.getExe pkgs.step-cli;
systemctlCmd = "${lib.getExe' pkgs.systemd "systemctl"} ${lib.escapeShellArgs systemctlArgs}";
hasReloadUnits = cfg.renew.reloadUnits != [ ]; hasReloadUnits = cfg.renew.reloadUnits != [ ];
renewReloadScript = lib.concatMapStringsSep "\n" (unit: '' renewReloadScript = lib.concatMapStringsSep "\n" (unit: ''
@@ -148,7 +146,10 @@ let
fileOwner = "${cfg.renew.user}:${cfg.renew.group}"; fileOwner = "${cfg.renew.user}:${cfg.renew.group}";
in in
pkgs.writeShellScriptBin "mtls-renew" '' pkgs.writeShellApplication {
name = "mtls-renew";
runtimeInputs = with pkgs; [ coreutils step-cli systemd ];
text = ''
set -euo pipefail set -euo pipefail
YELLOW_BANG="\e[33m!\e[0m" YELLOW_BANG="\e[33m!\e[0m"
@@ -161,33 +162,31 @@ let
shift shift
;; ;;
*) *)
${echoCmd} -e "$YELLOW_BANG Warning: ignoring unrecognized argument '$1'" echo -e "$YELLOW_BANG Warning: ignoring unrecognized argument '$1'"
exit 1 exit 1
;; ;;
esac esac
done done
if [[ $force -eq 0 ]] && ! ${stepCmd} certificate needs-renewal "${cfg.certFile}"; then if [[ $force -eq 0 ]] && ! step certificate needs-renewal "${cfg.certFile}"; then
${echoCmd} "Skipping renew" echo "Skipping renew"
exit 0 exit 0
fi fi
${echoCmd} "Renewing mTLS certificate" echo "Renewing mTLS certificate"
${stepCmd} ca renew --force "${cfg.certFile}" "${cfg.keyFile}" step ca renew --force "${cfg.certFile}" "${cfg.keyFile}"
(umask 077; ${catCmd} "${cfg.certFile}" "${cfg.keyFile}" > "${cfg.bundleFile}") (umask 077; cat "${cfg.certFile}" "${cfg.keyFile}" > "${cfg.bundleFile}")
${chownCmd} ${fileOwner} ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile} chown ${fileOwner} ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile}
${chmodCmd} 640 ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile} chmod 640 ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile}
${lib.optionalString hasReloadUnits '' ${lib.optionalString hasReloadUnits ''
${echoCmd} "Reloading units: ${lib.concatStringsSep ", " cfg.renew.reloadUnits}" echo "Reloading units: ${lib.concatStringsSep ", " cfg.renew.reloadUnits}"
${renewReloadScript} ${renewReloadScript}
''} ''}
${lib.optionalString hasPostCommands '' ${lib.optionalString hasPostCommands ''echo "Post commands:" ${renewPostCommands}''}
${echoCmd} "Post commands:" '';
${renewPostCommands} };
''}
'';
mkNixosMtlsRenewService = { pkgs, cfg, ... }: mkNixosMtlsRenewService = { pkgs, cfg, ... }:
{ {
+1 -3
View File
@@ -34,9 +34,7 @@
xclip xclip
jq jq
ripgrep ripgrep
(writeShellScriptBin "ds" '' (writeShellScriptBin "ds" ''${lib.getExe pkgs.gdu} -x -I /snap /'')
${lib.getExe pkgs.gdu} -x -I /snap /
'')
]; ];
}; };
}; };
+2 -9
View File
@@ -3,7 +3,7 @@ let
username = "john"; username = "john";
hostname = "janus"; hostname = "janus";
ca-url = "https://janus.john-stream.com/"; ca-url = "https://janus.john-stream.com/";
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6"; fingerprint = builtins.readFile ./fingerprint;
in in
{ {
flake.modules.nixos.janus-ca = flake.modules.nixos.janus-ca =
@@ -95,14 +95,7 @@ in
]; ];
}; };
flake-file.inputs = { perSystem = { system, pkgs, lib, ... }: {
wrappers = {
url = "github:lassulus/wrappers";
inputs.nixpkgs.follows = "nixpkgs";
};
};
perSystem = { pkgs, lib, ... }: {
packages.janus-ca = inputs.wrappers.lib.wrapPackage { packages.janus-ca = inputs.wrappers.lib.wrapPackage {
inherit pkgs; inherit pkgs;
package = pkgs.step-cli; package = pkgs.step-cli;
+1
View File
@@ -0,0 +1 @@
2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6
@@ -125,7 +125,10 @@
bash bash
discord discord
my-neovim my-neovim
proton-vpn
joplin-desktop
]; ];
ssh.certificates.enable = true;
ssh.matchSets = { ssh.matchSets = {
appdaemon = true; appdaemon = true;
homelab = true; homelab = true;
+21 -22
View File
@@ -1,28 +1,25 @@
{ self, inputs, ... }: { withSystem, self, inputs, ... }:
let let
username = "john"; username = "john";
hostname = "john-pc-ubuntu"; hostname = "john-pc-ubuntu";
testHost = "soteria"; # which host to test build
testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; # test-nix
resolvedTarget = "test-nix";
# testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3"; # soteria # testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3"; # soteria
# testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f"; # test-nix
testHost = "soteria"; # which host to test build
testTarget = "test-nix";
in 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"; selfPkgs = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
resticPasswordFile = "${config.xdg.configHome}/restic/password.txt"; resticPasswordFile = "${config.xdg.configHome}/restic/password.txt";
flakeDir = "${config.xdg.configHome}/home-manager/jsl-dendritic";
testPushCmd = (pkgs.writeShellScriptBin "test-push" '' test-push = with pkgs; writeShellApplication {
${lib.getExe' pkgs.coreutils "echo"} "Pushing ${testHost} to ${resolvedTarget}" name = "test-push";
${lib.getExe pkgs.nh} os switch ${flakeDir}#${testHost} \ runtimeInputs = [ nh ];
-e passwordless \ text = ''nh os switch ${flakeDir}#${testHost} --target-host root@${testTarget} -e none'';
--target-host ${resolvedTarget} \ };
--diff always \
"$@"
'');
in in
{ {
imports = with inputs.self.modules.homeManager; [ imports = with inputs.self.modules.homeManager; [
@@ -46,8 +43,11 @@ in
home.homeDirectory = "/home/${username}"; home.homeDirectory = "/home/${username}";
home.packages = with pkgs; [ home.packages = with pkgs; [
nixos-rebuild nixos-rebuild
testPushCmd test-push
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim selfPkgs.neovim-min
# ${selfPkgs}.my-neovim
# selfPkgs.richPrinter
selfPkgs.janus-ca
]; ];
shell.program = "zsh"; shell.program = "zsh";
@@ -109,10 +109,9 @@ in
}; };
}; };
flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration { flake.homeConfigurations."john@john-pc-ubuntu" = withSystem "x86_64-linux" (ctx@{ config, inputs', ...}:
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; }; inputs.home-manager.lib.homeManagerConfiguration {
modules = with inputs.self.modules; [ pkgs = inputs'.nixpkgs.legacyPackages;
homeManager."${hostname}" modules = [ inputs.self.modules.homeManager."${hostname}" ];
]; });
};
} }
+3 -2
View File
@@ -8,6 +8,7 @@ forgejo:
#ENC[AES256_GCM,data:ZqwgnKjaolJtjcy287fnDOkb/oSLnBpfWfsTeVPwbIE8YLRSoPP4gbCnHJBLq+TJNNI=,iv:zTvw4ZS6C1ifUwOijNLuTfUQ3JM+5gj1X2f/s8MwWXc=,tag:Y1yKlL+jIRHVBulGlSErog==,type:comment] #ENC[AES256_GCM,data:ZqwgnKjaolJtjcy287fnDOkb/oSLnBpfWfsTeVPwbIE8YLRSoPP4gbCnHJBLq+TJNNI=,iv:zTvw4ZS6C1ifUwOijNLuTfUQ3JM+5gj1X2f/s8MwWXc=,tag:Y1yKlL+jIRHVBulGlSErog==,type:comment]
jwt_secret: ENC[AES256_GCM,data:e59MlATOorsTIQjtTUKfX5Yo3CVsbbfuKczp1gh1m2D1kkZK3ORFztYpjg==,iv:JH3PVUmXToiThEKDkDJ8MGVMAPlIEgPSWhru+9WgNjk=,tag:FfDpaCPejpw6kGDkxJwDWw==,type:str] jwt_secret: ENC[AES256_GCM,data:e59MlATOorsTIQjtTUKfX5Yo3CVsbbfuKczp1gh1m2D1kkZK3ORFztYpjg==,iv:JH3PVUmXToiThEKDkDJ8MGVMAPlIEgPSWhru+9WgNjk=,tag:FfDpaCPejpw6kGDkxJwDWw==,type:str]
lfs_jwt_secret: ENC[AES256_GCM,data:xi9PEKFUGRyc3YOg3JM3KrrENi9xsbeBjiz4R16SK5WDafoGFLazN6KRJQ==,iv:1IhPyQDwA8tZ22pfZJiU8TRTCLCHC/HAnKdmSGDfvcM=,tag:rLdREVSKBm67rt8ayN16Vw==,type:str] lfs_jwt_secret: ENC[AES256_GCM,data:xi9PEKFUGRyc3YOg3JM3KrrENi9xsbeBjiz4R16SK5WDafoGFLazN6KRJQ==,iv:1IhPyQDwA8tZ22pfZJiU8TRTCLCHC/HAnKdmSGDfvcM=,tag:rLdREVSKBm67rt8ayN16Vw==,type:str]
restic_password: ENC[AES256_GCM,data:u7QOZXJkxVG4J75K5nphb2uJGdz6jbWuVSsKKu+41fshp7cVoRijtr/Cs02LjVse,iv:bt1W2FeBTG6ypBFYzMPXPIkYTSn0uHURY2ui6MRgYY8=,tag:DObAMws/zQcM+UKUe9EECA==,type:str]
sops: sops:
age: age:
- recipient: age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt - recipient: age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt
@@ -37,7 +38,7 @@ sops:
Yjd0MUcxcExvWVpCOUR3MkdZdGQyWUkKnru0Y2A98+0Mps7EtVK7ct3vPqIGveUt Yjd0MUcxcExvWVpCOUR3MkdZdGQyWUkKnru0Y2A98+0Mps7EtVK7ct3vPqIGveUt
E5fzpcKvdefzObrx7BPTwJ19t2fZg/dSi7HKwx3vmKZSzyQaqJOzsg== E5fzpcKvdefzObrx7BPTwJ19t2fZg/dSi7HKwx3vmKZSzyQaqJOzsg==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2026-04-02T03:47:52Z" lastmodified: "2026-04-04T23:18:43Z"
mac: ENC[AES256_GCM,data:NvCF78rzYOv2Ulf3TLB4eKtYEqNkfSzPBPRXcpTTO9QoSH3axdapkhUzsSq2d30RV/F/PLMbMaERMgW1SFT0Uikvk0s5ALmwN29MMwA6BMyup5bzOQeOIxOoeYrKOeqCJdI3ZhtqV/ebvyTebVI7Q6Jw0QKf+9SW2RfYGFJkKF0=,iv:VSoGZkzSzI9SPnvrzyIgWgW/teRNiFlf5fdmHKVg2TE=,tag:qm/jUdQ63MdWUxBDJ9kxww==,type:str] mac: ENC[AES256_GCM,data:qBgeli5lHb4pyA8nAADBuRBAaq8VbAIsFI37OZtgnbnoHW2crxo3YC+EknaIYnZpZ48kwVhQS5lGRjI6JsWWhTH3+LVAhTmS2Qj/pZTD/JDLK6XJGXS4U9nB7m9aGYyW8gFCy9/DfoJWGsS//+ZmUikKPfd5kMZgh1zGoYCIGug=,iv:h+2fA+bO2SMCNrEslP36x3BPRaIy25cU/DNX8CYSC6A=,tag:RvVyUZ4ONRaKaqGiT31eUQ==,type:str]
unencrypted_suffix: _unencrypted unencrypted_suffix: _unencrypted
version: 3.12.2 version: 3.12.2
+17 -2
View File
@@ -47,8 +47,8 @@ in
]; ];
lifetime = "12h"; lifetime = "12h";
renew.onCalendar = "*:3/15"; renew.onCalendar = "*:3/15";
renew.reloadUnits = [ "forgejo.service" ]; renew.reloadUnits = [ "forgejo.service" "restic-rest-server.service" ];
certReaders = [ config.services.forgejo.user "postgres" ]; certReaders = [ config.services.forgejo.user "restic" ];
}; };
forgejo = { forgejo = {
enable = true; enable = true;
@@ -57,11 +57,25 @@ in
port = 443; port = 443;
}; };
networking.firewall.allowedTCPPorts = [ 8000 ];
services.restic.server = {
enable = true;
privateRepos = true;
listenAddress = "0.0.0.0:8000";
extraFlags = [
"--no-auth"
"--tls"
"--tls-cert=${config.mtls.certFile}"
"--tls-key=${config.mtls.keyFile}"
];
};
loginText.extraServiceStatus = { loginText.extraServiceStatus = {
Docker = "docker"; Docker = "docker";
"mTLS Renewal" = "mtls-renew.timer"; "mTLS Renewal" = "mtls-renew.timer";
Forgejo = "forgejo.service"; Forgejo = "forgejo.service";
"Forgejo Backup" = "forgejo-dump.timer"; "Forgejo Backup" = "forgejo-dump.timer";
"Restic REST Server" = "restic-rest-server.service";
}; };
step-ssh-host.hostname = hostname; step-ssh-host.hostname = hostname;
@@ -79,6 +93,7 @@ in
environment.systemPackages = [ environment.systemPackages = [
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.janus-ca inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.janus-ca
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh
]; ];
}) })
]; ];
+85 -58
View File
@@ -6,11 +6,21 @@
flakeDir = config.rebuild.flakeDir; flakeDir = config.rebuild.flakeDir;
echoCmd = lib.getExe' pkgs.coreutils "echo"; echoCmd = lib.getExe' pkgs.coreutils "echo";
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)"; hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
nfs = (pkgs.writeShellScriptBin "nfs" ''
HOSTNAME=${hostnameCmd} nfs = with pkgs; writeShellApplication {
${echoCmd} "Switching to the $HOSTNAME nixos profile" name = "nfs";
sudo ${lib.getExe pkgs.nixos-rebuild} switch --impure --flake ${flakeDir}#$HOSTNAME runtimeInputs = [ coreutils hostname nh ];
''); text = ''
HOSTNAME=$(hostname -s)
echo "Switching to the $HOSTNAME nixos profile"
nh os switch "$@" "${flakeDir}#$HOSTNAME"
'';
};
nfsu = with pkgs; writeShellApplication {
name = "nfsu";
runtimeInputs = [ nfs pkgs.git ];
text = ''nfs --refresh "$@"'';
};
in in
{ {
options.rebuild = { options.rebuild = {
@@ -22,29 +32,73 @@
}; };
config = { config = {
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [ nfs nfsu ];
nfs
(writeShellScriptBin "nfsu" ''
${lib.getExe nix} flake update --impure --flake ${flakeDir}
${lib.getExe git} -C ${flakeDir} add ${flakeDir}/flake.lock > /dev/null 2>&1
${lib.getExe nfs}
'')
];
}; };
}; };
flake.modules.homeManager.rebuild = flake.modules.homeManager.rebuild =
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
let let
nixBin = lib.getExe pkgs.nix;
flakeDir = config.homeManagerFlakeDir; flakeDir = config.homeManagerFlakeDir;
echoCmd = lib.getExe' pkgs.coreutils "echo";
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)"; hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
nhms = (pkgs.writeShellScriptBin "nhms" ''
HOSTNAME=${hostnameCmd} flake-parts-check = with pkgs; writeShellApplication {
${echoCmd} "Switching to the $HOSTNAME home-manager profile" name = "flake-parts-check";
${lib.getExe pkgs.nh} home switch ${flakeDir} -c $HOSTNAME "$@" runtimeInputs = [ nix ];
''); text = ''
cd ${flakeDir}
nix run "${flakeDir}#write-flake"
nix flake check
'';
};
nhms = with pkgs; writeShellApplication {
name = "nhms";
runtimeInputs = [ coreutils hostname nh ];
text = ''
HOSTNAME=$(hostname -s)
echo "Switching to the $HOSTNAME home-manager profile"
nh home switch ${flakeDir} -c "$HOSTNAME" "$@"
'';
};
nhmu = with pkgs; writeShellApplication {
name = "nhmu";
runtimeInputs = [ nhms ];
text = ''nhms --update'';
};
test-build = with pkgs; writeShellApplication {
name = "test-build";
runtimeInputs = [ coreutils nix hostname ];
text = ''
if [ -z "$1" ]; then
HOSTNAME=$(hostname -s)
else
HOSTNAME="$1"
fi
echo "Testing the evaulation of the nixos config for $HOSTNAME"
nix eval "${flakeDir}#nixosConfigurations.$HOSTNAME.config.system.build.toplevel.drvPath"
'';
};
cleanup = with pkgs; writeShellApplication {
name = "cleanup";
runtimeInputs = [ coreutils home-manager nix ];
text = ''
set -e
DAYS=$1
if [ -z "$DAYS" ]; then
echo "usage: cleanup <days>"
exit 1
fi
home-manager expire-generations "-$DAYS days"
nix profile wipe-history --older-than "''${DAYS}d"
nix store gc
nix store optimise
'';
};
in in
{ {
options = { options = {
@@ -53,52 +107,25 @@
type = lib.types.str; type = lib.types.str;
default = "${config.xdg.configHome}/home-manager"; default = "${config.xdg.configHome}/home-manager";
}; };
buildHostname = lib.mkOption {
description = "Hostname for the NixOS configuration to use.";
type = lib.types.str;
default = hostnameCmd;
};
}; };
config = { config = {
home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] '' home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
run ${echoCmd} "Home Manager flake directory: ${flakeDir}" run echo "Home Manager flake directory: ${flakeDir}"
''; '';
home.packages = with pkgs; [ home.packages = with pkgs; [
home-manager home-manager
(writeShellScriptBin "flake-parts-check" '' (symlinkJoin {
cd ${flakeDir} name = "build-tools";
${nixBin} run "${flakeDir}#write-flake" paths = [
${nixBin} flake check flake-parts-check
'') nhms
nhms nhmu
(writeShellScriptBin "nhmu" '' test-build
${lib.getExe nhms} --update cleanup
'') ];
})
(writeShellScriptBin "test-build" ''
if [ -z "$1" ]; then
HOSTNAME=${hostnameCmd}
else
HOSTNAME="$1"
fi
${echoCmd} "Testing the evaulation of the nixos config for $HOSTNAME"
${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
'')
]; ];
}; };
}; };
+12
View File
@@ -0,0 +1,12 @@
{ self, inputs, ... }: {
flake-file.inputs = {
wrapper-modules = {
url = "github:BirdeeHub/nix-wrapper-modules";
inputs.nixpkgs.follows = "nixpkgs";
};
wrappers = {
url = "github:lassulus/wrappers";
inputs.nixpkgs.follows = "nixpkgs";
};
};
}
+16 -6
View File
@@ -1,14 +1,24 @@
{ inputs, pkgs, lib, ... }: { self, inputs, ... }:
{ {
flake.modules.homeManager.eza = { pkgs, lib, ... }: { flake.modules.homeManager.eza = { config, pkgs, lib, ... }: {
programs.eza = { programs.eza = {
enable = true; enable = true;
package = pkgs.eza;
enableBashIntegration = true; enableBashIntegration = true;
enableZshIntegration = true; enableZshIntegration = true;
}; git = true;
home.shellAliases = { icons = "auto";
ls = "${lib.getExe pkgs.eza} -algos type --follow-symlinks --all --all"; colors = "auto";
extraOptions = [
"--all"
"--long"
"--group-directories-first"
"--sort=type"
"--dereference"
"--octal-permissions"
"--smart-group"
"--no-time"
"--git"
];
}; };
}; };
} }
-5
View File
@@ -1,9 +1,4 @@
{ self, inputs, ... }: { { self, inputs, ... }: {
flake-file.inputs = {
wrapper-modules.url = "github:BirdeeHub/nix-wrapper-modules";
# wrapper-modules.inputs.nixpkgs.follows = "nixpkgs";
};
flake.modules.nixos.niri = { pkgs, lib, ... }: { flake.modules.nixos.niri = { pkgs, lib, ... }: {
programs.niri = { programs.niri = {
enable = true; enable = true;
+136 -2
View File
@@ -1,4 +1,4 @@
{ inputs, ... }: { self, inputs, ... }:
let let
username = "john"; username = "john";
in in
@@ -50,5 +50,139 @@ in
}; };
}; };
}; };
perSystem = { system, pkgs, ... }: {
packages.jsl-zsh = inputs.wrapper-modules.wrappers.zsh.wrap {
inherit pkgs;
extraPackages = with pkgs; [
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.neovim-min
btop
coreutils
curl
wget
yazi
zsh
];
};
packages.neovim-min = ((inputs.nvf.lib.neovimConfiguration {
inherit pkgs;
modules = [
{
# https://nvf.notashelf.dev/search.html
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
theme.enable = true;
theme.name = "catppuccin";
theme.style = "mocha";
git.enable = true;
# git.neogit.enable = true;
extraPlugins = with pkgs.vimPlugins; {
icons = {
package = nvim-web-devicons;
};
octo = {
package = octo-nvim;
setup = "require('octo').setup {}";
after = ["telescope" "icons"];
};
};
# 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;
filetree.neo-tree.enable = true;
telescope = {
enable = true;
extensions = [
{
name = "fzf";
packages = [pkgs.vimPlugins.telescope-fzf-native-nvim];
setup = {fzf = {fuzzy = true;};};
}
];
};
languages = {
enableTreesitter = true;
enableFormat = true;
markdown = {
enable = true;
extensions = {
markview-nvim.enable = true;
};
};
bash.enable = true;
yaml.enable = true;
toml.enable = true;
nix.enable = true;
};
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: {
pname = "neovim-min";
version = "custom";
});
};
} }