Compare commits

59 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
John Lancaster 5cb1c88e51 lockfile update 2026-04-09 23:52:03 -05:00
John Lancaster 5fcd6abdb2 test-push using nh 2026-04-05 11:22:47 -05:00
John Lancaster e59aa7a5f1 home manager rebuilds using nh pacakge for nice outputs 2026-04-05 11:13:17 -05:00
John Lancaster bf9c3c2597 lf settings 2026-04-05 11:02:37 -05:00
John Lancaster 151512a071 added nix shell-tools 2026-04-05 10:38:46 -05:00
John Lancaster 8141662832 added some oauth2 client options 2026-04-04 17:28:20 -05:00
John Lancaster 1196d69778 broke out root_url option for forgejo 2026-04-04 13:51:40 -05:00
John Lancaster c1e00a7c45 clean script updates 2026-04-04 13:44:48 -05:00
John Lancaster fe19700514 set timezone on soteria 2026-04-04 13:33:20 -05:00
John Lancaster 25ea6ac502 fixed forgejo dump 2026-04-04 13:33:12 -05:00
John Lancaster 01fde39946 updated eza alias flags 2026-04-04 13:33:02 -05:00
John Lancaster 84b32cea01 service_status motd updates 2026-04-04 13:15:29 -05:00
John Lancaster bccb96a0b3 updated soteria settings 2026-04-04 12:26:05 -05:00
John Lancaster 44fd737afe reorg 2026-04-04 12:25:56 -05:00
John Lancaster 0854439bdf disabled TCP connections for postgres 2026-04-04 12:21:50 -05:00
John Lancaster ff70a35078 janus-ca pkg updates 2026-04-04 12:09:13 -05:00
John Lancaster b8b8a445f9 mTLS generate script improvements 2026-04-04 11:09:25 -05:00
John Lancaster 13a841c8db mtls optimizations 2026-04-04 10:44:37 -05:00
John Lancaster 6c26e898b2 improving renew script 2026-04-04 09:46:55 -05:00
John Lancaster 710f13ace4 renew script tweaks 2026-04-04 09:33:08 -05:00
John Lancaster 1a7a1189e7 privileged port permissions for https 2026-04-03 18:16:29 -05:00
John Lancaster ff74205c57 mtls file permissions 2026-04-03 18:16:12 -05:00
John Lancaster 32b7932916 script tweaks 2026-04-02 17:28:06 -05:00
John Lancaster f05a3af30d forgejo secrets 2026-04-02 17:24:32 -05:00
John Lancaster 3e84eb641f added forgejo secrets to soteria 2026-04-02 07:56:35 -05:00
John Lancaster 9b51398ceb nhms switch keymap 2026-04-01 23:34:39 -05:00
John Lancaster 2a97dbf7ca slowed down the mouse scrolling in ghostty 2026-04-01 23:32:28 -05:00
John Lancaster d7e32c0a2f Merge branch 'forgejo' 2026-04-01 20:55:17 -05:00
John Lancaster 76cb1d078b added key and cert files to https config in forgejo 2026-04-01 20:48:38 -05:00
John Lancaster fb7750235f added my-neovim to soteria 2026-04-01 20:48:07 -05:00
John Lancaster 4c90263866 flake.lock update 2026-04-01 20:47:20 -05:00
John Lancaster fac9c7f5ce mtls param renames 2026-04-01 20:45:09 -05:00
John Lancaster a7b65e4eee formatting 2026-04-01 20:44:40 -05:00
John Lancaster 1fe4d59ce6 mtls options 2026-04-01 15:59:56 -05:00
John Lancaster 86bb800886 prune 2026-04-01 15:57:51 -05:00
John Lancaster c4cf7c8096 fixed postgres group 2026-04-01 15:57:44 -05:00
John Lancaster cf02260941 my-neovim shortcuts 2026-03-31 23:11:23 -05:00
John Lancaster 609d2a5cca p14 ssh config 2026-03-31 23:09:32 -05:00
24 changed files with 829 additions and 410 deletions
Generated
+53 -32
View File
@@ -18,11 +18,11 @@
}, },
"flake-file": { "flake-file": {
"locked": { "locked": {
"lastModified": 1774666175, "lastModified": 1775848911,
"narHash": "sha256-WaZxvtOvVNikiNTen2Emhds2RvzFCWIb7KU9C0eWrNA=", "narHash": "sha256-dqva/tlWxsXj32wYPdt06UrrR4l2QdK9JWyvPooWRi4=",
"owner": "vic", "owner": "vic",
"repo": "flake-file", "repo": "flake-file",
"rev": "953d01f3ae5ba50869c5e1248062198f73e971bf", "rev": "b36cbd5fc01e9794a001ccb0c58b314efaabae08",
"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": 1776046499,
"narHash": "sha256-2jfBEZUC67IlnxO5KItFCAd7Oc+1TvyV/jQlR+2ykGQ=", "narHash": "sha256-Wzc4nn07/0RL21ypPHRzNDQZcjhIC8LaYo7QJQjM5T4=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "769e07ef8f4cf7b1ec3b96ef015abec9bc6b1e2a", "rev": "287f84846c1eb3b72c986f5f6bebcff0bd67440d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -184,11 +184,11 @@
"nixos-hardware": { "nixos-hardware": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1774777275, "lastModified": 1775490113,
"narHash": "sha256-qogBiYFq8hZusDPeeKRqzelBAhZvREc7Cl+qlewGUCg=", "narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixos-hardware", "repo": "nixos-hardware",
"rev": "b8f81636927f1af0cca812d22c876bad0a883ccd", "rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -199,11 +199,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1774106199, "lastModified": 1775423009,
"narHash": "sha256-US5Tda2sKmjrg2lNHQL3jRQ6p96cgfWh3J1QBliQ8Ws=", "narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6c9a78c09ff4d6c21d0319114873508a6ec01655", "rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -215,11 +215,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1774701658, "lastModified": 1775888245,
"narHash": "sha256-5QVei2IIfVO3GqMkiiXlrZtaniOkXyMWnqbTVkItrco=", "narHash": "sha256-qTVvODr6edFBLD2lncXPF8yTQeCafZUuKVtpV3Xb3yM=",
"rev": "b63fe7f000adcfa269967eeff72c64cafecbbebe", "rev": "13043924aaa7375ce482ebe2494338e058282925",
"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.05pre978638.13043924aaa7/nixexprs.tar.xz"
}, },
"original": { "original": {
"type": "tarball", "type": "tarball",
@@ -228,11 +228,11 @@
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 1774610258, "lastModified": 1775579569,
"narHash": "sha256-HaThtroVD9wRdx7KQk0B75JmFcXlMUoEdDFNOMOlsOs=", "narHash": "sha256-/m3yyS/EnXqoPGBJYVy4jTOsirdgsEZ3JdN2gGkBr14=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "832efc09b4caf6b4569fbf9dc01bec3082a00611", "rev": "dfd9566f82a6e1d55c30f861879186440614696e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -254,11 +254,11 @@
"systems": "systems_2" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1774736237, "lastModified": 1775892726,
"narHash": "sha256-uQ+Was7QP9Bupr0XZyZXOAD32Ox8z2mJnevT2FmDwS8=", "narHash": "sha256-1TK1pe33cEHNvGW41TP5xAzrbG1Gp7LfyFL6c3+xf+I=",
"owner": "notashelf", "owner": "notashelf",
"repo": "nvf", "repo": "nvf",
"rev": "a0636d5c977743851c91d3c2e74bfac90be48835", "rev": "5ab359ee7dfd3fa09a5c6f863efaf810bb9a9436",
"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": 1775971308,
"narHash": "sha256-D+tgywBHldTc0klWCIC49+6Zlp57Y4GGwxP1CqfxZrY=", "narHash": "sha256-VKp9bhVSm0bT6JWctFy06ocqxGGnWHi1NfoE90IgIcY=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "8adb84861fe70e131d44e1e33c426a51e2e0bfa5", "rev": "31ac5fe5d015f76b54058c69fcaebb66a55871a4",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -339,11 +340,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1774767209, "lastModified": 1775940860,
"narHash": "sha256-bJxBN+ebX3yZj+KT/c+LeA4xIpoNghG233szgRFAWOc=", "narHash": "sha256-8Jxnn2uoFhm2H579ycVxFWDtrywJ6Mc8RmqWbZwk5So=",
"owner": "BirdeeHub", "owner": "BirdeeHub",
"repo": "nix-wrapper-modules", "repo": "nix-wrapper-modules",
"rev": "70795f6eb74a69d736e41ee837cd7e1a6d46c0aa", "rev": "fb62851ffc5f6a4d53ebc00b93743e29b41e6224",
"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": 1775600302,
"narHash": "sha256-2fgKImv78CXIcfo1RsY7EI4uMZ84x/MggA5rrusYc7c=",
"owner": "lassulus",
"repo": "wrappers",
"rev": "9d8397d8ef1ac35763085f3338589f558128f7db",
"type": "github"
},
"original": {
"owner": "lassulus",
"repo": "wrappers",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",
+4
View File
@@ -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";
};
}; };
} }
-1
View File
@@ -10,7 +10,6 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
mangohud mangohud
sublime4 sublime4
proton-vpn
]; ];
}; };
} }
+116 -31
View File
@@ -2,10 +2,14 @@
flake.modules.nixos.forgejo = {config, pkgs, lib, ... }: flake.modules.nixos.forgejo = {config, pkgs, lib, ... }:
let let
cfg = config.forgejo; cfg = config.forgejo;
needsPrivilegedPort = cfg.port < 1024;
in in
{ {
options.forgejo = { options.forgejo = {
enable = lib.mkEnableOption "Enable Forgejo backed with PostgreSQL"; enable = lib.mkEnableOption "Enable Forgejo backed with PostgreSQL";
root_url = lib.mkOption {
type = lib.types.str;
};
port = lib.mkOption { port = lib.mkOption {
type = lib.types.port; type = lib.types.port;
@@ -25,38 +29,119 @@
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ]; networking.firewall.allowedTCPPorts = lib.optionals cfg.openFirewall [ cfg.port ];
services.forgejo = { systemd.services.forgejo.serviceConfig = lib.mkIf needsPrivilegedPort {
enable = true; AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
lfs.enable = true; CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];
settings.server = lib.mkMerge [ PrivateUsers = lib.mkForce false;
{ };
HTTP_PORT = cfg.port;
DISABLE_SSH = true; sops.secrets = {
} "forgejo/secret_key".owner = config.services.forgejo.user;
(lib.mkIf cfg.https { "forgejo/internal_token".owner = config.services.forgejo.user;
ROOT_URL = "https://forgejo.john-stream.com"; "forgejo/jwt_secret".owner = config.services.forgejo.user;
PROTOCOL = "https"; "forgejo/lfs_jwt_secret".owner = config.services.forgejo.user;
COOKIE_SECURE = true; };
})
services = {
forgejo = {
enable = true;
lfs.enable = true;
database.type = "postgres";
settings = {
DEFAULT = {
RUN_MODE = "dev";
};
server = lib.mkMerge [
{
HTTP_PORT = cfg.port;
DISABLE_SSH = true;
ROOT_URL = cfg.root_url;
}
(lib.mkIf cfg.https {
PROTOCOL = "https";
COOKIE_SECURE = true;
KEY_FILE = config.mtls.keyFile;
CERT_FILE = config.mtls.certFile;
})
];
oauth2_client = {
ENABLE_AUTO_REGISTRATION = true;
USERNAME = "nickname";
UPDATE_AVATAR = true;
ACCOUNT_LINKING = "login";
REGISTER_EMAIL_CONFIRM = false;
};
repository = {
ENABLE_PUSH_CREATE_USER = true;
};
ui.SHOW_USER_EMAIL = false;
markup = {
ENABLED = true;
};
};
secrets = {
security = {
SECRET_KEY = lib.mkForce config.sops.secrets."forgejo/secret_key".path;
INTERNAL_TOKEN = lib.mkForce config.sops.secrets."forgejo/internal_token".path;
};
oauth2.JWT_SECRET = lib.mkForce config.sops.secrets."forgejo/jwt_secret".path;
server.LFS_JWT_SECRET = lib.mkForce config.sops.secrets."forgejo/lfs_jwt_secret".path;
};
dump = {
enable = true;
type = "tar";
interval = "*-*-* 00/12:00:00";
};
};
postgresql = {
enable = true;
enableTCPIP = false;
};
};
# https://forgejo.org/docs/latest/admin/command-line/#dump
systemd.services.forgejo-dump.serviceConfig.ExecStart = lib.mkForce ''
${lib.getExe config.services.forgejo.package} dump --verbose \
--type ${config.services.forgejo.dump.type} \
--database postgres \
--work-path ${config.services.forgejo.dump.backupDir}
'';
environment.systemPackages =
let
systemctl = lib.getExe' pkgs.systemd "systemctl";
clean-forgejo = (pkgs.writeShellScriptBin "clean-forgejo" ''
set -euo pipefail
sudo ${systemctl} stop forgejo.service
${lib.getExe' pkgs.coreutils "echo"} "Stopped Forgejo"
sudo ${lib.getExe' pkgs.coreutils "rm"} -rf ${config.services.forgejo.stateDir}
${lib.getExe' pkgs.coreutils "echo"} "Removed ${config.services.forgejo.stateDir}"
'');
clean-postgres = (pkgs.writeShellScriptBin "clean-postgres" ''
set -euo pipefail
sudo ${systemctl} stop postgresql.service
${lib.getExe' pkgs.coreutils "echo"} "Stopped PostgreSQL"
sudo ${lib.getExe' pkgs.coreutils "rm"} -rf ${config.services.postgresql.dataDir}
${lib.getExe' pkgs.coreutils "echo"} "Removed ${config.services.postgresql.dataDir}"
'');
in [
clean-forgejo
clean-postgres
(pkgs.writeShellScriptBin "clean-all" ''
set -euo pipefail
GREEN_CHECK="\e[32m\e[0m"
YELLOW_BANG="\e[33m!\e[0m"
${lib.getExe' pkgs.coreutils "echo"} -n -e "$YELLOW_BANG Remove everything related to Forgejo and the PostgreSQL database behind it?"
read -p " (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]; then
${lib.getExe clean-forgejo}
${lib.getExe clean-postgres}
${lib.getExe' pkgs.coreutils "echo"} -e "$GREEN_CHECK Removed everything related to forgejo"
fi
'')
]; ];
database = {
type = "postgres";
port = config.services.postgresql.settings.port;
# createDatabase = false;
};
# dump = {
# enable = true;
# interval = "12h";
# };
};
services.postgresql = {
enable = true;
settings = {
};
};
}; };
}; };
} }
+141 -123
View File
@@ -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 {
@@ -61,9 +66,9 @@ let
default = "root"; default = "root";
}; };
group = lib.mkOption { group = lib.mkOption {
description = "Group to run the mTLS renewal service as. Defaults to the configured renewal user when null."; description = "Group to run the mTLS renewal service as. Defaults to the configured renewal user.";
type = lib.types.nullOr lib.types.str; type = lib.types.nullOr lib.types.str;
default = null; default = "mtls";
}; };
reloadUnits = lib.mkOption { reloadUnits = lib.mkOption {
description = "systemd units to try-reload-or-restart after a successful certificate renewal."; description = "systemd units to try-reload-or-restart after a successful certificate renewal.";
@@ -83,104 +88,119 @@ let
subject, subject,
provisioner, provisioner,
san, san,
tlsCert, certFile,
tlsKey, keyFile,
mtlsBundle, bundleFile,
lifetime, lifetime,
user,
group,
}: }:
let let
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} ${tlsCert} ${tlsKey} \ 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} \
cat ${tlsCert} ${tlsKey} > ${mtlsBundle} ${sanArgs} \
''; "$@"
(umask 077; cat ${certFile} ${keyFile} > ${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, mtlsBundle }: 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 ${mtlsBundle} openssl x509 -noout -in ${bundleFile} \
''; -subject -issuer \
-ext subjectAltName,extendedKeyUsage \
-enddate
'';
};
mkMtlsRenewScript = { mkMtlsRenewScript = {
pkgs, pkgs,
tlsCert, cfg,
tlsKey,
mtlsBundle,
reloadUnits ? [ ],
postCommands ? [ ],
systemctlArgs ? [ ], systemctlArgs ? [ ],
}: }:
let let
echoCmd = lib.getExe' pkgs.coreutils "echo"; systemctlCmd = "systemctl ${lib.escapeShellArgs systemctlArgs}";
systemctl = lib.getExe' pkgs.systemd "systemctl";
escapedArgs = lib.escapeShellArgs systemctlArgs; hasReloadUnits = cfg.renew.reloadUnits != [ ];
systemctlCommand = "${systemctl} ${escapedArgs}";
renewReloadScript = lib.concatMapStringsSep "\n" (unit: '' renewReloadScript = lib.concatMapStringsSep "\n" (unit: ''
if ${systemctlCommand} --quiet is-active "${unit}"; then if ${systemctlCmd} --quiet is-active "${unit}"; then
${systemctlCommand} try-reload-or-restart "${unit}" ${systemctlCmd} try-reload-or-restart "${unit}"
fi fi
'') reloadUnits; '') cfg.renew.reloadUnits;
renewPostCommands = lib.concatStringsSep "\n" postCommands;
hasPostCommands = cfg.renew.postCommands != [ ];
renewPostCommands = lib.concatStringsSep "\n" cfg.renew.postCommands;
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
if ${lib.getExe pkgs.step-cli} certificate needs-renewal "${tlsCert}"; then YELLOW_BANG="\e[33m!\e[0m"
${echoCmd} "Renewing mTLS certificate"
else force=0
${echoCmd} "Skipping renew" while [[ $# -gt 0 ]]; do
exit "$?" case $1 in
--force)
force=1
shift
;;
*)
echo -e "$YELLOW_BANG Warning: ignoring unrecognized argument '$1'"
exit 1
;;
esac
done
if [[ $force -eq 0 ]] && ! step certificate needs-renewal "${cfg.certFile}"; then
echo "Skipping renew"
exit 0
fi fi
${lib.getExe pkgs.step-cli} ca renew --force "${tlsCert}" "${tlsKey}" echo "Renewing mTLS certificate"
step ca renew --force "${cfg.certFile}" "${cfg.keyFile}"
(umask 077; cat "${cfg.certFile}" "${cfg.keyFile}" > "${cfg.bundleFile}")
chown ${fileOwner} ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile}
chmod 640 ${cfg.certFile} ${cfg.keyFile} ${cfg.bundleFile}
umask 077 ${lib.optionalString hasReloadUnits ''
${lib.getExe' pkgs.coreutils "cat"} "${tlsCert}" "${tlsKey}" > "${mtlsBundle}" echo "Reloading units: ${lib.concatStringsSep ", " cfg.renew.reloadUnits}"
${renewReloadScript}
''}
${echoCmd} "Reloading units:" ${lib.optionalString hasPostCommands ''echo "Post commands:" ${renewPostCommands}''}
${renewReloadScript} '';
${echoCmd} "Post commands:"
${renewPostCommands}
'';
mkNixosMtlsRenewService = {
pkgs,
tlsCert,
tlsKey,
mtlsBundle,
reloadUnits ? [ ],
postCommands ? [ ],
user ? "root",
group ? null,
}:
let
serviceGroup = if group == null then user else group;
renewScript = mkMtlsRenewScript {
inherit pkgs tlsCert tlsKey mtlsBundle reloadUnits postCommands;
}; };
in
{ mkNixosMtlsRenewService = { pkgs, cfg, ... }:
description = "Renew the mTLS certificate when Smallstep marks it ready"; {
wantedBy = [ ]; description = "Renew the mTLS certificate when Smallstep marks it ready";
after = [ "network-online.target" ]; wantedBy = [ ];
wants = [ "network-online.target" ]; after = [ "network-online.target" ];
serviceConfig = { wants = [ "network-online.target" ];
Type = "oneshot"; serviceConfig = {
User = user; Type = "oneshot";
Group = serviceGroup; User = cfg.renew.user;
ExecStart = lib.getExe renewScript; Group = cfg.renew.group;
ExecStart = lib.getExe (mkMtlsRenewScript { inherit pkgs cfg; });
};
}; };
};
mkNixosMtlsRenewTimer = { mkNixosMtlsRenewTimer = {
onCalendar, onCalendar,
@@ -198,17 +218,10 @@ let
}; };
}; };
mkHomeManagerMtlsRenewService = { mkHomeManagerMtlsRenewService = { pkgs, cfg, ... }:
pkgs,
tlsCert,
tlsKey,
mtlsBundle,
reloadUnits ? [ ],
postCommands ? [ ],
}:
let let
renewScript = mkMtlsRenewScript { renewScript = mkMtlsRenewScript {
inherit pkgs tlsCert tlsKey mtlsBundle reloadUnits postCommands; inherit pkgs cfg;
systemctlArgs = [ "--user" ]; systemctlArgs = [ "--user" ];
}; };
in in
@@ -249,39 +262,45 @@ 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";
};
certReaders = lib.mkOption {
description = "";
type = lib.types.listOf lib.types.str;
default = [ ];
}; };
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
users.groups.certReaders = {
name = cfg.renew.group;
members = cfg.certReaders;
};
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;
inherit (cfg.renew) user group;
}) })
(mkMtlsCheckScript { inherit pkgs mtlsBundle; }) (mkMtlsCheckScript { inherit pkgs; inherit (cfg) bundleFile; })
(mkMtlsRenewScript { inherit pkgs tlsCert tlsKey mtlsBundle; }) (mkMtlsRenewScript { inherit pkgs cfg; })
]; ];
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"d ${cfg.certDir} 0750 ${cfg.renew.user} ${if cfg.renew.group == null then cfg.renew.user else cfg.renew.group} -" "d ${cfg.certDir} 0750 ${cfg.renew.user} ${cfg.renew.group} -"
]; ];
systemd.services.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewService { systemd.services.mtls-renew = lib.mkIf cfg.renew.enable
inherit pkgs tlsCert tlsKey mtlsBundle; (mkNixosMtlsRenewService { inherit pkgs cfg; });
inherit (cfg.renew) reloadUnits postCommands user group;
});
systemd.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewTimer { systemd.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewTimer {
inherit (cfg.renew) onCalendar randomizedDelaySec; inherit (cfg.renew) onCalendar randomizedDelaySec;
@@ -292,13 +311,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;
@@ -311,20 +330,19 @@ in
# step-cli # step-cli
(mkMtlsGenerateScript { (mkMtlsGenerateScript {
inherit (cfg) subject provisioner san lifetime; inherit (cfg) subject provisioner san lifetime;
inherit pkgs tlsCert tlsKey mtlsBundle; inherit (cfg.renew) user group;
inherit pkgs certFile keyFile bundleFile;
}) })
(mkMtlsCheckScript { inherit pkgs mtlsBundle; }) (mkMtlsCheckScript { inherit pkgs bundleFile; })
(mkMtlsRenewScript { inherit pkgs tlsCert tlsKey mtlsBundle; }) (mkMtlsRenewScript { inherit pkgs cfg; systemctlArgs = [ "--user" ]; })
]; ];
systemd.user.tmpfiles.rules = lib.mkIf cfg.enable [ systemd.user.tmpfiles.rules = lib.mkIf cfg.enable [
"d ${cfg.certDir} 0700 - - -" "d ${cfg.certDir} 0700 - - -"
]; ];
systemd.user.services.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewService { systemd.user.services.mtls-renew = lib.mkIf cfg.renew.enable
inherit pkgs tlsCert tlsKey mtlsBundle; (mkHomeManagerMtlsRenewService { inherit pkgs cfg; });
inherit (cfg.renew) reloadUnits postCommands;
});
systemd.user.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewTimer { systemd.user.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewTimer {
inherit (cfg.renew) onCalendar randomizedDelaySec; inherit (cfg.renew) onCalendar randomizedDelaySec;
+12 -12
View File
@@ -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 = {
+4 -3
View File
@@ -21,6 +21,9 @@
home.shell.enableShellIntegration = true; home.shell.enableShellIntegration = true;
programs.zsh.enable = lib.mkForce (config.shell.program == "zsh"); programs.zsh.enable = lib.mkForce (config.shell.program == "zsh");
home.packages = with pkgs; [ home.packages = with pkgs; [
nh
nvd
nix-output-monitor
wget wget
curl curl
busybox busybox
@@ -31,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 /
'')
]; ];
}; };
}; };
+44 -30
View File
@@ -3,30 +3,52 @@ 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 = { config, lib, ... }: flake.modules.nixos.janus-ca =
let { config, lib, ... }:
johnHome = lib.attrByPath [ "users" "users" username "home" ] "/home/${username}" config; let
johnGroup = lib.attrByPath [ "users" "users" username "group" ] username config; cfg = config.janus-ca;
mkStepRules = home: user: group: [ johnHome = lib.attrByPath [ "users" "users" username "home" ] "/home/${username}" config;
"d ${home}/.step 0700 ${user} ${group} -" johnGroup = lib.attrByPath [ "users" "users" username "group" ] username config;
"d ${home}/.step/config 0700 ${user} ${group} -" cfgInEtc = lib.hasPrefix "/etc/" cfg.certDir;
"d ${home}/.step/certs 0700 ${user} ${group} -" certDirEtcPath =
"L+ ${home}/.step/config/defaults.json - - - - /etc/step/config/defaults.json" if cfgInEtc then
"L+ ${home}/.step/certs/root_ca.crt - - - - /etc/step/certs/root_ca.crt" lib.removePrefix "/etc/" cfg.certDir
]; else
in { cfg.certDir;
environment.etc."step/config/defaults.json".text = builtins.toJSON { certRootEtcPath = "${certDirEtcPath}/root_ca.crt";
inherit ca-url fingerprint; mkStepRules = home: user: group: [
root = "/etc/step/certs/root_ca.crt"; "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-ca/defaults.json"
"L+ ${home}/.step/certs/root_ca.crt - - - - ${cfg.certDir}/root_ca.crt"
];
in
{
options.janus-ca = {
certDir = lib.mkOption {
description = "String path to where the mtls certs will be stored.";
type = lib.types.str;
default = "/etc/step-ca/certs";
};
};
config = {
environment.etc = lib.mkIf cfgInEtc {
"step-ca/defaults.json".text = builtins.toJSON {
inherit ca-url fingerprint;
root = "/etc/${certRootEtcPath}";
};
"${certRootEtcPath}".source = ./root_ca.crt;
};
systemd.tmpfiles.rules =
mkStepRules johnHome username johnGroup
++ mkStepRules "/root" "root" "root";
};
}; };
environment.etc."step/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 {
@@ -73,15 +95,7 @@ in
]; ];
}; };
perSystem = { system, pkgs, lib, ... }: {
flake-file.inputs = {
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
@@ -41,6 +41,7 @@
busybox busybox
dig dig
samba samba
my-neovim
]; ];
security.pam.services.swaylock = {}; security.pam.services.swaylock = {};
@@ -123,7 +124,11 @@
home.packages = with pkgs; [ home.packages = with pkgs; [
bash bash
discord discord
my-neovim
proton-vpn
joplin-desktop
]; ];
ssh.certificates.enable = true;
ssh.matchSets = { ssh.matchSets = {
appdaemon = true; appdaemon = true;
homelab = true; homelab = true;
+21 -24
View File
@@ -1,29 +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
# 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};
certDir = "${config.mtls.certDir}";
mtlsBundle = "${certDir}/${config.mtls.bundleFilename}";
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 ${testTarget}" name = "test-push";
${lib.getExe' pkgs.coreutils "mkdir"} -p /var/tmp/nix-build runtimeInputs = [ nh ];
${lib.getExe' pkgs.coreutils "chmod"} 1777 /var/tmp/nix-build text = ''nh os switch ${flakeDir}#${testHost} --target-host root@${testTarget} -e none'';
${lib.getExe pkgs.nixos-rebuild} switch \ };
--flake ${flakeDir}#${testHost} \
--target-host root@${testTarget}
'');
in in
{ {
imports = with inputs.self.modules.homeManager; [ imports = with inputs.self.modules.homeManager; [
@@ -36,7 +32,6 @@ in
restic restic
docker docker
desktop desktop
# neovim
]; ];
# TODO: make this more restrictive, rather than allowing all unfree packages # TODO: make this more restrictive, rather than allowing all unfree packages
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@@ -48,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";
@@ -111,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}" ];
]; });
};
} }
+12 -3
View File
@@ -1,5 +1,14 @@
janus: janus:
admin_jwk: ENC[AES256_GCM,data:2XcN5X77wTQ+OUXa4C9xAErGvrwJKseHjCcgoj6jt+c=,iv:9x+M1wM0dYND1JYkJjM4N8pSOok2OF+P9vmm9NCumTI=,tag:dTCfh+KB1iRJBVoNsGqvuw==,type:str] admin_jwk: ENC[AES256_GCM,data:2XcN5X77wTQ+OUXa4C9xAErGvrwJKseHjCcgoj6jt+c=,iv:9x+M1wM0dYND1JYkJjM4N8pSOok2OF+P9vmm9NCumTI=,tag:dTCfh+KB1iRJBVoNsGqvuw==,type:str]
forgejo:
#ENC[AES256_GCM,data:/wtm0uXbiWFoGNWtlTzVuNxBR7CPm2FMB98t3AxSj5V5rltLvzF9BjgWoJCiX3ltzmU=,iv:xaZXbUIGJHxPrLRQzEQI7hgRgc0y061jIhoE3zlcMaA=,tag:fQGheCIdBKm6wE+vtj7g6A==,type:comment]
secret_key: ENC[AES256_GCM,data:/jcyeDcsryLqu9Q3VnNaENb71/Tl5JUr0zDzxt8L5UCtnJ/YHA6MKItrQ9ZHFv1XROtnSfZl9D5kKomeM8EVqA==,iv:HxMKAMVQ08gkq6SWENj0/d8i9PhcgPCp5eqbztj9bSg=,tag:nO2dFWT/vfgGc/9JIDZrGw==,type:str]
#ENC[AES256_GCM,data:TADqVsZwXpH/zfrXNclavH8Sv++jX081UjK/Mkys5x52gU5fU0ikk478EmwzeergsHpmxxon,iv:v9HsIsud+eiko7F0u622MBrTVDsIxlpqru0Viifvqow=,tag:FLgNTW0EcGhHT6iI9I6Bsg==,type:comment]
internal_token: ENC[AES256_GCM,data:7eZM+misgHZz1p6HH9VzCAPIIFjp2vT0kyc9B1KllE+x2URyrgs5IR9SZ+T5vNdMdnlNzF25pUhKzjbak8tVN554rYWp06SczzqhLyaoHKs8iGBohMqfJkoZxxIVSB7g7GC+/SAsb719,iv:XbBXqXh/PqjEcAj0qsajR7Ij56KGT/9Spdp5T549p9I=,tag:o4ONucOkIE2VJ6VjOlPb6w==,type:str]
#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]
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
@@ -29,7 +38,7 @@ sops:
Yjd0MUcxcExvWVpCOUR3MkdZdGQyWUkKnru0Y2A98+0Mps7EtVK7ct3vPqIGveUt Yjd0MUcxcExvWVpCOUR3MkdZdGQyWUkKnru0Y2A98+0Mps7EtVK7ct3vPqIGveUt
E5fzpcKvdefzObrx7BPTwJ19t2fZg/dSi7HKwx3vmKZSzyQaqJOzsg== E5fzpcKvdefzObrx7BPTwJ19t2fZg/dSi7HKwx3vmKZSzyQaqJOzsg==
-----END AGE ENCRYPTED FILE----- -----END AGE ENCRYPTED FILE-----
lastmodified: "2026-03-29T22:44:20Z" lastmodified: "2026-04-04T23:18:43Z"
mac: ENC[AES256_GCM,data:f2QVZsCNZJIxnsWsBXVyD6JFSmsMktZqCXQWAJcLfSaojEld9CMu1rJjDyCbG3GPJStrMS20WZbtQvx7H6gosnkxXL401L8SwIoy/gNNEIx0qVLUneoEsuvjSTIiiUG7B2Y9lBKQ/kO/iKrJMURSke0wWWC1Ng5mUePfZ94FVTg=,iv:xOFeak0pjBt4iTFr9vt4cuA9WzFD/ipVThgulNOp100=,tag:YPLXK4RmQLa+ADl6DohmBQ==,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.1 version: 3.12.2
+50 -22
View File
@@ -17,21 +17,9 @@ in
nixos.forgejo nixos.forgejo
# nixos.restic-server # nixos.restic-server
# nixos.restic-envoy # nixos.restic-envoy
({ pkgs, ... }: { ({ config, pkgs, ... }: {
networking.hostName = hostname; networking.hostName = hostname;
mtls = { time.timeZone = "America/Chicago";
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 [
@@ -45,13 +33,53 @@ in
]; ];
} }
]; ];
# nix.settings.build-dir = "/var/tmp/nix-build";
# systemd.tmpfiles.rules = [ users.users."${username}".extraGroups = [ "mtls" ];
# "d /var/tmp/nix-build 1777 root root -" mtls = {
# ]; enable = true;
step-ssh-host = { certDir = config.janus-ca.certDir;
hostname = hostname; subject = hostname;
san = [
"${hostname}.john-stream.com"
# "192.168.1.142"
"forgejo.john-stream.com"
"192.168.1.244"
];
lifetime = "12h";
renew.onCalendar = "*:3/15";
renew.reloadUnits = [ "forgejo.service" "restic-rest-server.service" ];
certReaders = [ config.services.forgejo.user "restic" ];
}; };
forgejo = {
enable = true;
root_url = "https://forgejo.john-stream.com";
https = true;
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 = {
Docker = "docker";
"mTLS Renewal" = "mtls-renew.timer";
Forgejo = "forgejo.service";
"Forgejo Backup" = "forgejo-dump.timer";
"Restic REST Server" = "restic-rest-server.service";
};
step-ssh-host.hostname = hostname;
# This provides the secrets at install time # This provides the secrets at install time
sops.defaultSopsFile = ./secrets.yaml; sops.defaultSopsFile = ./secrets.yaml;
@@ -64,9 +92,9 @@ 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}.jsl-zsh
]; ];
forgejo.enable = true;
}) })
]; ];
}; };
+85 -59
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.home-manager} switch --impure --flake ${flakeDir}#$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,53 +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
${nixBin} flake update --flake ${flakeDir} cleanup
${lib.getExe nhms} ];
'') })
(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
'')
]; ];
}; };
}; };
+1 -1
View File
@@ -22,7 +22,7 @@
++ lib.optional isAdmin "wheel" ++ lib.optional isAdmin "wheel"
++ lib.optional config.virtualisation.docker.enable "docker" ++ lib.optional config.virtualisation.docker.enable "docker"
++ lib.optional (isAdmin && config.services.forgejo.enable) config.services.forgejo.group ++ lib.optional (isAdmin && config.services.forgejo.enable) config.services.forgejo.group
++ lib.optional (isAdmin && config.services.postgresql.enable) config.services.postgresql.group; ++ lib.optional (isAdmin && config.services.postgresql.enable) "postgres";
}; };
security.sudo-rs.enable = lib.mkIf isAdmin true; security.sudo-rs.enable = lib.mkIf isAdmin true;
+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";
};
};
}
+47 -35
View File
@@ -1,44 +1,56 @@
{ inputs, ... }: { { inputs, ... }: {
flake.modules.nixos.login-text = { config, ... }: { flake.modules.nixos.login-text = { config, lib, ... }:
programs.rust-motd = { let
enable = true; defaultServiceStatus = {
refreshInterval = "*:0/5"; SSH = "sshd.socket";
order = [ "SSH Cert Renewal" = "step-ssh-host-renew.timer";
"global" };
"last_login" in {
"service_status" options.loginText.extraServiceStatus = lib.mkOption {
# "uptime" type = lib.types.attrsOf lib.types.str;
"memory" default = { };
"filesystems" description = "Additional rust-motd service status entries keyed by display name.";
]; };
settings = {
global = {
time_format = "%Y-%m-%d %H:%M:%S %Z";
};
last_login = { config = {
john = 3; programs.rust-motd = {
root = 3; enable = true;
}; refreshInterval = "*:0/5";
order = [
"global"
"last_login"
"service_status"
# "uptime"
"memory"
"filesystems"
];
settings = {
global = {
time_format = "%Y-%m-%d %H:%M:%S %Z";
};
service_status = { last_login = {
Docker = "docker"; john = 3;
SSH = "sshd.socket"; root = 3;
"SSH Cert Renewal" = "step-ssh-host-renew.timer"; };
"mTLS Renewal" = "mtls-renew.timer";
};
# This calculation is wrong for LXCs service_status = lib.mkMerge [
# uptime = { defaultServiceStatus
# prefix = "Uptime"; config.loginText.extraServiceStatus
# }; ];
memory = { # This calculation is wrong for LXCs
swap_pos = "beside"; # uptime = {
}; # prefix = "Uptime";
# };
filesystems = { memory = {
root = "/"; swap_pos = "beside";
};
filesystems = {
root = "/";
};
}; };
}; };
}; };
+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} -lgos type --no-time --follow-symlinks"; colors = "auto";
extraOptions = [
"--all"
"--long"
"--group-directories-first"
"--sort=type"
"--dereference"
"--octal-permissions"
"--smart-group"
"--no-time"
"--git"
];
}; };
}; };
} }
+16 -6
View File
@@ -1,15 +1,25 @@
{ {
flake.modules.homeManager.files = { pkgs, ... }: flake.modules.homeManager.files = { pkgs, lib, ... }:
{ {
programs.lf.enable = true; programs.lf = {
programs.lf.cmdKeybindings = { enable = true;
"D" = "delete"; cmdKeybindings = {
"D" = "delete";
};
settings = {
preview = true;
hidden = true;
drawbox = true;
icons = true;
ignorecase = true;
};
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
gdu gdu
lf # (writeShellScriptBin "lfcd" ''
# TODO: find a CLI file editor that's not insane # . <(${lib.getExe pkgs.lf} -print-last-dir | sed 's/^/cd /')
# '')
]; ];
}; };
} }
+1
View File
@@ -43,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;
+46 -13
View File
@@ -6,7 +6,7 @@
}; };
}; };
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 = [
@@ -32,17 +32,28 @@
theme.name = "catppuccin"; theme.name = "catppuccin";
theme.style = "mocha"; theme.style = "mocha";
git = { git.enable = true;
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 = { filetree.neo-tree = {
enable = true; enable = true;
}; };
lazy = { # lazy = {
enable = true; # enable = true;
}; # };
# globals = { # globals = {
# SimpylFold_docstring_preview = 1; # SimpylFold_docstring_preview = 1;
@@ -102,16 +113,38 @@
keymaps = [ keymaps = [
{ {
key = "<leader>fd"; desc = "Edit key mappings";
mode = "n"; key = "<leader>ekm";
mode = [ "n" ];
silent = false; silent = false;
action = ":Telescope find_files"; action = "<cmd>:edit +/keymaps /home/john/.config/home-manager/jsl-dendritic/modules/programs/neovim.nix<CR>";
} }
{ {
key = "<C-b>"; 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"; mode = "n";
silent = true; silent = false;
action = ":Neotree"; 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>";
} }
]; ];
}; };
-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;
+135 -1
View File
@@ -1,4 +1,4 @@
{ inputs, ... }: { self, inputs, ... }:
let let
username = "john"; username = "john";
in in
@@ -51,4 +51,138 @@ 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";
});
};
} }
+4
View File
@@ -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";