Compare commits
143 Commits
3627cf57ec
...
wrappers
| Author | SHA1 | Date | |
|---|---|---|---|
| 35bd80424d | |||
| 3447b28af1 | |||
| 2fea8238d1 | |||
| cf1174d36b | |||
| bae2b3027e | |||
| 68483c0231 | |||
| f0eba76e49 | |||
| 8357372b39 | |||
| 3c4aa74b0f | |||
| ed473ddfae | |||
| 133bad5aef | |||
| 3fc08793fe | |||
| 7f4fdcf4b9 | |||
| bfc5da791a | |||
| 9a09399ca3 | |||
| cf90d3e876 | |||
| 443020df4d | |||
| 3fc3beb4ed | |||
| 43ae292f39 | |||
| 026bf541e1 | |||
| e75951318d | |||
| bd236ed977 | |||
| b07bf102a4 | |||
| 9bfe140367 | |||
| 545a17586e | |||
| 685c1bc05a | |||
| a4f988c223 | |||
| a05de7df1f | |||
| aace1776d5 | |||
| 03965917ea | |||
| dac6b70445 | |||
| 932616177a | |||
| c1bfa64cc8 | |||
| 235cd297c5 | |||
| 0c91b1d493 | |||
| 9825270d64 | |||
| ee9573fc97 | |||
| d47394d4cc | |||
| 0abbcf0fd2 | |||
| 718aa466b6 | |||
| 916fd41555 | |||
| 65608646bb | |||
| 1278177e4d | |||
| f36bb22635 | |||
| fe24eb2dde | |||
| e9d585f8d0 | |||
| 93e58c341d | |||
| b8c73b446c | |||
| 58816b2356 | |||
| ca2f5ac7c8 | |||
| 904dd6e329 | |||
| 8073125f3e | |||
| f24a269af3 | |||
| a5a10772d1 | |||
| 510a026de7 | |||
| dd47ae94bf | |||
| 244519f406 | |||
| 213d97d13e | |||
| 51a2b8078f | |||
| 5d5ad75c06 | |||
| e63ca7b244 | |||
| ff7d03ecfd | |||
| c6b1361a68 | |||
| 934aeb429c | |||
| dbbdf8991f | |||
| 70315d5020 | |||
| 7080410c0c | |||
| 35e1d5ee61 | |||
| ec5ff115ce | |||
| 58066d2a08 | |||
| bf478b5f38 | |||
| e18c28905d | |||
| e8ac1fb552 | |||
| 630e385fb1 | |||
| 6df0f8d1ab | |||
| c044f2aa5a | |||
| 1caf0fa10d | |||
| 5cb1c88e51 | |||
| 5fcd6abdb2 | |||
| e59aa7a5f1 | |||
| bf9c3c2597 | |||
| 151512a071 | |||
| 8141662832 | |||
| 1196d69778 | |||
| c1e00a7c45 | |||
| fe19700514 | |||
| 25ea6ac502 | |||
| 01fde39946 | |||
| 84b32cea01 | |||
| bccb96a0b3 | |||
| 44fd737afe | |||
| 0854439bdf | |||
| ff70a35078 | |||
| b8b8a445f9 | |||
| 13a841c8db | |||
| 6c26e898b2 | |||
| 710f13ace4 | |||
| 1a7a1189e7 | |||
| ff74205c57 | |||
| 32b7932916 | |||
| f05a3af30d | |||
| 3e84eb641f | |||
| 9b51398ceb | |||
| 2a97dbf7ca | |||
| d7e32c0a2f | |||
| 76cb1d078b | |||
| fb7750235f | |||
| 4c90263866 | |||
| fac9c7f5ce | |||
| a7b65e4eee | |||
| 1fe4d59ce6 | |||
| 86bb800886 | |||
| c4cf7c8096 | |||
| 863ff2d04d | |||
| bc66ec89c6 | |||
| cf02260941 | |||
| 609d2a5cca | |||
| 395e13acd2 | |||
| b6a85631f3 | |||
| f82d084030 | |||
| 3674a0e6c4 | |||
| 89a4d5a228 | |||
| fef4ff71bb | |||
| c0c1e92249 | |||
| d42de74755 | |||
| bc3d7e9b6f | |||
| 30ea383040 | |||
| 205d9ea867 | |||
| 311ab760ea | |||
| aebe978684 | |||
| 2b65433d63 | |||
| 0ae3d950e9 | |||
| 04bbf00c3d | |||
| e0abbd6b90 | |||
| 0cf3f05df2 | |||
| 93458a5e53 | |||
| 31df60a718 | |||
| 1b4b3fbd6a | |||
| eac053ca07 | |||
| 33ccad5bf6 | |||
| 6bf45ce941 | |||
| b6be6eba68 | |||
| 5934568d10 |
+10
@@ -9,6 +9,16 @@ creation_rules:
|
|||||||
- age:
|
- age:
|
||||||
- *john-pc
|
- *john-pc
|
||||||
- *soteria
|
- *soteria
|
||||||
|
- *test-nix
|
||||||
|
- path_regex: john-p14s/secrets\.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *john-p14s
|
||||||
|
- *john-pc
|
||||||
|
- path_regex: john-pc/secrets\.yaml$
|
||||||
|
key_groups:
|
||||||
|
- age:
|
||||||
|
- *john-pc
|
||||||
- path_regex: \.yaml$
|
- path_regex: \.yaml$
|
||||||
key_groups:
|
key_groups:
|
||||||
- age:
|
- age:
|
||||||
|
|||||||
Generated
+166
-59
@@ -1,12 +1,28 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-compat": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1751685974,
|
||||||
|
"narHash": "sha256-NKw96t+BgHIYzHUjkTK95FqYRVKB8DHpVhefWSz/kTw=",
|
||||||
|
"ref": "refs/heads/main",
|
||||||
|
"rev": "549f2762aebeff29a2e5ece7a7dc0f955281a1d1",
|
||||||
|
"revCount": 92,
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://git.lix.systems/lix-project/flake-compat.git"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flake-file": {
|
"flake-file": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773554778,
|
"lastModified": 1776202746,
|
||||||
"narHash": "sha256-keH0VNsci9e0Uwt3Msp/N+pltaP8Lb6lt09Q3WvDPw4=",
|
"narHash": "sha256-RZVtJefKKy3Z2UvKWSbtRF3cUxt/2fHga2adN6MZQ1U=",
|
||||||
"owner": "vic",
|
"owner": "vic",
|
||||||
"repo": "flake-file",
|
"repo": "flake-file",
|
||||||
"rev": "f4780a86bd4c756475d839b286f8a40aabdbc802",
|
"rev": "7d16dfaeb912d5efdff0d0eda2aabc0c934168dd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -22,11 +38,32 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"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"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-parts_2": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": [
|
||||||
|
"nvf",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1769996383,
|
||||||
|
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
|
||||||
|
"owner": "hercules-ci",
|
||||||
|
"repo": "flake-parts",
|
||||||
|
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -53,34 +90,16 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils_2": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems_2"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681202837,
|
|
||||||
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773608492,
|
"lastModified": 1776562531,
|
||||||
"narHash": "sha256-QZteyExJYSQzgxqdsesDPbQgjctGG7iKV/6ooyQPITk=",
|
"narHash": "sha256-Lh5Ns9DI67E+lSMOCGK0S+mFPy0mz0yOGiJTUXiR9JI=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "9a40ec3b78fc688d0908485887d355caa5666d18",
|
"rev": "5b56ad02dc643808b8af6d5f3ff179e2ce9593f4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -91,11 +110,11 @@
|
|||||||
},
|
},
|
||||||
"import-tree": {
|
"import-tree": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773554199,
|
"lastModified": 1773693634,
|
||||||
"narHash": "sha256-6apV5N1F5tTD8JY9AUGnkWmy56HqDPn4MNFRsq4Rg+s=",
|
"narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=",
|
||||||
"owner": "vic",
|
"owner": "vic",
|
||||||
"repo": "import-tree",
|
"repo": "import-tree",
|
||||||
"rev": "c6ebc59c85ee54cfb68163d06d1a3149ce0fe431",
|
"rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -104,6 +123,43 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"mnw": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1770419553,
|
||||||
|
"narHash": "sha256-b1XqsH7AtVf2dXmq2iyRr2NC1yG7skY7Z6N2MpWHlK4=",
|
||||||
|
"owner": "Gerg-L",
|
||||||
|
"repo": "mnw",
|
||||||
|
"rev": "2aaffa8030d0b262176146adbb6b0e6374ce2957",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "Gerg-L",
|
||||||
|
"repo": "mnw",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ndg": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nvf",
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1768214250,
|
||||||
|
"narHash": "sha256-hnBZDQWUxJV3KbtvyGW5BKLO/fAwydrxm5WHCWMQTbw=",
|
||||||
|
"owner": "feel-co",
|
||||||
|
"repo": "ndg",
|
||||||
|
"rev": "a6bd3c1ce2668d096e4fdaaa03ad7f03ba1fbca8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "feel-co",
|
||||||
|
"ref": "refs/tags/v2.6.0",
|
||||||
|
"repo": "ndg",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixgl": {
|
"nixgl": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
@@ -125,13 +181,29 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixos-hardware": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1775490113,
|
||||||
|
"narHash": "sha256-2ZBhDNZZwYkRmefK5XLOusCJHnoeKkoN95hoSGgMxWM=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixos-hardware",
|
||||||
|
"rev": "c775c2772ba56e906cbeb4e0b2db19079ef11ff7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixos-hardware",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773389992,
|
"lastModified": 1775423009,
|
||||||
"narHash": "sha256-wvfdLLWJ2I9oEpDd9PfMA8osfIZicoQ5MT1jIwNs9Tk=",
|
"narHash": "sha256-vPKLpjhIVWdDrfiUM8atW6YkIggCEKdSAlJPzzhkQlw=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c06b4ae3d6599a672a6210b7021d699c351eebda",
|
"rev": "68d8aa3d661f0e6bd5862291b5bb263b2a6595c9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -143,29 +215,40 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773507054,
|
"lastModified": 1776329215,
|
||||||
"narHash": "sha256-yzDBkI1CpeZrAt4l1nGvTOs3OFtXCS7a7Gi5Y1h878w=",
|
"narHash": "sha256-mBqzkn7oJti2hqeO8iTbDxKw+1ifxpP53feQ0CEXies=",
|
||||||
"rev": "e80236013dc8b77aa49ca90e7a12d86f5d8d64c9",
|
"rev": "b86751bc4085f48661017fa226dee99fab6c651b",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre963414.e80236013dc8/nixexprs.tar.xz"
|
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.05pre981196.b86751bc4085/nixexprs.tar.xz"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
|
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_3": {
|
"nvf": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-compat": "flake-compat",
|
||||||
|
"flake-parts": "flake-parts_2",
|
||||||
|
"mnw": "mnw",
|
||||||
|
"ndg": "ndg",
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"systems": "systems_2"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1682134069,
|
"lastModified": 1776608870,
|
||||||
"narHash": "sha256-TnI/ZXSmRxQDt2sjRYK/8j8iha4B4zP2cnQCZZ3vp7k=",
|
"narHash": "sha256-lBKrueFu15TdmtMF6GsiSVCifwdrUBYFoa3+zZjYTFM=",
|
||||||
"owner": "NixOS",
|
"owner": "notashelf",
|
||||||
"repo": "nixpkgs",
|
"repo": "nvf",
|
||||||
"rev": "fd901ef4bf93499374c5af385b2943f5801c0833",
|
"rev": "d9ba7f0a9ed6c016dc9e526cc606d1a2f7898cd4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"owner": "notashelf",
|
||||||
"type": "indirect"
|
"repo": "nvf",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
@@ -175,12 +258,15 @@
|
|||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
"import-tree": "import-tree",
|
"import-tree": "import-tree",
|
||||||
"nixgl": "nixgl",
|
"nixgl": "nixgl",
|
||||||
|
"nixos-hardware": "nixos-hardware",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
"nixpkgs-lib": [
|
"nixpkgs-lib": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
|
"nvf": "nvf",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
"vscode-server": "vscode-server"
|
"wrapper-modules": "wrapper-modules",
|
||||||
|
"wrappers": "wrappers"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sops-nix": {
|
"sops-nix": {
|
||||||
@@ -190,11 +276,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773550941,
|
"lastModified": 1776119890,
|
||||||
"narHash": "sha256-wa/++bL2QeMUreNFBZEWluQfOYB0MnQIeGNMuaX9sfs=",
|
"narHash": "sha256-Zm6bxLNnEOYuS/SzrAGsYuXSwk3cbkRQZY0fJnk8a5M=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "c469b6885f0dcd5c7c56bd935a0f08dbcd9e79e1",
|
"rev": "d4971dd58c6627bfee52a1ad4237637c0a2fb0cd",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -233,22 +319,43 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"vscode-server": {
|
"wrapper-modules": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils_2",
|
"nixpkgs": [
|
||||||
"nixpkgs": "nixpkgs_3"
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770124655,
|
"lastModified": 1776464146,
|
||||||
"narHash": "sha256-yHmd2B13EtBUPLJ+x0EaBwNkQr9LTne1arLVxT6hSnY=",
|
"narHash": "sha256-XwLFfJDz71vIF7BAhnbLhrzQjmDC2uXdo7N0oHUrYzA=",
|
||||||
"owner": "nix-community",
|
"owner": "BirdeeHub",
|
||||||
"repo": "nixos-vscode-server",
|
"repo": "nix-wrapper-modules",
|
||||||
"rev": "92ce71c3ba5a94f854e02d57b14af4997ab54ef0",
|
"rev": "75febede14a0845f4ef429da692a0698bf433600",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "BirdeeHub",
|
||||||
"repo": "nixos-vscode-server",
|
"repo": "nix-wrapper-modules",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"wrappers": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1776505856,
|
||||||
|
"narHash": "sha256-VbnOijrn4EdYYJwiNQFxQNXECKBa60U66UPxUQAGkBE=",
|
||||||
|
"owner": "lassulus",
|
||||||
|
"repo": "wrappers",
|
||||||
|
"rev": "738d4bf81cbf306f6917c540a5b798110e3cf1e8",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "lassulus",
|
||||||
|
"repo": "wrappers",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,41 @@
|
|||||||
# DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file.
|
# DO-NOT-EDIT. This file was auto-generated using github:vic/flake-file.
|
||||||
# Use `nix run .#write-flake` to regenerate it.
|
# Use `nix run .#write-flake` to regenerate it.
|
||||||
{
|
{
|
||||||
|
|
||||||
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
|
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);
|
||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
flake-file.url = "github:vic/flake-file";
|
flake-file.url = "github:vic/flake-file";
|
||||||
flake-parts = {
|
flake-parts = {
|
||||||
inputs.nixpkgs-lib.follows = "nixpkgs-lib";
|
|
||||||
url = "github:hercules-ci/flake-parts";
|
url = "github:hercules-ci/flake-parts";
|
||||||
|
inputs.nixpkgs-lib.follows = "nixpkgs-lib";
|
||||||
};
|
};
|
||||||
home-manager.url = "github:nix-community/home-manager";
|
home-manager.url = "github:nix-community/home-manager";
|
||||||
import-tree.url = "github:vic/import-tree";
|
import-tree.url = "github:vic/import-tree";
|
||||||
nixgl = {
|
nixgl = {
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
url = "github:nix-community/nixGL";
|
url = "github:nix-community/nixGL";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
nixos-hardware = {
|
||||||
|
url = "github:NixOS/nixos-hardware";
|
||||||
|
flake = false;
|
||||||
};
|
};
|
||||||
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
|
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
|
||||||
nixpkgs-lib.follows = "nixpkgs";
|
nixpkgs-lib.follows = "nixpkgs";
|
||||||
sops-nix = {
|
nvf = {
|
||||||
|
url = "github:notashelf/nvf";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
sops-nix = {
|
||||||
|
url = "github:Mic92/sops-nix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
wrapper-modules = {
|
||||||
|
url = "github:BirdeeHub/nix-wrapper-modules";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
wrappers = {
|
||||||
|
url = "github:lassulus/wrappers";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
url = "github:Mic92/sops-nix";
|
|
||||||
};
|
};
|
||||||
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,4 +4,6 @@
|
|||||||
# https://github.com/vic/flake-file/tree/main/modules/dendritic
|
# https://github.com/vic/flake-file/tree/main/modules/dendritic
|
||||||
inputs.flake-file.flakeModules.dendritic
|
inputs.flake-file.flakeModules.dendritic
|
||||||
];
|
];
|
||||||
|
|
||||||
|
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# This module is for programs with GUIs that run in a desktop environment
|
||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.homeManager.desktop = { config, pkgs, lib, ... }: {
|
||||||
|
imports = with inputs.self.modules.homeManager; [
|
||||||
|
brave
|
||||||
|
ghostty
|
||||||
|
onepassword
|
||||||
|
vscode
|
||||||
|
];
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
mangohud
|
||||||
|
sublime4
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.forgejo = {config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.forgejo;
|
||||||
|
needsPrivilegedPort = cfg.port < 1024;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.forgejo = {
|
||||||
|
enable = lib.mkEnableOption "Enable Forgejo backed with PostgreSQL";
|
||||||
|
root_url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
|
||||||
|
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 ];
|
||||||
|
|
||||||
|
systemd.services.forgejo.serviceConfig = lib.mkIf needsPrivilegedPort {
|
||||||
|
AmbientCapabilities = [ "CAP_NET_BIND_SERVICE" ];
|
||||||
|
CapabilityBoundingSet = [ "CAP_NET_BIND_SERVICE" ];
|
||||||
|
PrivateUsers = lib.mkForce false;
|
||||||
|
};
|
||||||
|
|
||||||
|
sops.secrets = {
|
||||||
|
"forgejo/secret_key".owner = config.services.forgejo.user;
|
||||||
|
"forgejo/internal_token".owner = config.services.forgejo.user;
|
||||||
|
"forgejo/jwt_secret".owner = config.services.forgejo.user;
|
||||||
|
"forgejo/lfs_jwt_secret".owner = config.services.forgejo.user;
|
||||||
|
};
|
||||||
|
|
||||||
|
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
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
{ inputs, ... }: {
|
||||||
|
flake.modules.nixos.gnome = {pkgs, ... }: {
|
||||||
|
services = {
|
||||||
|
desktopManager.gnome.enable = true;
|
||||||
|
displayManager.gdm = {
|
||||||
|
enable = true;
|
||||||
|
wayland = true;
|
||||||
|
banner = "Welcome to John's NixOS implementation";
|
||||||
|
};
|
||||||
|
udev.packages = [
|
||||||
|
pkgs.gnome-settings-daemon # For gnome systray icons
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager.gnome = { config, pkgs, ... }:
|
||||||
|
let
|
||||||
|
# `gnome-extensions list` for a list
|
||||||
|
extensions = with pkgs.gnomeExtensions; [
|
||||||
|
appindicator # For gnome systray icons
|
||||||
|
dash-to-panel
|
||||||
|
gtile
|
||||||
|
space-bar
|
||||||
|
switcher
|
||||||
|
tactile
|
||||||
|
vitals
|
||||||
|
];
|
||||||
|
enabledExtensions = map (ext: ext.extensionUuid) extensions;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
gtk = {
|
||||||
|
enable = true;
|
||||||
|
theme = {
|
||||||
|
name = "Orchis-Dark";
|
||||||
|
package = pkgs.orchis-theme;
|
||||||
|
};
|
||||||
|
gtk4.theme = config.gtk.theme;
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = [ pkgs.gnome-tweaks ] ++ extensions;
|
||||||
|
|
||||||
|
dconf.settings = {
|
||||||
|
"org/gnome/desktop/interface" = {
|
||||||
|
color-scheme = "prefer-dark";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/shell" = {
|
||||||
|
disable-user-extensions = false;
|
||||||
|
enabled-extensions = enabledExtensions;
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/desktop/wm/preferences" = {
|
||||||
|
button-layout = ":minimize,close";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/desktop/wm/keybindings" = {
|
||||||
|
"switch-to-workspace-1" = ["<Super>1"];
|
||||||
|
"switch-to-workspace-2" = ["<Super>2"];
|
||||||
|
"switch-to-workspace-3" = ["<Super>3"];
|
||||||
|
"switch-to-workspace-4" = ["<Super>4"];
|
||||||
|
"move-to-workspace-1" = ["<Shift><Super>1"];
|
||||||
|
"move-to-workspace-2" = ["<Shift><Super>2"];
|
||||||
|
"move-to-workspace-3" = ["<Shift><Super>3"];
|
||||||
|
"move-to-workspace-4" = ["<Shift><Super>4"];
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys" = {
|
||||||
|
custom-keybindings = [
|
||||||
|
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/edit-nix/"
|
||||||
|
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-browser/"
|
||||||
|
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/ad-dev/"
|
||||||
|
"/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/shutdown/"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/edit-nix" = {
|
||||||
|
binding = "<Primary><Alt>n";
|
||||||
|
command = "code /etc/nixos";
|
||||||
|
name = "Edit Nix config";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/launch-browser" = {
|
||||||
|
binding = "<Primary><Alt>b";
|
||||||
|
command = "brave";
|
||||||
|
name = "Launch Brave browser";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/ad-dev" = {
|
||||||
|
binding = "<Primary><Alt>d";
|
||||||
|
command = ''code --file-uri "vscode-remote://ssh-remote+ad-nix/etc/nixos/ad-nix.code-workspace"'';
|
||||||
|
name = "Launch AppDaemon Development over Tailscale";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/ws1" = {
|
||||||
|
binding = "<Super>1";
|
||||||
|
command = "wmctrl -s 0";
|
||||||
|
name = "Switch to workspace 1";
|
||||||
|
};
|
||||||
|
|
||||||
|
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/shutdown" = {
|
||||||
|
binding = "<Primary><Alt>p";
|
||||||
|
command = "gnome-session-quit --power-off --force";
|
||||||
|
name = "Shutdown immediately";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
# https://github.com/glabrie/dotfiles/blob/main/modules/system/settings/greetd.nix
|
||||||
|
{ inputs, ... }: {
|
||||||
|
flake.modules.nixos.greetd = { pkgs, lib, ... }: {
|
||||||
|
services.greetd = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
default_session = {
|
||||||
|
command = "${lib.getExe pkgs.tuigreet} --time --remember --cmd niri-session";
|
||||||
|
user = "greeter";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services.greetd.serviceConfig = {
|
||||||
|
Type = "idle";
|
||||||
|
StandardInput = "tty";
|
||||||
|
StandardOutput = "tty";
|
||||||
|
StandardError = "journal"; # Without this errors will spam on screen
|
||||||
|
# Without these bootlogs will spam on screen
|
||||||
|
TTYReset = true;
|
||||||
|
TTYVHangup = true;
|
||||||
|
TTYVTDisallocate = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let's allow our keyring to work from the start
|
||||||
|
security.pam.services.greetd.enableGnomeKeyring = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,442 @@
|
|||||||
|
{ self, inputs, lib, ... }:
|
||||||
|
let
|
||||||
|
# Options that will be in common between the nixos module and the home-manager module.
|
||||||
|
mkOpts = config: let cfg = config.mtls; in {
|
||||||
|
enable = lib.mkEnableOption "Enable mTLS";
|
||||||
|
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.";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
certDir = lib.mkOption {
|
||||||
|
description = "String path to the directory where the certs will be stored";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
caFile = lib.mkOption {
|
||||||
|
description = "String path for the root CA file";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${cfg.certDir}/root_ca.crt";
|
||||||
|
};
|
||||||
|
keyFile = lib.mkOption {
|
||||||
|
description = "String path for the private key";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${cfg.certDir}/key.pem";
|
||||||
|
};
|
||||||
|
certFile = lib.mkOption {
|
||||||
|
description = "String path for the public cert";
|
||||||
|
type = lib.types.str;
|
||||||
|
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 {
|
||||||
|
description = "List of SAN to give the mTLS cert";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
provisioner = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "admin";
|
||||||
|
};
|
||||||
|
lifetime = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "24h";
|
||||||
|
};
|
||||||
|
renew = {
|
||||||
|
enable = lib.mkOption {
|
||||||
|
description = "Enable automatic mTLS certificate renewal using a systemd timer.";
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = cfg.enable;
|
||||||
|
};
|
||||||
|
onCalendar = lib.mkOption {
|
||||||
|
description = "systemd OnCalendar schedule for mTLS certificate renewal checks.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "*:1/15";
|
||||||
|
};
|
||||||
|
randomizedDelaySec = lib.mkOption {
|
||||||
|
description = "Randomized delay added to renewal timer runs to avoid synchronized renewals.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "5m";
|
||||||
|
};
|
||||||
|
user = lib.mkOption {
|
||||||
|
description = "User account to run the mTLS renewal service as.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "root";
|
||||||
|
};
|
||||||
|
group = lib.mkOption {
|
||||||
|
description = "Group to run the mTLS renewal service as. Defaults to the configured renewal user.";
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = "mtls";
|
||||||
|
};
|
||||||
|
reloadUnits = lib.mkOption {
|
||||||
|
description = "systemd units to try-reload-or-restart after a successful certificate renewal.";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
postCommands = lib.mkOption {
|
||||||
|
description = "Shell commands to run after a successful certificate renewal.";
|
||||||
|
type = lib.types.listOf lib.types.lines;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
mkMtlsGenerateScript = {
|
||||||
|
pkgs,
|
||||||
|
subject,
|
||||||
|
provisioner,
|
||||||
|
san,
|
||||||
|
certFile,
|
||||||
|
keyFile,
|
||||||
|
bundleFile,
|
||||||
|
lifetime,
|
||||||
|
user,
|
||||||
|
group,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
sanArgs = lib.concatMapStringsSep " " (s: "--san \"${s}\"") san;
|
||||||
|
in
|
||||||
|
pkgs.writeShellApplication {
|
||||||
|
name = "mtls-generate";
|
||||||
|
runtimeInputs = with pkgs; [ coreutils step-cli ];
|
||||||
|
text = ''
|
||||||
|
set -euo pipefail
|
||||||
|
step ca certificate ${subject} ${certFile} ${keyFile} \
|
||||||
|
--provisioner ${provisioner} \
|
||||||
|
--not-before=-5m --not-after=${lifetime} \
|
||||||
|
${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}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.nixos.mtls = { config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.mtls;
|
||||||
|
mtlsRenewWrapper = inputs.self.wrappers.mtlsRenew.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) certDir keyFile certFile bundleFile;
|
||||||
|
inherit (cfg.renew) user group reloadUnits postCommands;
|
||||||
|
systemd = {
|
||||||
|
description = "Renew the mTLS certificate when Smallstep marks it ready";
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = cfg.renew.user;
|
||||||
|
Group = cfg.renew.group;
|
||||||
|
};
|
||||||
|
} // lib.optionalAttrs cfg.renew.enable {
|
||||||
|
startAt = cfg.renew.onCalendar;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mtls = (mkOpts config) // {
|
||||||
|
certDir = lib.mkOption {
|
||||||
|
description = "String path to where the mtls certs will be stored.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "/etc/step-ca/certs";
|
||||||
|
};
|
||||||
|
certReaders = lib.mkOption {
|
||||||
|
description = "";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
users.groups.certReaders = {
|
||||||
|
name = cfg.renew.group;
|
||||||
|
members = cfg.certReaders;
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; lib.optionals cfg.enable [
|
||||||
|
# step-cli
|
||||||
|
(mkMtlsGenerateScript {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) subject provisioner san certFile keyFile bundleFile lifetime;
|
||||||
|
inherit (cfg.renew) user group;
|
||||||
|
})
|
||||||
|
(inputs.self.wrappers.mtlsCheck.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) bundleFile;
|
||||||
|
}).wrapper
|
||||||
|
mtlsRenewWrapper.wrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.tmpfiles.rules = [
|
||||||
|
"d ${cfg.certDir} 0750 ${cfg.renew.user} ${cfg.renew.group} -"
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.packages = lib.mkIf cfg.renew.enable [
|
||||||
|
mtlsRenewWrapper.outputs.systemd-system
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.timers.mtls-renew = lib.mkIf cfg.renew.enable {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
Persistent = true;
|
||||||
|
AccuracySec = "1us";
|
||||||
|
RandomizedDelaySec = cfg.renew.randomizedDelaySec;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager.mtls = { config, lib, pkgs, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.mtls;
|
||||||
|
mtlsRenewWrapper = inputs.self.wrappers.mtlsRenew.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) certDir keyFile certFile bundleFile;
|
||||||
|
inherit (cfg.renew) reloadUnits postCommands;
|
||||||
|
systemctlArgs = [ "--user" ];
|
||||||
|
systemd = lib.optionalAttrs cfg.renew.enable {
|
||||||
|
startAt = cfg.renew.onCalendar;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.mtls = (mkOpts config) // {
|
||||||
|
certDir = lib.mkOption {
|
||||||
|
description = "String path to where the mtls certs will be stored.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.home.homeDirectory}/.step/certs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
home.packages = with pkgs; lib.optionals cfg.enable [
|
||||||
|
# step-cli
|
||||||
|
(mkMtlsGenerateScript {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) keyFile certFile bundleFile;
|
||||||
|
inherit (cfg) subject provisioner san lifetime;
|
||||||
|
inherit (cfg.renew) user group;
|
||||||
|
})
|
||||||
|
(inputs.self.wrappers.mtlsCheck.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
inherit (cfg) bundleFile;
|
||||||
|
}).wrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
systemd.user.tmpfiles.rules = lib.mkIf cfg.enable [
|
||||||
|
"d ${cfg.certDir} 0700 - - -" # Ensure the cert directory exists and is writable by the user
|
||||||
|
];
|
||||||
|
|
||||||
|
# Create the systemd service files for the user.
|
||||||
|
xdg.dataFile = lib.mkIf cfg.renew.enable {
|
||||||
|
"systemd/user/mtls-renew.service".source =
|
||||||
|
"${mtlsRenewWrapper.outputs.systemd-user}/systemd/user/mtls-renew.service";
|
||||||
|
"systemd/user/mtls-renew.timer".source =
|
||||||
|
"${mtlsRenewWrapper.outputs.systemd-user}/systemd/user/mtls-renew.timer";
|
||||||
|
"systemd/user/mtls-renew.timer.d/override.conf".text = ''
|
||||||
|
[Timer]
|
||||||
|
Persistent=true
|
||||||
|
AccuracySec=1us
|
||||||
|
RandomizedDelaySec=${cfg.renew.randomizedDelaySec}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Ensure the timer gets started
|
||||||
|
home.activation.mtlsRenewTimer = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
if [ -n "$XDG_RUNTIME_DIR" ] && [ -S "$XDG_RUNTIME_DIR/systemd/private" ]; then
|
||||||
|
if [ "${lib.boolToString (cfg.enable && cfg.renew.enable)}" = "true" ]; then
|
||||||
|
run ${pkgs.systemd}/bin/systemctl --user daemon-reload
|
||||||
|
run ${pkgs.systemd}/bin/systemctl --user enable --now mtls-renew.timer
|
||||||
|
else
|
||||||
|
run ${pkgs.systemd}/bin/systemctl --user disable --now mtls-renew.timer || true
|
||||||
|
run ${pkgs.systemd}/bin/systemctl --user daemon-reload || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.wrappers = {
|
||||||
|
mtlsCheck = inputs.wrappers.lib.wrapModule ({ config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
bundleFile = lib.mkOption {
|
||||||
|
description = "String path for the mTLS key bundle";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "mtls-check";
|
||||||
|
# This pattern is necessary to wrap packages like openssl that provide more than one binary
|
||||||
|
package = config.pkgs.symlinkJoin {
|
||||||
|
name = "openssl";
|
||||||
|
paths = [ config.pkgs.openssl.bin config.pkgs.openssl.man ];
|
||||||
|
meta.mainProgram = "openssl";
|
||||||
|
};
|
||||||
|
args = [
|
||||||
|
"x509"
|
||||||
|
"-noout"
|
||||||
|
"-in" config.bundleFile
|
||||||
|
"-subject"
|
||||||
|
"-issuer"
|
||||||
|
"-ext" "subjectAltName,extendedKeyUsage"
|
||||||
|
"-enddate"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
mtlsNeedsRenewal = inputs.wrappers.lib.wrapModule ({ config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
certFile = lib.mkOption {
|
||||||
|
description = "String path for the public cert";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "mtls-needs-renewal";
|
||||||
|
package = config.pkgs.step-cli;
|
||||||
|
preHook = ''
|
||||||
|
echo "Checking renewal status..."
|
||||||
|
'';
|
||||||
|
args = [ "certificate" "needs-renewal" "${config.certFile}" ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
mtlsRenew = inputs.wrappers.lib.wrapModule ({ config, lib, wlib, ... }: {
|
||||||
|
imports = [ wlib.modules.systemd ];
|
||||||
|
|
||||||
|
options = {
|
||||||
|
certDir = lib.mkOption {
|
||||||
|
description = "String path to the directory where the certs will be stored";
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
keyFile = lib.mkOption {
|
||||||
|
description = "String path for the private key";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.certDir}/key.pem";
|
||||||
|
};
|
||||||
|
certFile = lib.mkOption {
|
||||||
|
description = "String path for the public cert";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.certDir}/cert.pem";
|
||||||
|
};
|
||||||
|
bundleFile = lib.mkOption {
|
||||||
|
description = "String path for the mTLS key bundle";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.certDir}/mtls.pem";
|
||||||
|
};
|
||||||
|
user = lib.mkOption {
|
||||||
|
description = "User that should own the renewed certificate files.";
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
group = lib.mkOption {
|
||||||
|
description = "Group that should own the renewed certificate files.";
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = null;
|
||||||
|
};
|
||||||
|
reloadUnits = lib.mkOption {
|
||||||
|
description = "systemd units to try-reload-or-restart after a successful renewal.";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
postCommands = lib.mkOption {
|
||||||
|
description = "Shell commands to run after a successful renewal.";
|
||||||
|
type = lib.types.listOf lib.types.lines;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
systemctlArgs = lib.mkOption {
|
||||||
|
description = "Additional arguments to pass to systemctl when reloading units.";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "mtls-renew";
|
||||||
|
package = let
|
||||||
|
systemctlCmd = "systemctl ${lib.escapeShellArgs config.systemctlArgs}";
|
||||||
|
|
||||||
|
hasReloadUnits = config.reloadUnits != [ ];
|
||||||
|
renewReloadScript = lib.concatMapStringsSep "\n" (unit: ''
|
||||||
|
if ${systemctlCmd} --quiet is-active "${unit}"; then
|
||||||
|
${systemctlCmd} try-reload-or-restart "${unit}"
|
||||||
|
fi
|
||||||
|
'') config.reloadUnits;
|
||||||
|
|
||||||
|
hasPostCommands = config.postCommands != [ ];
|
||||||
|
renewPostCommands = lib.concatStringsSep "\n" config.postCommands;
|
||||||
|
|
||||||
|
hasOwnership = config.user != null && config.group != null;
|
||||||
|
in
|
||||||
|
config.pkgs.writeShellApplication {
|
||||||
|
name = "mtls-renew";
|
||||||
|
runtimeInputs = with config.pkgs; [ coreutils step-cli systemd ];
|
||||||
|
text = ''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
YELLOW_BANG="\e[33m!\e[0m"
|
||||||
|
|
||||||
|
force=0
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
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 "${config.certFile}"; then
|
||||||
|
echo "Skipping renew"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Renewing mTLS certificate"
|
||||||
|
step ca renew --force "${config.certFile}" "${config.keyFile}"
|
||||||
|
(umask 077; cat "${config.certFile}" "${config.keyFile}" > "${config.bundleFile}")
|
||||||
|
|
||||||
|
${lib.optionalString hasOwnership ''
|
||||||
|
chown ${config.user}:${config.group} ${config.certFile} ${config.keyFile} ${config.bundleFile}
|
||||||
|
chmod 640 ${config.certFile} ${config.keyFile} ${config.bundleFile}
|
||||||
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString hasReloadUnits ''
|
||||||
|
echo "Reloading units: ${lib.concatStringsSep ", " config.reloadUnits}"
|
||||||
|
${renewReloadScript}
|
||||||
|
''}
|
||||||
|
|
||||||
|
${lib.optionalString hasPostCommands ''
|
||||||
|
echo "Running post commands"
|
||||||
|
${renewPostCommands}
|
||||||
|
''}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
extraPackages = [
|
||||||
|
config.pkgs.step-cli
|
||||||
|
];
|
||||||
|
systemd = {
|
||||||
|
description = "Automatic mTLS renewal service";
|
||||||
|
documentation = [
|
||||||
|
"https://smallstep.com/docs/step-ca/certificate-authority-server-production"
|
||||||
|
];
|
||||||
|
startLimitIntervalSec = 0;
|
||||||
|
after = [ "network-online.target" ];
|
||||||
|
wants = [ "network-online.target" ];
|
||||||
|
serviceConfig.Type = lib.mkDefault "oneshot";
|
||||||
|
# serviceConfig.ExecCondition = "";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }: {
|
{ self, inputs, ... }: {
|
||||||
flake.modules.nixos.restic-server = { config, pkgs, lib, ... }: {
|
flake.modules.nixos.restic-server = { config, pkgs, lib, ... }: {
|
||||||
services.restic.server = {
|
services.restic.server = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -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";
|
|
||||||
mtlsClientCert = "${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 = mtlsClientCert;
|
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=${mtlsClientCert}"
|
"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 = {
|
||||||
@@ -103,7 +103,6 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# This module provides all the shell options
|
||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.homeManager.shell-tools = { config, pkgs, ... }: {
|
||||||
|
imports = with inputs.self.modules.homeManager; [
|
||||||
|
# bash
|
||||||
|
zsh
|
||||||
|
files
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
btop
|
||||||
|
uv
|
||||||
|
xclip
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.shell-tools
|
||||||
|
];
|
||||||
|
|
||||||
|
home.shell.enableShellIntegration = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { system, pkgs, self', ... }: {
|
||||||
|
packages.shell-tools = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
# binName = "show-tools";
|
||||||
|
package = (pkgs.symlinkJoin {
|
||||||
|
name = "show-tools";
|
||||||
|
meta.mainProgram = "show-tools";
|
||||||
|
paths = with pkgs; [
|
||||||
|
nh
|
||||||
|
ripgrep
|
||||||
|
fd
|
||||||
|
jq
|
||||||
|
wget
|
||||||
|
curl
|
||||||
|
dig
|
||||||
|
self'.packages.gdu
|
||||||
|
self'.packages.my-eza
|
||||||
|
hostname
|
||||||
|
iproute2
|
||||||
|
direnv
|
||||||
|
(writeShellApplication {
|
||||||
|
name = "show-tools";
|
||||||
|
text = ''
|
||||||
|
IFS=':' read -r -a path_dirs <<< "''${PATH:-}"
|
||||||
|
|
||||||
|
for dir in "''${path_dirs[@]}"; do
|
||||||
|
[[ "$dir" == */bin ]] || continue
|
||||||
|
[[ -d "$dir" ]] || continue
|
||||||
|
|
||||||
|
printf '%s\n' "$dir"/*
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.gdu = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
package = pkgs.gdu;
|
||||||
|
args = [ "-x" "--si" "--collapse-path" "--mouse" "$@" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
{ self, inputs, ... }:
|
||||||
|
let
|
||||||
|
mkPrincipalArgs = principals:
|
||||||
|
builtins.concatLists (map (principal: [ "--principal" principal ]) principals);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
perSystem = { system, self', pkgs, lib, ... }: {
|
||||||
|
packages.ssh-certs = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
package = (pkgs.symlinkJoin {
|
||||||
|
name = "ssh-certs";
|
||||||
|
meta.mainProgram = "sign-ssh-user-cert";
|
||||||
|
paths = [
|
||||||
|
(inputs.self.wrappers.signUserWrapper.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
provisioner = "admin";
|
||||||
|
overwrite = true;
|
||||||
|
validUsers = [ "john" "root" "appdaemon" ];
|
||||||
|
}).wrapper
|
||||||
|
|
||||||
|
(inputs.self.wrappers.signHostWrapper.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
provisioner = "admin";
|
||||||
|
overwrite = true;
|
||||||
|
# extraPrincipals = [ "home-pc" ];
|
||||||
|
}).wrapper
|
||||||
|
];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.wrappers.signHostWrapper = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
provisioner = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = "admin";
|
||||||
|
};
|
||||||
|
extraPrincipals = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
overwrite = lib.mkEnableOption "Overwrite existing cert file?";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "sign-ssh-host-cert";
|
||||||
|
package = config.pkgs.step-cli;
|
||||||
|
extraPackages = with config.pkgs; [ hostname iproute2 systemd ];
|
||||||
|
preHook = ''
|
||||||
|
HOSTNAME=$(hostname -s)
|
||||||
|
IP_ADDRESS=$(ip -4 -o addr show scope global | while read -r _ _ _ addr _; do
|
||||||
|
case "$addr" in
|
||||||
|
192.168.1.*/*)
|
||||||
|
printf '%s\n' "''${addr%%/*}"
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done)
|
||||||
|
echo "Signing SSH host cert for $HOSTNAME at $IP_ADDRESS"
|
||||||
|
'';
|
||||||
|
args =
|
||||||
|
[
|
||||||
|
"ssh" "certificate"
|
||||||
|
"--host" "--sign"
|
||||||
|
"--principal" "$HOSTNAME"
|
||||||
|
"--principal" "$IP_ADDRESS"
|
||||||
|
]
|
||||||
|
++ lib.optionals (config.provisioner != null) [ "--provisioner" "${config.provisioner}" ]
|
||||||
|
++ lib.optionals config.overwrite [ "-f" ]
|
||||||
|
++ mkPrincipalArgs config.extraPrincipals;
|
||||||
|
postHook = ''
|
||||||
|
systemctl reload-or-restart sshd
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
flake.wrappers.signUserWrapper = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
provisioner = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = "admin";
|
||||||
|
};
|
||||||
|
validUsers = lib.mkOption {
|
||||||
|
description = "A list of the user names that this cert will be valid for";
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
overwrite = lib.mkEnableOption "Overwrite existing cert file?";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "sign-ssh-user-cert";
|
||||||
|
package = config.pkgs.step-cli;
|
||||||
|
args = [ "ssh" "certificate" "--sign" ]
|
||||||
|
++ lib.optionals (config.provisioner != null) [ "--provisioner" "${config.provisioner}" ]
|
||||||
|
++ lib.optionals config.overwrite [ "-f" ]
|
||||||
|
++ mkPrincipalArgs config.validUsers;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.homeManager.step-client = { config, pkgs, lib, ... }: {
|
||||||
|
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
||||||
|
ca-url = "https://janus.john-stream.com/";
|
||||||
|
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
||||||
|
root = ../hosts/janus/root_ca.crt;
|
||||||
|
};
|
||||||
|
home.packages = [
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.step-bootstrap
|
||||||
|
];
|
||||||
|
# sops.secrets."step-ca-defaults" = {
|
||||||
|
# sopsFile = ../hosts/janus/defaults.json;
|
||||||
|
# format = "json";
|
||||||
|
# key = ""; # This causes it to decode the whole file
|
||||||
|
# path = "${config.home.homeDirectory}/defaults.json";
|
||||||
|
# mode = "0400";
|
||||||
|
# };
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { system, pkgs, lib, ... }: {
|
||||||
|
packages.step-bootstrap = (inputs.self.wrappers.stepBootstrap.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
ca-url = "https://janus.john-stream.com";
|
||||||
|
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
||||||
|
install = true;
|
||||||
|
}).wrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.wrappers.stepBootstrap = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
ca-url = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
fingerprint = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
install = lib.mkEnableOption "Install the cert to the system trust store";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "step-bootstrap";
|
||||||
|
package = config.pkgs.step-cli;
|
||||||
|
args = [
|
||||||
|
"ca" "bootstrap"
|
||||||
|
"--ca-url" config.ca-url
|
||||||
|
"--fingerprint" config.fingerprint
|
||||||
|
]
|
||||||
|
++ lib.optional config.install "--install";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
{ inputs, ... }:
|
|
||||||
let
|
|
||||||
username = "john";
|
|
||||||
hostname = "janus";
|
|
||||||
caURL = "https://janus.john-stream.com/";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
flake.nixosConfigurations."${hostname}" = inputs.nixpkgs.lib.nixosSystem {
|
|
||||||
modules = with inputs.self.modules; [
|
|
||||||
nixos.lxc
|
|
||||||
nixos.mysops
|
|
||||||
nixos.step-ssh-host
|
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
nixos."${username}"
|
|
||||||
nixos.zsh
|
|
||||||
nixos.docker
|
|
||||||
nixos.login-text
|
|
||||||
nixos.mtls
|
|
||||||
{
|
|
||||||
networking.hostName = hostname;
|
|
||||||
step-ssh-host = {
|
|
||||||
hostname = hostname;
|
|
||||||
caURL = caURL;
|
|
||||||
};
|
|
||||||
mtls = {
|
|
||||||
enable = true;
|
|
||||||
subject = hostname;
|
|
||||||
caURL = caURL;
|
|
||||||
san = [
|
|
||||||
"${hostname}.john-stream.com"
|
|
||||||
"192.168.1.244"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users."${username}" = {
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
|
||||||
sops
|
|
||||||
step-ssh-user
|
|
||||||
];
|
|
||||||
|
|
||||||
shell.program = "zsh";
|
|
||||||
docker.enable = true;
|
|
||||||
# step-ssh-user = {
|
|
||||||
# enable = true;
|
|
||||||
# principals = [ "${hostname}" ];
|
|
||||||
# };
|
|
||||||
ssh.matchSets = {
|
|
||||||
certs = true;
|
|
||||||
homelab = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
{ inputs, ... }:
|
||||||
|
let
|
||||||
|
username = "john";
|
||||||
|
hostname = "janus";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.nixos.janus-ca =
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.janus-ca;
|
||||||
|
johnHome = lib.attrByPath [ "users" "users" username "home" ] "/home/${username}" config;
|
||||||
|
johnGroup = lib.attrByPath [ "users" "users" username "group" ] username config;
|
||||||
|
cfgInEtc = lib.hasPrefix "/etc/" cfg.certDir;
|
||||||
|
certDirEtcPath =
|
||||||
|
if cfgInEtc then
|
||||||
|
lib.removePrefix "/etc/" cfg.certDir
|
||||||
|
else
|
||||||
|
cfg.certDir;
|
||||||
|
certRootEtcPath = "${certDirEtcPath}/root_ca.crt";
|
||||||
|
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-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 {
|
||||||
|
ca-url = "https://janus.john-stream.com/";
|
||||||
|
fingerprint = builtins.readFile ./fingerprint;
|
||||||
|
root = "/etc/${certRootEtcPath}";
|
||||||
|
};
|
||||||
|
"${certRootEtcPath}".source = ./root_ca.crt;
|
||||||
|
};
|
||||||
|
systemd.tmpfiles.rules =
|
||||||
|
mkStepRules johnHome username johnGroup
|
||||||
|
++ mkStepRules "/root" "root" "root";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager.janus-ca = { config, ... }: {
|
||||||
|
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
||||||
|
ca-url = "https://janus.john-stream.com/";
|
||||||
|
fingerprint = builtins.readFile ./fingerprint;
|
||||||
|
root = ./root_ca.crt;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.nixosConfigurations."${hostname}" = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
modules = with inputs.self.modules; [
|
||||||
|
nixos.lxc
|
||||||
|
nixos.mysops
|
||||||
|
nixos.step-ssh-host
|
||||||
|
nixos.janus-ca
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
nixos."${username}"
|
||||||
|
nixos.docker
|
||||||
|
nixos.login-text
|
||||||
|
nixos.mtls
|
||||||
|
{
|
||||||
|
networking.hostName = hostname;
|
||||||
|
step-ssh-host = {
|
||||||
|
hostname = hostname;
|
||||||
|
};
|
||||||
|
mtls = {
|
||||||
|
enable = true;
|
||||||
|
subject = hostname;
|
||||||
|
san = [
|
||||||
|
"${hostname}.john-stream.com"
|
||||||
|
"192.168.1.244"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users."${username}" = {
|
||||||
|
imports = with inputs.self.modules.homeManager; [
|
||||||
|
mysops
|
||||||
|
];
|
||||||
|
shell.program = "zsh";
|
||||||
|
docker.enable = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
{ self, inputs, ... }:
|
||||||
|
{
|
||||||
|
flake.modules.nixos.p14sConfiguration = { config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
hostname = "john-p14s";
|
||||||
|
homeDirectory = config.home-manager.users.john.home.homeDirectory;
|
||||||
|
flakeDir = "${homeDirectory}/Documents/dendritic";
|
||||||
|
selfPkgs = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
self.modules.nixos.p14sHardware
|
||||||
|
];
|
||||||
|
|
||||||
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
nixpkgs.config = {
|
||||||
|
permittedInsecurePackages = [ "openssl-1.1.1w" ];
|
||||||
|
allowUnfree = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
rebuild.flakeDir = flakeDir;
|
||||||
|
|
||||||
|
networking = {
|
||||||
|
hostName = hostname;
|
||||||
|
networkmanager.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Enable automatic login for the user.
|
||||||
|
# services.displayManager.autoLogin.enable = true;
|
||||||
|
# services.displayManager.autoLogin.user = "john";
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.tailscale.enable = true;
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
samba
|
||||||
|
selfPkgs.my-neovim
|
||||||
|
selfPkgs.wg-platform
|
||||||
|
selfPkgs.jsl-zsh
|
||||||
|
];
|
||||||
|
|
||||||
|
security.pam.services.swaylock = {};
|
||||||
|
security.pam.services.swaylock.fprintAuth = true;
|
||||||
|
|
||||||
|
programs._1password.enable = true;
|
||||||
|
programs._1password-gui = {
|
||||||
|
enable = true;
|
||||||
|
# Certain features, including CLI integration and system authentication support,
|
||||||
|
# require enabling PolKit integration on some desktop environments (e.g. Plasma).
|
||||||
|
polkitPolicyOwners = [ "john" ];
|
||||||
|
# TODO this should not be a hardcoded username
|
||||||
|
};
|
||||||
|
|
||||||
|
# This is needed for VSCode remote support. Read: https://nixos.wiki/wiki/Visual_Studio_Code
|
||||||
|
programs.nix-ld.enable = true;
|
||||||
|
|
||||||
|
# This value determines the NixOS release from which the default
|
||||||
|
# settings for stateful data, like file locations and database versions
|
||||||
|
# on your system were taken. It's perfectly fine and recommended to leave
|
||||||
|
# this value at the release version of the first install of this system.
|
||||||
|
# Before changing this value read the documentation for this option
|
||||||
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
||||||
|
system.stateVersion = "24.05"; # Did you read the comment?
|
||||||
|
|
||||||
|
# Set your time zone.
|
||||||
|
time.timeZone = "America/Chicago";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n = {
|
||||||
|
defaultLocale = "en_US.UTF-8";
|
||||||
|
extraLocaleSettings = {
|
||||||
|
LC_ADDRESS = "en_US.UTF-8";
|
||||||
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
||||||
|
LC_MEASUREMENT = "en_US.UTF-8";
|
||||||
|
LC_MONETARY = "en_US.UTF-8";
|
||||||
|
LC_NAME = "en_US.UTF-8";
|
||||||
|
LC_NUMERIC = "en_US.UTF-8";
|
||||||
|
LC_PAPER = "en_US.UTF-8";
|
||||||
|
LC_TELEPHONE = "en_US.UTF-8";
|
||||||
|
LC_TIME = "en_US.UTF-8";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fonts.packages = with pkgs; [
|
||||||
|
nerd-fonts.hack
|
||||||
|
nerd-fonts.sauce-code-pro
|
||||||
|
];
|
||||||
|
|
||||||
|
services.libinput.enable = true; # Enable touchpad support (enabled default in most desktopManager).
|
||||||
|
services.fprintd.enable = true; # Enables fingerprint sensor
|
||||||
|
|
||||||
|
# Enable sound with pipewire.
|
||||||
|
services.pulseaudio.enable = false;
|
||||||
|
security.rtkit.enable = true; # PulseAudio server uses this to acquire realtime priority.
|
||||||
|
services.pipewire = {
|
||||||
|
enable = true;
|
||||||
|
alsa.enable = true;
|
||||||
|
alsa.support32Bit = true;
|
||||||
|
pulse.enable = true;
|
||||||
|
# If you want to use JACK applications, uncomment this
|
||||||
|
#jack.enable = true;
|
||||||
|
|
||||||
|
# use the example session manager (no others are packaged yet so this is enabled by default,
|
||||||
|
# no need to redefine it in your config for now)
|
||||||
|
# media-session.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.root = {
|
||||||
|
imports = with inputs.self.modules.homeManager; [
|
||||||
|
rebuild
|
||||||
|
];
|
||||||
|
home.stateVersion = "25.11";
|
||||||
|
};
|
||||||
|
home-manager.users.john.imports = with inputs.self.modules.homeManager; [
|
||||||
|
gnome
|
||||||
|
desktop
|
||||||
|
mysops
|
||||||
|
rebuild
|
||||||
|
{
|
||||||
|
my-vscode.enable = true;
|
||||||
|
mysops.hostSecretFile = "${flakeDir}/modules/hosts/john-p14s/secrets.yaml";
|
||||||
|
homeManagerFlakeDir = "${flakeDir}";
|
||||||
|
shell.program = "zsh";
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
bash
|
||||||
|
discord
|
||||||
|
proton-vpn
|
||||||
|
joplin-desktop
|
||||||
|
];
|
||||||
|
ssh.certificates.enable = true;
|
||||||
|
ssh.matchSets = {
|
||||||
|
appdaemon = true;
|
||||||
|
homelab = true;
|
||||||
|
dev = true;
|
||||||
|
certs = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
sops.age.sshKeyPaths = [ "${homeDirectory}/.ssh/id_ed25519" ];
|
||||||
|
mtls = {
|
||||||
|
enable = true;
|
||||||
|
subject = hostname;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake-file.inputs = {
|
||||||
|
nixos-hardware = {
|
||||||
|
url = "github:NixOS/nixos-hardware";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.nixosConfigurations.john-p14s = inputs.nixpkgs.lib.nixosSystem {
|
||||||
|
modules = [
|
||||||
|
"${inputs.nixos-hardware}/lenovo/thinkpad/p14s"
|
||||||
|
"${inputs.nixos-hardware}/lenovo/thinkpad/p14s/amd/gen4"
|
||||||
|
] ++ (with self.modules.nixos; [
|
||||||
|
p14sConfiguration
|
||||||
|
janus-ca
|
||||||
|
rebuild
|
||||||
|
sudo
|
||||||
|
john
|
||||||
|
gnome
|
||||||
|
steam
|
||||||
|
wireguard
|
||||||
|
mtls
|
||||||
|
# greetd
|
||||||
|
# niri
|
||||||
|
]);
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.p14sHardware = { config, lib, pkgs, modulesPath, ... }: {
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot = {
|
||||||
|
loader = {
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
initrd = {
|
||||||
|
availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ];
|
||||||
|
kernelModules = [ "amdgpu" ];
|
||||||
|
};
|
||||||
|
kernelModules = [ "kvm-amd" ];
|
||||||
|
extraModulePackages = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# boot.loader.systemd-boot.enable = true;
|
||||||
|
# boot.loader.efi.canTouchEfiVariables = true;
|
||||||
|
# boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "usb_storage" "usbhid" "sd_mod" ];
|
||||||
|
# boot.initrd.kernelModules = [ "amdgpu" ];
|
||||||
|
# boot.kernelModules = [ "kvm-amd" ];
|
||||||
|
# boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" = {
|
||||||
|
device = "/dev/disk/by-uuid/fbc7d8bc-080b-4554-a2b2-5f92d059ce07";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" = {
|
||||||
|
device = "/dev/disk/by-uuid/9A04-ADD8";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0022" "dmask=0022" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
|
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||||
|
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||||
|
# still possible to use this option, but it's recommended to use it in conjunction
|
||||||
|
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||||
|
networking.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp102s0u2u4.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.enp1s0f0.useDHCP = lib.mkDefault true;
|
||||||
|
# networking.interfaces.wlp2s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
|
||||||
|
hardware.graphics = {
|
||||||
|
enable = true;
|
||||||
|
enable32Bit = true;
|
||||||
|
extraPackages = [ pkgs.rocmPackages.clr.icd ];
|
||||||
|
};
|
||||||
|
environment.variables.AMD_VULKAN_ICD = "RADV";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
restic_password: ENC[AES256_GCM,data:8KeL7kOMTHkK+ZpY3aq0/S4UYbkZh72FxJAolcVes79NPfdHiNi77fmAZuXb8Gxasu16vk4y6ksWFmrZquvcbg+cLt8Yze+qvuCiUW62IOppzRIBLk6w2f8uPhU41gsVuj6u4Jz/Su7miNBvJYmF8vulIwDKS7qg43dzIKXY4q1HaRHCD12PkU9EfGpIgivdNCOO0lCE6m/O3IB8Ed4R51scBnVrIj89K5OuTepvIrGElmXiWqBdsTzCIaJCZJ8fDnzJPorLhsTAzKCnQhNoIrW/aYArzj9+WmglmGuqeaoemBoNTrYC9bssUwuWAOqsf1HC7gWST/dP9FmKl7UHlgkslblRcRedFPAQjDhy/RgZCj8hs/XrVYOzwW8WJ0XeB9UPK03QPJc8EZdz9r2Q0+U3LQxMV6Jne5JZGsMpII4b+7b/WbRZTooX3G09MES/gzwD+hyBr++6EpP9QTYs+4XsNLNN+S6y5+YS/7XmRvR7xb93eZ4EfUUKiQYejVKQBl9b8QTJa3q26RPa/82O5zQlzd1w/EjA4G6Vv8H6wvK0fHNwpU3hl9V8EL7Ca7JKfJr11Vw0fNHx2nXjOLURt27wbDeWUaSrzI+z2h/0TSiKWas/Eu5+4L9n7E3H5u5Hg2uaCQkDpy6RJkW9UL6lCC1YEJw5yHTugrPNoMcRlAKRoSIeSZSPfGl0CKYAC39s422xX2f46GpJu0bO8GG/XN9Qk+SxqPHGuzx7nWghFQctZb1ssGKuvHKqaNYZvWeWqqkxyPWb6xjaBaSGxcp5MsET+RAu2F1XgX9Is11mIJETlHhRE3OpMSHh7toIiuNs8YzsgkedVFWhx+Xu27DWvOFvg/01Rh6s5RGJKMgL7WQMLTtY2KI/ko648WXVoCtVymG8d30qWnSt8319jkILX/wdB8Vqp5ceRqHwDE89jhEh0GOg07eLcREnh+gjXij1/bS66/+hHk4jhkzGtbdfEji9sro4Nm+kVRA+6fgJjCvt1sAvjuj10Scx4uH3AdDTW+y0KaniK8EHTZzaGDuaV+tk3hZEfpwpdan5mquoQvFdZWsWlDefX7gRq38szmi9LtULEai0WKOtqnnDIOnWk/3NYeNdzJ28YzrUDbkxtghkRgr7fNGEtyCGRuWRRMc5mVp2FPzAwRKk29ShILpWbvfUzwAWUOEpyAS4bstzlMybf9L8sp20+Ier8gOMGJ81eXXXmhtgMn6aWZ6EDGe1Shl0gDM0JUEAkA2+kf3oIZAvcWiFxj7vyd4Aacw3RetUSJcy8JwbV3I/isxKyy/xs8zE2PUY0z3Cwh9MpVP9G8N6Mef6v2DNDNg+2iJ/eslQdbZRQzdJwnBMhpOopzRwuUaC7jJKyGBkcNbbmNjceJWEue0XVjIcZHJ7BFe3jKluezNIJIf268V35+HIpXJA7BUJn8NPCIQXze5Frm46U2aRTQ53LU4HBGLXYPzx8QLsn0jLVy518w/TztawdT3/SmSWNwYTuZG18TmXs9v3oB6PrUr4M7kJbNRLpRb0ZelbMDwpR074FPwwud6fkjR2lLQBbufmPUBdpVJZ2xFjijle8h1h29zoFsydFNq5wSXUO/nm/S09KdKi5F2S1uKP+NL80OVEeC+QXcBdTry07meVIhsBOh+9ajy1ExaMaPs2xjB5QvTgJA9kfJOAoUygjMC33FwdRw10eGP//IsiRm9EukF1o++MfZnAtcjhoOoy79TjlO8p8YVNwEhZ14Ik/kIizyQtr0gR+pVEIc6+1W29UOWNRXb+ZavXRDq0wvxigMagfcL+zIr4gctufTfubiOmVa85qVJB,iv:VogP+OQvlsYCSqlmffO+o99C0hJm63ZqLXVd2B0oom0=,tag:+se1QHW6xLMj/dZrbY0MKQ==,type:str]
|
||||||
|
wireguard_private_key: ENC[AES256_GCM,data:sCskwDhemU1y4M4A4R9KxwiL8q+FtxnUqg1omU7yS81H1bbSM804hNzmq+A=,iv:7wNMAG+7wYYXYgKEohIAYisMN5lbz+M5RhCEaHL4yWE=,tag:FENdJTEEGD9cEJVwIIUQDA==,type:str]
|
||||||
|
sops:
|
||||||
|
age:
|
||||||
|
- recipient: age1f6drjusg866yscj8029tk4yfpgecklrvezldm02ankm6h8nnwu5s2u6ahy
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBHS0F1R0NnV0gyNFlkUEhZ
|
||||||
|
UkxvN1ZLQTFsV0tnR0pLNFJycmduU1VXUlFVCjBkRGxQd1B1c3cweTRsZm9OUCt0
|
||||||
|
anU3RTFUUkxoaXlhdlR0RkxPclVUdVkKLS0tIG9kTEVNK2piRWI5ZWFSejFFUGtD
|
||||||
|
emtTUGk0cVZWR3F5R05WTTFJUFUwNTAKrRYQAJen6QVSgaOyqPxSIniHiMLUfXuv
|
||||||
|
/O1Ebz5xLWn99EhloqW7rHhUxXlhxP2CmwfYXizyKFa6nAu6R+BCgg==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
- recipient: age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBXNWRXZTFWREIzRVhRaWRB
|
||||||
|
anNDb3hsZzFOMFMrclhmeldaOWY4b3BJekFBCkJhbjRvRUwva3lFbzNTKzJqK2p2
|
||||||
|
WVlMaXpvczlhdGduZHIrb2xPaEg3OUUKLS0tIHFtM09mN0FEUWdjWEVEL3VXL00w
|
||||||
|
WHpOY280S2hpVU1mNnozODRoMnB4bGMKK5RrDK2kAZlWf2igqyzWgshxLPj+f74A
|
||||||
|
mCmMLDHo5drNieFYp+guqHaHnZkf9IzpAglj7x6wCITjk+l6go5KvA==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2026-03-27T03:59:09Z"
|
||||||
|
mac: ENC[AES256_GCM,data:MsPAxssWUSvsJQP0Ogrl3r/GoVqeL1L95YTJQbAJZ4FVxhRXP7KfbUnKSclzU6G8CP5WxV18TXZfB4JITKG3Lz5rtVpD/WFMdhDmve0f6BPMAimle2ajWUaWYNePvEynClX3nydLk3h31DjHGa8YvJZqW2ieDb/JDMdBXiLTrWc=,iv:82ul5CV3XXllFCDJfF6beIcAIFj71ycJJF4iEQvovMA=,tag:108L7VkAoPUTLtV74qgrrA==,type:str]
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.12.2
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
{ inputs, ... }:
|
|
||||||
let
|
|
||||||
username = "john";
|
|
||||||
hostname = "john-pc-ubuntu";
|
|
||||||
# testTarget = "fded:fb16:653e:25da:be24:11ff:fea0:753f";
|
|
||||||
testTarget = "fded:fb16:653e:25da:be24:11ff:fe89:1cc3";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
flake.modules.homeManager."${hostname}" = { pkgs, config, ... }:
|
|
||||||
let
|
|
||||||
flakeDir = "${config.xdg.configHome}/home-manager/jsl-dendritic";
|
|
||||||
certDir = "${config.mtls.certDir}";
|
|
||||||
CACert = "${certDir}/root_ca.crt";
|
|
||||||
mtlsBundle = "${certDir}/${config.mtls.bundleFilename}";
|
|
||||||
resticPasswordFile = "${config.xdg.configHome}/restic/password.txt";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
|
||||||
rebuild
|
|
||||||
john
|
|
||||||
mysops
|
|
||||||
step-ssh-user
|
|
||||||
mtls
|
|
||||||
restic
|
|
||||||
docker
|
|
||||||
desktop
|
|
||||||
];
|
|
||||||
targets.genericLinux.enable = true;
|
|
||||||
|
|
||||||
shell.program = "zsh";
|
|
||||||
|
|
||||||
home.username = "${username}";
|
|
||||||
home.homeDirectory = "/home/${username}";
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
nixos-rebuild
|
|
||||||
(writeShellScriptBin "test-push" ''
|
|
||||||
mkdir -p /var/tmp/nix-build
|
|
||||||
chmod 1777 /var/tmp/nix-build
|
|
||||||
nixos-rebuild switch \
|
|
||||||
--flake ${flakeDir}#john-pc-ubuntu \
|
|
||||||
--target-host root@${testTarget}
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
# TODO: make this more restrictive, rather than allowing all unfree packages
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
|
||||||
nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ];
|
|
||||||
|
|
||||||
homeManagerFlakeDir = flakeDir;
|
|
||||||
docker.enable = true;
|
|
||||||
|
|
||||||
step-ssh-user = {
|
|
||||||
enable = true;
|
|
||||||
principals = ["root" "${username}" "appdaemon"];
|
|
||||||
provisioner = "admin";
|
|
||||||
};
|
|
||||||
ssh = {
|
|
||||||
certificates.enable = true;
|
|
||||||
matchSets = {
|
|
||||||
certs = true;
|
|
||||||
appdaemon = true;
|
|
||||||
homelab = true;
|
|
||||||
dev = true;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mysops.hostSecretFile = "${config.xdg.configHome}/home-manager/jsl-dendritic/secrets.yaml";
|
|
||||||
sops.defaultSopsFile = "${config.xdg.configHome}/home-manager/jsl-dendritic/secrets.yaml";
|
|
||||||
|
|
||||||
sops.secrets."restic_password/john_ubuntu" = {
|
|
||||||
path = resticPasswordFile;
|
|
||||||
mode = "0400";
|
|
||||||
};
|
|
||||||
restic = {
|
|
||||||
passwordFile = resticPasswordFile;
|
|
||||||
OnCalendar = "*:0/15";
|
|
||||||
paths = [ "${config.xdg.userDirs.documents}" "/conf" ];
|
|
||||||
exclude = [
|
|
||||||
"/home/*/Pictures"
|
|
||||||
"/home/*/Videos"
|
|
||||||
"/home/*/go"
|
|
||||||
"/home/*/snap"
|
|
||||||
"/home/john/john-nas"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
mtls = {
|
|
||||||
enable = true;
|
|
||||||
caURL = "https://janus.john-stream.com/";
|
|
||||||
provisioner = "admin";
|
|
||||||
subject = hostname;
|
|
||||||
san = [
|
|
||||||
"${hostname}"
|
|
||||||
"192.168.1.85"
|
|
||||||
"spiffe://john-stream.com/ubuntu"
|
|
||||||
];
|
|
||||||
lifetime = "1h";
|
|
||||||
renew.onCalendar = "*:1/10";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
|
||||||
modules = with inputs.self.modules; [
|
|
||||||
homeManager."${hostname}"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
{ withSystem, self, inputs, ... }:
|
||||||
|
let
|
||||||
|
username = "john";
|
||||||
|
hostname = "john-pc-ubuntu";
|
||||||
|
|
||||||
|
# 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
|
||||||
|
{
|
||||||
|
flake.modules.homeManager."${hostname}" = { config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
selfPkgs = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
|
||||||
|
resticPasswordFile = "${config.xdg.configHome}/restic/password.txt";
|
||||||
|
flakeDir = "${config.xdg.configHome}/home-manager/jsl-dendritic";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = with inputs.self.modules.homeManager; [
|
||||||
|
rebuild
|
||||||
|
john
|
||||||
|
mtls
|
||||||
|
restic
|
||||||
|
docker
|
||||||
|
desktop
|
||||||
|
step-client
|
||||||
|
mysops
|
||||||
|
# myPackage
|
||||||
|
# myStepClient
|
||||||
|
];
|
||||||
|
# TODO: make this more restrictive, rather than allowing all unfree packages
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
nixpkgs.config.permittedInsecurePackages = [ "openssl-1.1.1w" ];
|
||||||
|
|
||||||
|
targets.genericLinux.enable = true;
|
||||||
|
|
||||||
|
home.username = "${username}";
|
||||||
|
home.homeDirectory = "/home/${username}";
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
selfPkgs.jsl-zsh
|
||||||
|
selfPkgs.my-neovim
|
||||||
|
selfPkgs.ssh-certs
|
||||||
|
# selfPkgs.step-bootstrap
|
||||||
|
# selfPkgs.wg-platform
|
||||||
|
# self'.packages.myWrappedPackage
|
||||||
|
(inputs.self.wrappers.test-push.apply {
|
||||||
|
inherit pkgs flakeDir;
|
||||||
|
host = testHost;
|
||||||
|
target = testTarget;
|
||||||
|
}).wrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
homeManagerFlakeDir = flakeDir;
|
||||||
|
docker.enable = true;
|
||||||
|
|
||||||
|
ssh = {
|
||||||
|
certificates.enable = true;
|
||||||
|
knownHosts = [
|
||||||
|
"fded:fb16:653e:25da:be24:11ff:fea0:753f ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9ZqiWPrCwHjxFCiu0lT4rlQs7KyMapxKJQQ5PJP1eh"
|
||||||
|
];
|
||||||
|
matchSets = {
|
||||||
|
certs = true;
|
||||||
|
appdaemon = true;
|
||||||
|
homelab = true;
|
||||||
|
dev = true;
|
||||||
|
tailscale = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# This provides the keys at build time and will be included in the nix store
|
||||||
|
sops.defaultSopsFile = ../../../keys/secrets.yaml;
|
||||||
|
|
||||||
|
# This will provide the edit-secrets script targeting this file
|
||||||
|
mysops.hostSecretFile = "${config.xdg.configHome}/home-manager/jsl-dendritic/keys/secrets.yaml";
|
||||||
|
|
||||||
|
sops.secrets."restic_password" = {
|
||||||
|
path = resticPasswordFile;
|
||||||
|
mode = "0400";
|
||||||
|
sopsFile = ./secrets.yaml;
|
||||||
|
};
|
||||||
|
restic = {
|
||||||
|
passwordFile = resticPasswordFile;
|
||||||
|
OnCalendar = "*:0/15";
|
||||||
|
paths = [ "${config.xdg.userDirs.documents}" "/conf" ];
|
||||||
|
exclude = [
|
||||||
|
"/home/*/Pictures"
|
||||||
|
"/home/*/Videos"
|
||||||
|
"/home/*/go"
|
||||||
|
"/home/*/snap"
|
||||||
|
"/home/john/john-nas"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
mtls = {
|
||||||
|
enable = true;
|
||||||
|
subject = hostname;
|
||||||
|
san = [
|
||||||
|
"${hostname}"
|
||||||
|
"192.168.1.85"
|
||||||
|
"spiffe://john-stream.com/ubuntu"
|
||||||
|
];
|
||||||
|
lifetime = "1h";
|
||||||
|
renew.onCalendar = "*:1/10";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.homeConfigurations."john@john-pc-ubuntu" = withSystem "x86_64-linux" (ctx@{ system, inputs', ... }:
|
||||||
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
|
# pkgs = import inputs.nixpkgs {
|
||||||
|
# inherit system;
|
||||||
|
# overlays = [ inputs.self.overlays.default ];
|
||||||
|
# };
|
||||||
|
pkgs = inputs'.nixpkgs.legacyPackages;
|
||||||
|
modules = [ inputs.self.modules.homeManager."${hostname}" ];
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.wrappers.test-push = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
flakeDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
host = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
target = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
sshUser = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "root";
|
||||||
|
};
|
||||||
|
elevationStrategy = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "none";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "test-push";
|
||||||
|
package = config.pkgs.nh;
|
||||||
|
args = [
|
||||||
|
"os" "switch" "${config.flakeDir}#${config.host}"
|
||||||
|
"--target-host" "${config.sshUser}@${config.target}"
|
||||||
|
"--elevation-strategy" "${config.elevationStrategy}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
restic_password: ENC[AES256_GCM,data:BVP4do8UgSX48ovwDH3D2Px6p3lr859F43TTO6pr/fIo78kI0btLDtP+BKbIauawHdvOR7g3dIRrJIvUqDBUnKIH8NE9VxyUrK+U9UzwX17m7T96h/gf3FJ55BEKKVecbJdLrVriq9fVQwUT0Dg2cCZQLctfhwaPNa5Jhkb2oqSKbJ6OmM10eS9KqprE+bVXnCd5vZtRWMKAKiGn3kfKieC79kUcFZla7M739+BMiYa7KvPkhmPOBYwSsWIBQrBFr9X+IDxP0EuEMHrOItnAv/TzG773PM+T+h5rgv6xY+fd1i1cBl5XIijtOGmyJDvrOQLVLTjeoY9LHzYyy31N102mP0SLoz1F4bINMzn1ykvUZCbgSdbyfbBUSS2WJmpbKGrE+KYGxLybFr+4kVYrrONK7Bg7NTWDPcTwdpgDL+Fk8KCiP2jg7sAjpaWRAkwrXpbCwhHPmjmJ7P5tlsxmGy46dZVKmZ3BhPWZlZfQDJ+8NRGn3U56MjGBACLMn1ZvSYXxyWc0SzLRPe2F106XCx3c08jzBaFVP76fLMAY0TXJ6VpvHrEsQKMGLw0pfciisfjRpKmNIPczz5N9wqgJIOrYBTlc/ipugXfJ5HunoLegzc6P/Z2Xjr38Ug0pz86+KhRviLVLvtDtouzpeejOve7FGIiOrd5dNVUsZ2QG+YI5Pbm6tiO/NgTLAWLmlsti1TKN9pen6nvi7NhDPiFMRqQi9FRF2HFxhhvW8uE3Ax8G98xlKcqtmzNidqiZJndAP5EJcJKe0WQUCLnybWNi8nmneFx8iMPEMFpxx9PeYNte4Wdv51P7NYNZmju+4NNaSuWW1sqmi4VJqw0HvhPHJ/8R+AKG8h6BWk00Nsawbn4OHGnz5+jWczUq+hsxeNDutUQf3FWRQIXNE/XGsXXEXBguk1AOScVj2GtdMa5L/Abamq1kx3osXMf2P1HqPHyzQK2a6olZPSVeERr9vk7V5/a0ZYgaIUPq3X8gieo1Fv6gSKiilQ33oAJ3dt0nDvrtzTHtyEuPn4xfG2JKvsFAKQIFbjSObsO6Lb/bVZWjFYc1Wt7I3Jcu6atHxpaFqv+riI4gbdgZ4NcsoruDvm5pGoNfVPoEylstsWXRQ3FptohQ74qr+Z8rAUGwVOXg+HFtFQqETGxy8QPWk0hLupNotxt2uIKpBal/z/6IYvHtP/KwiTaY/tlQmQ9l5qGQJLm1LfhdPCJJNvGUFEDZnrCYl34STIATcFIYmy2AzBQPABH7CFk/4MLeu8aiDRC8LV9zwm5PqYJ8DR0gFk6OJIciJ9rnPomMhyI5svpDQN+q8JpXWkUDl2Hi6sAx/jevk4+RyQaD1z2rusZjO5FJ/zVI2sT//yBdcgg7sNb3UfrIU4RjFP4Ep9iu04Mn3gOpt9RBGt7ITyzqXIvV7Qfy/1C4Uk9Fgj9T+ANPIRtdImTuDB01yP14FBeV02KbdqJCnwpUvArJ85/JDtVZniDm9EwilWJuAMlehDqam7jZEGVJjbnM2PyTci3DOGHAtfxsYX6R6RMD43+ScVY26sLjqNWFJq0FTGqf+yqBlG3XrS0l4P985iy6wL53R+MHvwel2a4mqAW1BNMQT/pCGyBrwuAF1M4Zgz7WAyPU8xCT7dMrq0ZQtsLGgs3qeq5rRVOw61F9zlIgFq72whlQcm0YJ3gAXl+5w742/O2MMpZoixB84Ao34uwkAn3WzGNZvpD+UK0UlpnisiXSVKUxFWZZcssVWUFuFzOSxftvmJ4CWgZu7Waj1oyV6E1Emu/a+uaIhaThdtFdJFmtUQlOjRWQ3e6dGv4FOIIl3ndR,iv:cJZBim2+pQ7o+nhfsgfbWF6PlVizvcUnoc1liLKyxLw=,tag:QPlckxNJslHT5lJ0osHVgA==,type:str]
|
||||||
|
sops:
|
||||||
|
age:
|
||||||
|
- recipient: age1ykcs39e62pz3xu6cedg8ea685kv5d5qsrhgkndygzm8rx30xd5ys5t3qxt
|
||||||
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBZNDh5Ym16YThRTGtRL2RB
|
||||||
|
TWhlOTdubGNsK3c0b2JRQ05rcUsraU10eXdVCm16MTIwdUZMbDlwbkZwVFMyeHVL
|
||||||
|
UlV3cEZwSUJXaVJWb1RHN3M2QUM4Y00KLS0tIFFncStUdEdWVDQzdFFaNk44cERj
|
||||||
|
L1pNOWNucFUvSERMZE9VS3AwMHA3emcKpppJUeUE8iBVNstQTV/3nTK8Jbz8p617
|
||||||
|
rEk1nxzIcHDPNj7jn9ZuIfizIOoaK6S/S5qEJogliA+L3G5SZ2DX7w==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2026-03-25T03:59:38Z"
|
||||||
|
mac: ENC[AES256_GCM,data:6K7fXOkKbpvpvkuBR/INlAPFfvXAW2xwpdn0evB4OaF7NueZvtg9tDJVDtGAxmo78vAOLBEZX8x4h0ezuuWpkDW5LFP6N7O70h4ExlCEH01zcESgk3gjyXLu9gRTM2/7+bvlGLKq2TQYHOF4LYDhcs5/RzWgarFKYljh6m1KbSQ=,iv:Rlh1r588ymZF5BXf5S+gKLH77+kuaC19Ctvhctfu4EQ=,tag:b55Bx+dRwQPx10zdizUMeg==,type:str]
|
||||||
|
unencrypted_suffix: _unencrypted
|
||||||
|
version: 3.12.1
|
||||||
@@ -1,26 +1,44 @@
|
|||||||
janus:
|
janus:
|
||||||
admin_password: ENC[AES256_GCM,data:4pnSq0f1iTNFWn/Qcw+J7LWIXXd/j5v3WwFSzXfqgKA=,iv:/usSHYST8zv7AMvDNuW/fFLL+40IrderjL6bUWzBNd4=,tag:V/q1+SjIcYsZ0+PC/Q7c1A==,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
|
||||||
enc: |
|
enc: |
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB0V1JsVDhnMHpaNHRQRCtw
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA5QThHOFdVQ0F6ZDE3QXdL
|
||||||
V3JMQm1SREZSYUpaYmZNQ1FEVmN0VFZRSlQ0Ck9wQlpqZFBrRUJENWVBbTd5cVVo
|
QVF0WW5yRkNtNXIyRm1LeEhwY2dRRWo0WENZCmZoWmlXZDh4ZGlUR2JYOUxuaVAx
|
||||||
ZlhYZnhGamk1ZlQ0N001ZWcrQ1Evb3cKLS0tIHpuTWhRTU1QeWFRUytiU21CMW94
|
WjhXVHBMNWdrdkgvTENJR2RpWldkNTAKLS0tIEF1bS9JSnFTbytBa1U5RjVzWkd3
|
||||||
eFc0ankvcWhqK3Q4MjRCVC9nTlJteU0K1tJvYM2M1XmlsCTpadHyf6EGE2Lg+XBL
|
S0pKVVI2RFN5a1BMYXBEY3VOUUM5QTAKNarYZm9DKRQhosSJBn9yryFxDkmFTV/o
|
||||||
TGTjMPSWqClWYB9HFZ4nCurEK/JidBanmGkc0Y9eFz9XYKl7rtyXUw==
|
i8b/tZ1ZybjEXX+X1EsgylM5u8iKkbEyUzqKO0E0gpg4qXSsJaMMYQ==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
- recipient: age1h0prahyukq4l564yqwgcpg3g6gdrjflk0suklussjjrjstxd9uesws8633
|
- recipient: age1h0prahyukq4l564yqwgcpg3g6gdrjflk0suklussjjrjstxd9uesws8633
|
||||||
enc: |
|
enc: |
|
||||||
-----BEGIN AGE ENCRYPTED FILE-----
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBNRzFlWTNxSGpaNU85QTFj
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBhdEN2M1lkMFoyQzg3bCsz
|
||||||
SnlRZkpZQTZQVjNqWFhLMHhKVm5ZVXB4Rms0CmZQclFzYkpWLzlqT2xNUTJMd2dJ
|
cVB0NUlkV1JPRjQ1TW5RSVFHUjdNMERoRXlzCk9tc25iMG00TkZjWjk2S2cyVE1J
|
||||||
Wm5PQXNabjRwV1hVRXFGVmxteGk2emMKLS0tIG5kcm5KamxNZmpKVGt5bUo1dVg5
|
cUFITDh2SkZGN0lpeWJVcWM3V3JrTTQKLS0tIENOWVBzTFYrdHRsMERwV0RKS01j
|
||||||
dFN2RGdqM29mM3hadXpBakY4QThxZnMKI9RbfXJHIHvYHy/2corfwDq+OHRPrmkA
|
QVI5TVl4L0dwOWpoQ1I2THZ6cWovWGMKIo1x1ZbdTyr/dNlPhvuomfk2MoPLsHyU
|
||||||
tWLH/KWqwGt0hvc5j8bUfRECgjdXmbC9kpAgDs8PhJF+X1ijVFrIYg==
|
N3CP3Scu3aZ7vqVua7uwtv4xQqyQI/yOnFjwxrVYPJ+N5Y/b4wsC6A==
|
||||||
-----END AGE ENCRYPTED FILE-----
|
-----END AGE ENCRYPTED FILE-----
|
||||||
lastmodified: "2026-03-23T22:27:45Z"
|
- recipient: age1gvplss0ddmyf6vpjy363wu3n057vhm0j6n7tc94cxd8kadapypws5mtaj0
|
||||||
mac: ENC[AES256_GCM,data:tQ8EMXWqw7wd/QZqUPn/sAczk0G4jSUR96AF83cmJGYuoZkMkOzsMFt448IkWxNWOJHPmIc0vs+c3ngQxHyx6Uf9jVWzMkvfdzMYj82QuLsmXQ9e4/IAE9h+52uagbwgoOJwPCF+AQetSHez/jWPPIQPN5DLfz0edg4xYReX7DA=,iv:GsvotFkehIz5L4I9j0oQ89oM5XjZQAr6vrVd79tqFes=,tag:wLi4sXz8JqvaoUaYjEj/vA==,type:str]
|
enc: |
|
||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBGSGQvL2ZYM2dtV1JWaDR1
|
||||||
|
RjJnN0YwWFM4d1IwTElqUnZQQkVDTmdydUJjCjdCUWxCVDNXUHVLd2ZHcDA5L0Mw
|
||||||
|
cEVxVE84L2xmQnRoYmsxVEdMSEZjdGcKLS0tIHViRVJyTWt4Q3JrMWtYaS9QdHlS
|
||||||
|
Yjd0MUcxcExvWVpCOUR3MkdZdGQyWUkKnru0Y2A98+0Mps7EtVK7ct3vPqIGveUt
|
||||||
|
E5fzpcKvdefzObrx7BPTwJ19t2fZg/dSi7HKwx3vmKZSzyQaqJOzsg==
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
||||||
|
lastmodified: "2026-04-04T23:18:43Z"
|
||||||
|
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
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }:
|
{ withSystem, self, inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
username = "john";
|
username = "john";
|
||||||
hostname = "soteria";
|
hostname = "soteria";
|
||||||
@@ -7,109 +7,114 @@ in
|
|||||||
flake.nixosConfigurations."${hostname}" = inputs.nixpkgs.lib.nixosSystem {
|
flake.nixosConfigurations."${hostname}" = inputs.nixpkgs.lib.nixosSystem {
|
||||||
modules = with inputs.self.modules; [
|
modules = with inputs.self.modules; [
|
||||||
nixos.lxc
|
nixos.lxc
|
||||||
|
nixos."${username}"
|
||||||
nixos.mysops
|
nixos.mysops
|
||||||
nixos.step-ssh-host
|
nixos.step-ssh-host
|
||||||
inputs.home-manager.nixosModules.home-manager
|
|
||||||
nixos."${username}"
|
|
||||||
nixos.zsh
|
|
||||||
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
|
||||||
{
|
({ config, pkgs, ... }: {
|
||||||
networking.hostName = hostname;
|
networking.hostName = hostname;
|
||||||
nix.settings.build-dir = "/var/tmp/nix-build";
|
time.timeZone = "America/Chicago";
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d /var/tmp/nix-build 1777 root root -"
|
# Removes password for sudo
|
||||||
|
security.sudo-rs.extraRules = lib.mkAfter [
|
||||||
|
{
|
||||||
|
users = [ username ];
|
||||||
|
commands = [
|
||||||
|
{
|
||||||
|
command = "ALL";
|
||||||
|
options = [ "NOPASSWD" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
];
|
];
|
||||||
step-ssh-host = {
|
|
||||||
hostname = hostname;
|
|
||||||
caURL = caURL;
|
|
||||||
};
|
|
||||||
sops.defaultSopsFile = ./secrets.yaml;
|
|
||||||
sops.secrets."janus/admin_password" = {
|
|
||||||
owner = "${hostname}";
|
|
||||||
};
|
|
||||||
# mtls = {
|
|
||||||
# enable = true;
|
|
||||||
# subject = hostname;
|
|
||||||
# caURL = caURL;
|
|
||||||
# san = [
|
|
||||||
# "${hostname}.john-stream.com"
|
|
||||||
# # "192.168.1.244"
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
|
|
||||||
# restic.envoy = {
|
users.users."${username}".extraGroups = [ "mtls" ];
|
||||||
# enable = true;
|
mtls = {
|
||||||
# port = 10000;
|
enable = true;
|
||||||
# spiffePrefix = "spiffe://john-stream.com";
|
certDir = config.janus-ca.certDir;
|
||||||
# upstreamHost = "127.0.0.1";
|
subject = hostname;
|
||||||
# upstreamPort = 8000;
|
san = [
|
||||||
# logLevel = "debug";
|
"${hostname}.john-stream.com"
|
||||||
# policies = {
|
# "192.168.1.142"
|
||||||
# ubuntu-policy = {
|
"forgejo.john-stream.com"
|
||||||
# pathPrefix = "/john-ubuntu";
|
"192.168.1.244"
|
||||||
# principal = "spiffe://john-stream.com/ubuntu";
|
];
|
||||||
# };
|
lifetime = "12h";
|
||||||
# p14-policy = {
|
renew.onCalendar = "*:3/15";
|
||||||
# pathPrefix = "/john-p14s";
|
renew.reloadUnits = [ "forgejo.service" "restic-rest-server.service" ];
|
||||||
# principal = "spiffe://john-stream.com/john-p14s";
|
certReaders = [ config.services.forgejo.user "restic" ];
|
||||||
# };
|
};
|
||||||
# gitea-policy = {
|
forgejo = {
|
||||||
# pathPrefix = "/gitea";
|
enable = true;
|
||||||
# principal = "spiffe://john-stream.com/gitea";
|
root_url = "https://forgejo.john-stream.com";
|
||||||
# };
|
https = true;
|
||||||
# };
|
port = 443;
|
||||||
# };
|
};
|
||||||
|
|
||||||
home-manager.users."${username}" = {
|
networking.firewall.allowedTCPPorts = [ 8000 ];
|
||||||
imports = with inputs.self.modules; [
|
services.restic.server = {
|
||||||
homeManager"${hostname}"
|
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
|
||||||
|
sops.defaultSopsFile = ./secrets.yaml;
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
home-manager.users."${username}".imports = [ inputs.self.modules.homeManager.soteria ];
|
||||||
|
|
||||||
|
environment.systemPackages = [
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-neovim
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh
|
||||||
|
];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.homeManager."${hostname}" = { config, ... }: {
|
flake.modules.homeManager.soteria = { config, pkgs, lib, ... }: {
|
||||||
imports = with inputs.self.modules; [
|
imports = [
|
||||||
homeManager.rebuild
|
inputs.self.modules.homeManager.rebuild
|
||||||
homeManager.mysops
|
inputs.self.modules.homeManager.mysops
|
||||||
homeManager.mtls
|
({ config, pkgs, lib, ... }: {
|
||||||
|
homeManagerFlakeDir = "${config.xdg.configHome}/home-manager";
|
||||||
|
docker.enable = true;
|
||||||
|
|
||||||
|
# This will provide the edit-secrets script targeting this file
|
||||||
|
mysops.hostSecretFile = "${config.homeManagerFlakeDir}/modules/hosts/soteria/secrets.yaml";
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
};
|
||||||
|
|
||||||
homeManagerFlakeDir = "${config.xdg.configHome}/home-manager";
|
flake.homeConfigurations.soteria = withSystem "x86_64-linux" (ctx@{ config, inputs', ...}:
|
||||||
home.username = "${username}";
|
inputs.home-manager.lib.homeManagerConfiguration {
|
||||||
home.homeDirectory = "/home/${username}";
|
pkgs = inputs'.nixpkgs.legacyPackages;
|
||||||
shell.program = "zsh";
|
modules = [
|
||||||
|
inputs.self.modules.homeManager."${username}"
|
||||||
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
inputs.self.modules.homeManager.soteria
|
||||||
"ca-url" = "https://janus.john-stream.com/";
|
|
||||||
fingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
|
||||||
root = "${config.home.homeDirectory}/.step/certs/root_ca.crt";
|
|
||||||
};
|
|
||||||
|
|
||||||
mysops.hostSecretFile = "${config.xdg.configHome}/home-manager/modules/hosts/soteria/secrets.yaml";
|
|
||||||
mtls = {
|
|
||||||
enable = true;
|
|
||||||
subject = hostname;
|
|
||||||
caURL = "https://janus.john-stream.com/";
|
|
||||||
san = [
|
|
||||||
"${hostname}.john-stream.com"
|
|
||||||
"192.168.1.142"
|
|
||||||
];
|
];
|
||||||
postCommands = [
|
});
|
||||||
"docker restart envoy"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
flake.homeConfigurations."${hostname}" = inputs.home-manager.lib.homeManagerConfiguration {
|
|
||||||
pkgs = import inputs.nixpkgs { system = "x86_64-linux"; };
|
|
||||||
modules = with inputs.self.modules; [
|
|
||||||
homeManager."${username}"
|
|
||||||
homeManager."${hostname}"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
@@ -11,12 +11,11 @@ in
|
|||||||
nixos.step-ssh-host
|
nixos.step-ssh-host
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
nixos."${username}"
|
nixos."${username}"
|
||||||
nixos.zsh
|
|
||||||
nixos.docker
|
nixos.docker
|
||||||
{
|
{
|
||||||
home-manager.users."${username}" = {
|
home-manager.users."${username}" = {
|
||||||
imports = with inputs.self.modules.homeManager; [
|
imports = with inputs.self.modules.homeManager; [
|
||||||
sops
|
mysops
|
||||||
];
|
];
|
||||||
shell.program = "zsh";
|
shell.program = "zsh";
|
||||||
docker.enable = true;
|
docker.enable = true;
|
||||||
|
|||||||
+132
-29
@@ -1,45 +1,148 @@
|
|||||||
{ inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
{
|
{
|
||||||
flake.modules.homeManager.rebuild =
|
flake.modules.nixos.rebuild =
|
||||||
{ pkgs, lib, config, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
flakeDir = config.rebuild.flakeDir;
|
||||||
|
echoCmd = lib.getExe' pkgs.coreutils "echo";
|
||||||
|
hostnameCmd = "$(${lib.getExe pkgs.hostname} -s)";
|
||||||
|
|
||||||
|
nfs = with pkgs; writeShellApplication {
|
||||||
|
name = "nfs";
|
||||||
|
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
|
||||||
{
|
{
|
||||||
options = {
|
options.rebuild = {
|
||||||
homeManagerFlakeDir = lib.mkOption {
|
flakeDir = lib.mkOption {
|
||||||
|
description = "Path to the flake directory.";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "${config.xdg.configHome}/home-manager";
|
default = "/etc/nixos";
|
||||||
description = "Path to the home-manager flake directory.";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let
|
config = {
|
||||||
nixBin = lib.getExe pkgs.nix;
|
environment.systemPackages = with pkgs; [ nfs nfsu ];
|
||||||
flakeDir = config.homeManagerFlakeDir;
|
};
|
||||||
in
|
};
|
||||||
{
|
|
||||||
|
flake.modules.homeManager.rebuild =
|
||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
flakeDir = config.homeManagerFlakeDir;
|
||||||
|
|
||||||
|
flake-parts-check = with pkgs; writeShellApplication {
|
||||||
|
name = "flake-parts-check";
|
||||||
|
runtimeInputs = [ nix ];
|
||||||
|
text = ''
|
||||||
|
cd ${flakeDir}
|
||||||
|
nix run "${flakeDir}#write-flake"
|
||||||
|
nix flake check
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
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"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
homeManagerFlakeDir = lib.mkOption {
|
||||||
|
description = "Path to the home-manager flake directory.";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.xdg.configHome}/home-manager";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
home.activation.printFlakeDir = lib.hm.dag.entryAfter ["writeBoundary"] ''
|
||||||
run echo "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-test" ''
|
(symlinkJoin {
|
||||||
echo "Test ${flakeDir}"
|
name = "build-tools";
|
||||||
'')
|
paths = [
|
||||||
(writeShellScriptBin "flake-parts-check" ''
|
flake-parts-check
|
||||||
cd ${flakeDir}
|
test-build
|
||||||
${nixBin} run ".#write-flake"
|
(inputs.self.wrappers.home-switch.apply {
|
||||||
${nixBin} flake check
|
inherit pkgs flakeDir;
|
||||||
'')
|
}).wrapper
|
||||||
(writeShellScriptBin "nhms" ''
|
(inputs.self.wrappers.home-switch.apply {
|
||||||
HOSTNAME=$(hostname -s)
|
binName = lib.mkForce "nhmu";
|
||||||
echo "Switching to the $HOSTNAME profile"
|
inherit pkgs flakeDir;
|
||||||
${lib.getExe home-manager} switch --impure --flake ${flakeDir}#$HOSTNAME
|
extraOptions = [ "--update" ];
|
||||||
'')
|
}).wrapper
|
||||||
(writeShellScriptBin "nhmu" ''
|
(inputs.wrappers.lib.wrapPackage {
|
||||||
${nixBin} flake update --flake ${flakeDir}
|
binName = "cleanup";
|
||||||
nhms
|
inherit pkgs;
|
||||||
'')
|
package = nh;
|
||||||
|
args = [ "clean" "user" "--keep-since" "3days" ];
|
||||||
|
})
|
||||||
|
];
|
||||||
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
flake.wrappers.home-switch = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
flakeDir = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
};
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "$(whoami)";
|
||||||
|
};
|
||||||
|
hostname = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "$(hostname -s)";
|
||||||
|
};
|
||||||
|
configuration = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "${config.user}@${config.hostname}";
|
||||||
|
};
|
||||||
|
extraOptions = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "nhms";
|
||||||
|
extraPackages = with config.pkgs; [ coreutils hostname nh ];
|
||||||
|
preHook = ''
|
||||||
|
CONFIG=${config.configuration}
|
||||||
|
echo "Switching to $CONFIG"
|
||||||
|
'';
|
||||||
|
package = config.pkgs.nh;
|
||||||
|
args = [
|
||||||
|
"home" "switch"
|
||||||
|
"--configuration" "${config.configuration}"
|
||||||
|
"$@"
|
||||||
|
"${config.flakeDir}"
|
||||||
|
] ++ config.extraOptions;
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+34
-23
@@ -1,39 +1,50 @@
|
|||||||
# Lifted from:
|
# Lifted from:
|
||||||
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/blob/69edacdb5a4a6ca71d649bb8eb62cf8c630c8627/modules/users/bob%20%5BNDn%5D/bob.nix#L8
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/blob/69edacdb5a4a6ca71d649bb8eb62cf8c630c8627/modules/users/bob%20%5BNDn%5D/bob.nix#L8
|
||||||
{ self, ... }:
|
{ self, inputs, ... }:
|
||||||
{
|
{
|
||||||
config.flake.factory.user = username: isAdmin: {
|
config.flake.factory.user = {
|
||||||
nixos."${username}" = { lib, pkgs, ... }: {
|
username,
|
||||||
|
isAdmin ? false,
|
||||||
|
noPassword ? false,
|
||||||
|
# homeImports ? [ ],
|
||||||
|
# homePackages ? [ ],
|
||||||
|
}: {
|
||||||
|
nixos."${username}" = { config, lib, pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
inputs.home-manager.nixosModules.home-manager
|
||||||
|
];
|
||||||
|
|
||||||
|
environment.shells = [
|
||||||
|
"${lib.getExe pkgs.zsh}"
|
||||||
|
"${lib.getExe inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh}"
|
||||||
|
];
|
||||||
|
|
||||||
|
users.groups."${username}" = {};
|
||||||
|
|
||||||
users.users."${username}" = {
|
users.users."${username}" = {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
|
group = username;
|
||||||
home = "/home/${username}";
|
home = "/home/${username}";
|
||||||
extraGroups = [
|
shell = pkgs.zsh;
|
||||||
"input"
|
extraGroups = [ "input" "networkmanager" ]
|
||||||
"networkmanager"
|
++ lib.optional isAdmin "wheel"
|
||||||
] ++ lib.optionals isAdmin [
|
++ lib.optional config.virtualisation.docker.enable "docker"
|
||||||
"docker"
|
++ lib.optional (isAdmin && config.services.forgejo.enable) config.services.forgejo.group
|
||||||
"wheel"
|
++ lib.optional (isAdmin && config.services.postgresql.enable) "postgres";
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Removes password for sudo
|
programs.zsh.enable = true;
|
||||||
security.sudo-rs = lib.mkIf isAdmin {
|
|
||||||
enable = true;
|
|
||||||
extraRules = [{
|
|
||||||
users = [ "${username}" ];
|
|
||||||
commands = [{
|
|
||||||
command = "ALL";
|
|
||||||
options = [ "NOPASSWD" ];
|
|
||||||
}];
|
|
||||||
}];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
security.sudo-rs.enable = lib.mkIf isAdmin true;
|
||||||
|
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/wiki/Dendritic_Aspects#multi-context-aspect
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/wiki/Dendritic_Aspects#multi-context-aspect
|
||||||
home-manager.users."${username}" = {
|
home-manager.users."${username}" = {
|
||||||
|
imports = [ self.modules.homeManager."${username}" ];
|
||||||
home.username = "${username}";
|
home.username = "${username}";
|
||||||
home.homeDirectory = "/home/${username}";
|
home.homeDirectory = "/home/${username}";
|
||||||
imports = [
|
home.packages = with pkgs; [
|
||||||
self.modules.homeManager."${username}"
|
# fzf zoxide starship
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
config.flake-file.inputs = {
|
||||||
|
wrapper-modules = {
|
||||||
|
url = "github:BirdeeHub/nix-wrapper-modules";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
wrappers = {
|
||||||
|
url = "github:lassulus/wrappers";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
options = {
|
||||||
|
# This is what allows wrappers to be defined in flake.wrappers.<wrapper-name> throughout different flake-parts modules
|
||||||
|
flake = inputs.flake-parts.lib.mkSubmoduleOptions {
|
||||||
|
wrappers = inputs.nixpkgs.lib.mkOption {
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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 = "/";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
{
|
{
|
||||||
flake.modules.homeManager.bash = { pkgs, lib, config, ... }:
|
flake.modules.homeManager.bash = { pkgs, lib, config, ... }:
|
||||||
{
|
{
|
||||||
programs.bash = lib.mkIf (config.shell.program == "bash") {
|
programs.bash = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
package = pkgs.bash;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.homeManager.brave = {
|
||||||
|
programs.brave = {
|
||||||
|
enable = true;
|
||||||
|
extensions = [
|
||||||
|
# https://chromewebstore.google.com/detail/1password-%E2%80%93-password-mana/aeblfdkhhhdcdjpifhhbdiojplfjncoa
|
||||||
|
"aeblfdkhhhdcdjpifhhbdiojplfjncoa"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
# This module is for programs with GUIs that run in a desktop environment
|
|
||||||
{ inputs, ... }:
|
|
||||||
{
|
|
||||||
flake.modules.homeManager.desktop =
|
|
||||||
{
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
|
||||||
onepassword
|
|
||||||
ghostty
|
|
||||||
sublime
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,14 +1,32 @@
|
|||||||
{ 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;
|
||||||
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-eza;
|
||||||
};
|
};
|
||||||
home.shellAliases = {
|
};
|
||||||
ls = "${lib.getExe pkgs.eza} -lgos type --no-time --follow-symlinks";
|
|
||||||
|
perSystem = { system, pkgs, ... }: {
|
||||||
|
packages.my-eza = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
package = pkgs.eza;
|
||||||
|
args = [
|
||||||
|
"--all"
|
||||||
|
"--long"
|
||||||
|
"--group-directories-first"
|
||||||
|
"--icons=auto"
|
||||||
|
"--color=auto"
|
||||||
|
"--sort=type"
|
||||||
|
"--dereference"
|
||||||
|
"--octal-permissions"
|
||||||
|
"--smart-group"
|
||||||
|
"--no-time"
|
||||||
|
"--git"
|
||||||
|
"$@"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+13
-10
@@ -1,15 +1,18 @@
|
|||||||
{
|
{
|
||||||
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; [
|
|
||||||
gdu
|
|
||||||
lf
|
|
||||||
# TODO: find a CLI file editor that's not insane
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
@@ -58,11 +70,15 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# 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
|
||||||
|
ghosttyCmd = lib.getExe ghosttyPackage;
|
||||||
|
in
|
||||||
|
{
|
||||||
name = "Ghostty";
|
name = "Ghostty";
|
||||||
type = "Application";
|
type = "Application";
|
||||||
comment = "A terminal emulator";
|
comment = "A terminal emulator";
|
||||||
exec = "nixGLMesa ghostty";
|
exec = ghosttyCmd;
|
||||||
icon = "com.mitchellh.ghostty";
|
icon = "com.mitchellh.ghostty";
|
||||||
terminal = false;
|
terminal = false;
|
||||||
startupNotify = true;
|
startupNotify = true;
|
||||||
@@ -79,7 +95,7 @@
|
|||||||
actions = {
|
actions = {
|
||||||
new-window = {
|
new-window = {
|
||||||
name = "New Window";
|
name = "New Window";
|
||||||
exec = "nixGLMesa ghostty";
|
exec = ghosttyCmd;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
{
|
{ self, inputs, ... }: {
|
||||||
flake.modules.homeManager.git = { config, lib, ... }:
|
flake.modules.homeManager.git = { config, pkgs, lib, ... }: {
|
||||||
{
|
home.packages = with pkgs; [
|
||||||
|
git-credential-oauth
|
||||||
|
];
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
@@ -14,5 +16,8 @@
|
|||||||
enableBashIntegration = true;
|
enableBashIntegration = true;
|
||||||
enableZshIntegration = true;
|
enableZshIntegration = true;
|
||||||
};
|
};
|
||||||
|
home.shellAliases = {
|
||||||
|
"lzg" = "lazygit";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,158 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake-file.inputs = {
|
||||||
|
nvf = {
|
||||||
|
url = "github:notashelf/nvf";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { system, pkgs, config, ... }: {
|
||||||
|
packages.my-neovim = ((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;
|
||||||
|
|
||||||
|
# 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
|
||||||
|
treesitter = {
|
||||||
|
enable = true;
|
||||||
|
grammars = with pkgs.vimPlugins.nvim-treesitter-parsers; [ python ];
|
||||||
|
};
|
||||||
|
|
||||||
|
lsp.enable = true;
|
||||||
|
|
||||||
|
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: {
|
||||||
|
pname = "my-neovim";
|
||||||
|
version = "custom";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.niri = { pkgs, lib, ... }: {
|
||||||
|
programs.niri = {
|
||||||
|
enable = true;
|
||||||
|
package = self.packages.${pkgs.stdenv.hostPlatform.system}.myNiri;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { pkgs, lib, self', ... }: {
|
||||||
|
packages.myNiri = inputs.wrapper-modules.wrappers.niri.wrap {
|
||||||
|
inherit pkgs;
|
||||||
|
env.RUST_BACKTRACE = "full";
|
||||||
|
settings = {
|
||||||
|
spawn-at-startup = [
|
||||||
|
"${lib.getExe self'.packages.myNoctalia}"
|
||||||
|
];
|
||||||
|
xwayland-satellite.path = lib.getExe pkgs.xwayland-satellite;
|
||||||
|
input.keyboard.xkb.layout = "us,ua";
|
||||||
|
layout.gaps = 5;
|
||||||
|
binds = {
|
||||||
|
"Mod+Return".spawn-sh = lib.getExe pkgs.ghostty;
|
||||||
|
"Mod+Q".close-window = null;
|
||||||
|
"Mod+S".spawn-sh = "${lib.getExe self'.packages.myNoctalia} ipc call launcher toggle";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
perSystem = { pkgs, ... }: {
|
||||||
|
packages.myNoctalia = inputs.wrapper-modules.wrappers.noctalia-shell.wrap {
|
||||||
|
inherit pkgs;
|
||||||
|
# settings = (builtins.fromJSON (builtins.readFile ./noctalia.json)).settings;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{ self, inputs, ... }: {
|
||||||
flake.modules.homeManager.onepassword = {
|
flake.modules.homeManager.onepassword = { config, ... }: {
|
||||||
# TODO: Port `_1password = true` behavior into an explicit Home Manager module.
|
home.file.".config/1Password/ssh/agent.toml".text = ''
|
||||||
|
# https://developer.1password.com/docs/ssh/agent/config
|
||||||
|
[[ssh-keys]]
|
||||||
|
vault = "Private"
|
||||||
|
'';
|
||||||
|
programs.ssh.matchBlocks."*".identityAgent = "${config.home.homeDirectory}/.1password/agent.sock";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
# This module provides all the shell options
|
|
||||||
{ inputs, lib, ... }:
|
|
||||||
{
|
|
||||||
flake.modules.homeManager.shell-tools = { config, pkgs, ... }: {
|
|
||||||
options.shell.program = lib.mkOption {
|
|
||||||
type = lib.types.enum [ "bash" "zsh" ];
|
|
||||||
default = "zsh";
|
|
||||||
description = "Which interactive shell configuration to enable.";
|
|
||||||
};
|
|
||||||
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
|
||||||
bash
|
|
||||||
zsh
|
|
||||||
|
|
||||||
# Tools
|
|
||||||
eza
|
|
||||||
files
|
|
||||||
];
|
|
||||||
|
|
||||||
config = {
|
|
||||||
home.shell.enableShellIntegration = true;
|
|
||||||
programs.zsh.enable = lib.mkForce (config.shell.program == "zsh");
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
wget
|
|
||||||
curl
|
|
||||||
cacert
|
|
||||||
busybox
|
|
||||||
gnugrep
|
|
||||||
dig
|
|
||||||
btop
|
|
||||||
uv
|
|
||||||
xclip
|
|
||||||
jq
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
+74
-66
@@ -1,4 +1,4 @@
|
|||||||
{ inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
let
|
let
|
||||||
inputs' = inputs; # save a reference before it's shadowed
|
inputs' = inputs; # save a reference before it's shadowed
|
||||||
in
|
in
|
||||||
@@ -12,78 +12,86 @@ in
|
|||||||
|
|
||||||
flake.modules.nixos.mysops = {
|
flake.modules.nixos.mysops = {
|
||||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
# sops.defaultSopsFile = ../../keys/secrets.yaml;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Define the homeModules that are used by flake-parts
|
flake.modules.homeManager.mysops =
|
||||||
# https://flake.parts/options/home-manager.html#opt-flake.modules.homeManager
|
{ config, pkgs, lib, ... }:
|
||||||
flake.modules.homeManager.mysops = { inputs, config, pkgs, lib, ... }:
|
let
|
||||||
let
|
cfg = config.mysops;
|
||||||
cfg = config.mysops;
|
in
|
||||||
sopsBin = lib.getExe pkgs.sops;
|
{
|
||||||
sopsConfigPath = ../../.sops.yaml;
|
imports = [
|
||||||
sopsSecretsPath = ../../keys/secrets.yaml;
|
# This import makes the sops config attribute available below
|
||||||
in
|
inputs'.sops-nix.homeManagerModules.sops
|
||||||
{
|
];
|
||||||
imports = [
|
|
||||||
# This import makes the sops config attribute available below
|
|
||||||
inputs'.sops-nix.homeManagerModules.sops
|
|
||||||
];
|
|
||||||
|
|
||||||
options.mysops = {
|
options.mysops = {
|
||||||
enable = lib.mkEnableOption "Customized SOPS tools";
|
hostSecretFile = lib.mkOption {
|
||||||
ageKeyFile = lib.mkOption {
|
description = "Path to the secrets file for this host. Used to create the edit-secrets script";
|
||||||
description = "Default location for the age key";
|
type = lib.types.nullOr lib.types.str;
|
||||||
type = lib.types.str;
|
default = null;
|
||||||
default = "${config.xdg.configHome}/sops/age/keys.txt";
|
};
|
||||||
};
|
};
|
||||||
hostSecretFile = lib.mkOption {
|
|
||||||
description = "Path to the secrets file for this host";
|
config =
|
||||||
type = lib.types.nullOr lib.types.str;
|
let
|
||||||
default = null;
|
my-sops = (inputs.self.wrappers.mySops.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
sshKey = config.ssh.identityFile;
|
||||||
|
}).wrapper;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
# Option definitions for the sops home-manager module:
|
||||||
|
# https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
|
||||||
|
sops = {
|
||||||
|
defaultSopsFile = ../../keys/secrets.yaml;
|
||||||
|
defaultSopsFormat = "yaml";
|
||||||
|
age.sshKeyPaths = [ "${config.ssh.identityFile}" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
my-sops
|
||||||
|
(inputs.wrappers.lib.wrapPackage {
|
||||||
|
binName = "ls-secrets";
|
||||||
|
inherit pkgs;
|
||||||
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.my-eza;
|
||||||
|
args = [
|
||||||
|
"-T" "--follow-symlinks"
|
||||||
|
"${config.xdg.configHome}/sops-nix/secrets"
|
||||||
|
];
|
||||||
|
})
|
||||||
|
|
||||||
|
]
|
||||||
|
++ lib.optional (cfg.hostSecretFile != null) (inputs.wrappers.lib.wrapPackage {
|
||||||
|
binName = "edit-secrets";
|
||||||
|
inherit pkgs;
|
||||||
|
package = my-sops;
|
||||||
|
args = [ cfg.hostSecretFile ];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.wrappers.mySops = inputs.wrappers.lib.wrapModule ({config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
sshKey = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "String path to the SSH key to use for creating an AGE key at runtime";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
home.packages = with pkgs; [
|
# binName = "my-sops";
|
||||||
eza
|
package = config.pkgs.sops;
|
||||||
age
|
extraPackages = with config.pkgs; [ coreutils ssh-to-age ];
|
||||||
sops # This is necessary to make the sops binary available
|
preHook = ''
|
||||||
ssh-to-age
|
AGE_KEY=$(umask 077; mktemp)
|
||||||
(writeShellScriptBin "gen-age-key" ''
|
ssh-to-age -private-key -i ${config.sshKey} > "$AGE_KEY"
|
||||||
set -eu
|
'';
|
||||||
|
flags."--config" = "${../../.sops.yaml}";
|
||||||
if [ ! -f "${config.ssh.IdentityFile}" ]; then
|
postHook = ''
|
||||||
echo "SSH identity file not found: ${config.ssh.IdentityFile}" >&2
|
rm "$AGE_KEY"
|
||||||
exit 1
|
echo "Removed $AGE_KEY"
|
||||||
fi
|
'';
|
||||||
|
|
||||||
if [ -e "${cfg.ageKeyFile}" ]; then
|
|
||||||
echo "Refusing to overwrite existing age key file: ${cfg.ageKeyFile}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$(dirname "${cfg.ageKeyFile}")"
|
|
||||||
${lib.getExe pkgs.ssh-to-age} -i ${config.ssh.IdentityFile} -private-key > ${cfg.ageKeyFile}
|
|
||||||
echo -n "Created ${cfg.ageKeyFile}: "
|
|
||||||
echo $(show-age-key)
|
|
||||||
'')
|
|
||||||
(writeShellScriptBin "show-age-key" "${lib.getExe' pkgs.age "age-keygen"} -y ${cfg.ageKeyFile}")
|
|
||||||
(writeShellScriptBin "ls-secrets" "${lib.getExe pkgs.eza} -alT --follow-symlinks ~/.config/sops-nix/secrets")
|
|
||||||
] ++ lib.optional (cfg.hostSecretFile != null) (writeShellScriptBin "edit-secrets" ''
|
|
||||||
set -e
|
|
||||||
${sopsBin} --config ${sopsConfigPath} ${cfg.hostSecretFile}
|
|
||||||
'');
|
|
||||||
|
|
||||||
home.shellAliases.sops = "${sopsBin} --config ${sopsConfigPath}";
|
|
||||||
|
|
||||||
# Option definitions for the sops home-manager module:
|
|
||||||
# https://github.com/Mic92/sops-nix/blob/master/modules/home-manager/sops.nix
|
|
||||||
sops = {
|
|
||||||
# defaultSopsFile = sopsSecretsPath;
|
|
||||||
defaultSopsFormat = "yaml";
|
|
||||||
age.sshKeyPaths = [ "${config.ssh.IdentityFile}" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
perSystem = { system, pkgs, lib, ... }: {
|
||||||
|
packages.starship = (inputs.wrappers.wrapperModules.starship.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
settings = lib.recursiveUpdate (lib.importTOML (pkgs.fetchurl {
|
||||||
|
url = https://starship.rs/presets/toml/catppuccin-powerline.toml;
|
||||||
|
sha256 = "1jzbbzm3nwdlldq43aj3csp0ps23fsa6x2225z85l0s9qbj4cdy2";
|
||||||
|
})) {
|
||||||
|
palette = "catppuccin_mocha";
|
||||||
|
add_newline = true;
|
||||||
|
line_break.disabled = false;
|
||||||
|
git_status.diverged = "⇕⇡\${ahead_count}⇣\${behind_count}";
|
||||||
|
cmd_duration.format = " $duration";
|
||||||
|
cmd_duration.show_notifications = false;
|
||||||
|
hostname = {
|
||||||
|
disabled = false;
|
||||||
|
ssh_symbol = "🌐";
|
||||||
|
format = "[$ssh_symbol$hostname]($style)";
|
||||||
|
style = "bg:red fg:crust";
|
||||||
|
};
|
||||||
|
os.symbols.NixOS = " ";
|
||||||
|
format = lib.replaceStrings ["\n"] [""] ''
|
||||||
|
[](red)
|
||||||
|
$os
|
||||||
|
$username
|
||||||
|
$hostname
|
||||||
|
[](bg:peach fg:red)
|
||||||
|
$directory
|
||||||
|
[](bg:yellow fg:peach)
|
||||||
|
$git_branch
|
||||||
|
$git_status
|
||||||
|
[](fg:yellow bg:green)
|
||||||
|
$c
|
||||||
|
$rust
|
||||||
|
$golang
|
||||||
|
$nodejs
|
||||||
|
$php
|
||||||
|
$java
|
||||||
|
$kotlin
|
||||||
|
$haskell
|
||||||
|
$python
|
||||||
|
[](fg:green bg:sapphire)
|
||||||
|
$conda
|
||||||
|
[](fg:sapphire bg:lavender)
|
||||||
|
$time
|
||||||
|
[ ](fg:lavender)
|
||||||
|
$cmd_duration
|
||||||
|
$line_break
|
||||||
|
$character
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}).wrapper;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.steam = {
|
||||||
|
programs.steam = {
|
||||||
|
enable = true;
|
||||||
|
gamescopeSession.enable = true;
|
||||||
|
# Open ports in the firewall for Steam Remote Play
|
||||||
|
remotePlay.openFirewall = true;
|
||||||
|
# Open ports in the firewall for Source Dedicated Server
|
||||||
|
dedicatedServer.openFirewall = true;
|
||||||
|
# Open ports in the firewall for Steam Local Network Game Transfers
|
||||||
|
localNetworkGameTransfers.openFirewall = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
{ inputs, ... }:
|
|
||||||
let
|
|
||||||
caURL = "https://janus.john-stream.com/";
|
|
||||||
stepFingerprint = "2036c44f7b5901566ff7611ea6c927291ecc6d2dd00779c0eead70ec77fa10d6";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
#
|
|
||||||
# Home Manager Module
|
|
||||||
#
|
|
||||||
flake.modules.homeManager.step-ssh-user = { config, pkgs, lib, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.step-ssh-user;
|
|
||||||
firstPrincipal = lib.head cfg.principals;
|
|
||||||
principalArgs = lib.concatMapStringsSep " "
|
|
||||||
(principal: "--principal \"${principal}\"") cfg.principals;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.step-ssh-user = {
|
|
||||||
enable = lib.mkEnableOption "opionated step client config for SSH certs";
|
|
||||||
caURL = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "${caURL}";
|
|
||||||
};
|
|
||||||
fingerprint = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "${stepFingerprint}";
|
|
||||||
};
|
|
||||||
rootCertFile = {
|
|
||||||
path = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "String path to where the root_ca.crt file will be stored for the user";
|
|
||||||
default = ".step/certs/root_ca.crt";
|
|
||||||
};
|
|
||||||
source = lib.mkOption {
|
|
||||||
type = lib.types.path;
|
|
||||||
description = "Nix path to the root cert file within the repo";
|
|
||||||
default = ../../keys/root_ca.crt;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
provisioner = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "admin";
|
|
||||||
};
|
|
||||||
principals = lib.mkOption {
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
# default = [ ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
home.file."${cfg.rootCertFile.path}".source = cfg.rootCertFile.source;
|
|
||||||
home.file.".step/config/defaults.json".text = builtins.toJSON {
|
|
||||||
"ca-url" = cfg.caURL;
|
|
||||||
fingerprint = cfg.fingerprint;
|
|
||||||
root = "${config.home.homeDirectory}/${cfg.rootCertFile.path}";
|
|
||||||
};
|
|
||||||
sops.secrets."janus/admin_jwk".mode = "0400";
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
(writeShellScriptBin "sign-ssh-cert" ''
|
|
||||||
${lib.getExe pkgs.step-cli} ssh certificate \
|
|
||||||
--sign \
|
|
||||||
${principalArgs} \
|
|
||||||
--provisioner "${cfg.provisioner}" \
|
|
||||||
--provisioner-password-file "${config.sops.secrets."janus/admin_jwk".path}" \
|
|
||||||
"${firstPrincipal}" "${config.ssh.IdentityFile}.pub"
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
{ inputs, pkgs, ... }:
|
|
||||||
{
|
|
||||||
flake.modules.homeManager.sublime = { pkgs, lib, ... }: {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
sublime4
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.sudo = {
|
||||||
|
security.sudo-rs = {
|
||||||
|
enable = true;
|
||||||
|
execWheelOnly = false;
|
||||||
|
wheelNeedsPassword = false;
|
||||||
|
extraConfig = "Defaults timestamp_timeout=1440";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
+23
-18
@@ -1,21 +1,26 @@
|
|||||||
{
|
{ self, inputs, ... }: {
|
||||||
flake.modules.homeManager.vscode = { pkgs, ... }:
|
flake.modules.homeManager.vscode = { config, pkgs, lib, ... }: {
|
||||||
{
|
options.my-vscode = {
|
||||||
programs.vscode = {
|
enable = lib.mkEnableOption "Enable nix-managed VSCode";
|
||||||
enable = true;
|
};
|
||||||
package = pkgs.vscode;
|
|
||||||
profiles.default.extensions = with pkgs.vscode-extensions; [
|
config = lib.mkIf config.my-vscode.enable {
|
||||||
mhutchie.git-graph
|
programs.vscode = {
|
||||||
ms-vscode-remote.vscode-remote-extensionpack
|
enable = true;
|
||||||
ms-python.python
|
package = pkgs.vscode;
|
||||||
ms-python.vscode-pylance
|
profiles.default.extensions = with pkgs.vscode-extensions; [
|
||||||
ms-toolsai.jupyter
|
mhutchie.git-graph
|
||||||
charliermarsh.ruff
|
ms-vscode-remote.vscode-remote-extensionpack
|
||||||
github.vscode-pull-request-github
|
ms-python.python
|
||||||
github.vscode-github-actions
|
ms-python.vscode-pylance
|
||||||
github.copilot
|
ms-toolsai.jupyter
|
||||||
catppuccin.catppuccin-vsc
|
charliermarsh.ruff
|
||||||
];
|
github.vscode-pull-request-github
|
||||||
|
github.vscode-github-actions
|
||||||
|
github.copilot
|
||||||
|
catppuccin.catppuccin-vsc
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
{ self, inputs, ... }: {
|
||||||
|
flake.modules.nixos.wireguard = { config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
wgInterface = "platform";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
|
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
wireguard-tools # https://github.com/WireGuard/wireguard-tools
|
||||||
|
# wg-netmanager # https://github.com/gin66/wg_netmanager
|
||||||
|
];
|
||||||
|
|
||||||
|
sops.secrets.wireguard_private_key = { };
|
||||||
|
networking.wg-quick.interfaces = {
|
||||||
|
${wgInterface} = {
|
||||||
|
autostart = false; # Managed by dispatcher
|
||||||
|
postUp = "echo 'Post up command'";
|
||||||
|
address = [ "192.168.3.5/32" ];
|
||||||
|
dns = [ "192.168.1.150" ];
|
||||||
|
privateKeyFile = config.sops.secrets.wireguard_private_key.path;
|
||||||
|
peers = [
|
||||||
|
{
|
||||||
|
publicKey = "BD1/q18OfpoMCDusNZk9cqB1vvR8bgodZ1L7198jVic=";
|
||||||
|
allowedIPs = [ "192.168.0.0/16" ];
|
||||||
|
endpoint = "wg.john-stream.com:51830";
|
||||||
|
persistentKeepalive = 25;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
perSystem = { system, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
connect = pkgs.writeShellApplication {
|
||||||
|
name = "wg-platform-connect";
|
||||||
|
text = ''
|
||||||
|
sudo systemctl start wg-quick-platform.service
|
||||||
|
START_TIME=$(sudo systemctl show -p ActiveEnterTimestamp wg-quick-platform | cut -d= -f2)
|
||||||
|
journalctl -u wg-quick-platform --since "$START_TIME" --no-pager
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
disconnect = pkgs.writeShellApplication {
|
||||||
|
name = "wg-platform-disconnect";
|
||||||
|
text = ''
|
||||||
|
STOP_TIME=$(date '+%Y-%m-%d %H:%M:%S')
|
||||||
|
systemctl stop wg-quick-platform.service
|
||||||
|
journalctl -u wg-quick-platform.service --since "$STOP_TIME" --no-pager
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages.wg-platform = inputs.wrappers.lib.wrapPackage {
|
||||||
|
inherit pkgs;
|
||||||
|
runtimeInputs = with pkgs; [ coreutils systemd wireguard-tools ];
|
||||||
|
package = pkgs.symlinkJoin {
|
||||||
|
name = "wg-platform";
|
||||||
|
meta.mainProgram = "wg-platform-connect";
|
||||||
|
paths = [
|
||||||
|
connect
|
||||||
|
disconnect
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
{ self, inputs, ... }:
|
||||||
|
let
|
||||||
|
packageName = "zed-editor";
|
||||||
|
|
||||||
|
zedWrapper = inputs.wrappers.lib.wrapModule ({ config, lib, wlib, ... }: {
|
||||||
|
options = {
|
||||||
|
text-to-say = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Text for the ascii cow to say.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
binName = "my-pkg";
|
||||||
|
package = config.pkgs.cowsay;
|
||||||
|
args = [ config.text-to-say ];
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
perSystem = { system, pkgs, lib, ... }: {
|
||||||
|
packages."${packageName}" = (zedWrapper.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
text-to-say = "Hello from wrapped module!";
|
||||||
|
}).wrapper;
|
||||||
|
};
|
||||||
|
|
||||||
|
flake.modules.homeManager."${packageName}" = { config, pkgs, lib, ... }: {
|
||||||
|
home.packages = [
|
||||||
|
inputs.self.packages.${pkgs.stdenv.hostPlatform.system}."${packageName}"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,25 @@
|
|||||||
{ inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
let
|
let
|
||||||
username = "john";
|
username = "john";
|
||||||
|
historySize = 10000;
|
||||||
|
homeEndKeyBindings = ''
|
||||||
|
# Normalize common Home/End escape sequences across terminal emulators.
|
||||||
|
bindkey "^[[H" beginning-of-line
|
||||||
|
bindkey "^[[F" end-of-line
|
||||||
|
bindkey "^[[1~" beginning-of-line
|
||||||
|
bindkey "^[[4~" end-of-line
|
||||||
|
bindkey "^[[7~" beginning-of-line
|
||||||
|
bindkey "^[[8~" end-of-line
|
||||||
|
bindkey "^[OH" beginning-of-line
|
||||||
|
bindkey "^[OF" end-of-line
|
||||||
|
bindkey "^[[3~" delete-char
|
||||||
|
|
||||||
|
# Normalize common Ctrl+Arrow sequences for word-wise movement.
|
||||||
|
bindkey "^[[1;5D" backward-word
|
||||||
|
bindkey "^[[1;5C" forward-word
|
||||||
|
bindkey "^[[5D" backward-word
|
||||||
|
bindkey "^[[5C" forward-word
|
||||||
|
'';
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules = {
|
flake.modules = {
|
||||||
@@ -16,11 +35,14 @@ in
|
|||||||
homeManager.zsh = { pkgs, config, ... }: {
|
homeManager.zsh = { pkgs, config, ... }: {
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.zsh;
|
package = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.jsl-zsh;
|
||||||
enableCompletion = true;
|
enableCompletion = true;
|
||||||
autosuggestion.enable = true;
|
autosuggestion.enable = true;
|
||||||
# syntaxHighlighting.enable = true;
|
# syntaxHighlighting.enable = true;
|
||||||
initContent = "HOST=$(hostname -s)";
|
initContent = ''
|
||||||
|
HOST=$(hostname -s)
|
||||||
|
${homeEndKeyBindings}
|
||||||
|
'';
|
||||||
dotDir = "${config.xdg.configHome}/zsh";
|
dotDir = "${config.xdg.configHome}/zsh";
|
||||||
history = {
|
history = {
|
||||||
append = true;
|
append = true;
|
||||||
@@ -31,8 +53,8 @@ in
|
|||||||
"eza"
|
"eza"
|
||||||
"clear"
|
"clear"
|
||||||
];
|
];
|
||||||
save = 1000;
|
save = historySize;
|
||||||
size = 1000;
|
size = historySize;
|
||||||
share = true;
|
share = true;
|
||||||
};
|
};
|
||||||
oh-my-zsh = {
|
oh-my-zsh = {
|
||||||
@@ -50,5 +72,72 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
perSystem = { config, self', pkgs, lib, ... }: {
|
||||||
|
packages.jsl-zsh =
|
||||||
|
let
|
||||||
|
ignorePatterns = [
|
||||||
|
"ls" "eza" "history" "clear"
|
||||||
|
];
|
||||||
|
aliasStr = lib.concatStringsSep "\n" (
|
||||||
|
lib.mapAttrsToList (k: v: "alias -- ${lib.escapeShellArg k}=${lib.escapeShellArg v}") {
|
||||||
|
ls = "eza";
|
||||||
|
ll = "eza -l";
|
||||||
|
la = "eza -a";
|
||||||
|
lt = "eza --tree";
|
||||||
|
lla = "eza -la";
|
||||||
|
ds = "gdu -i /snap /";
|
||||||
|
ld = "lazydocker";
|
||||||
|
});
|
||||||
|
in
|
||||||
|
(inputs.wrappers.wrapperModules.zsh.apply {
|
||||||
|
inherit pkgs;
|
||||||
|
binName = "jsl-zsh";
|
||||||
|
env = {
|
||||||
|
LANG = "en_US.UTF-8";
|
||||||
|
COLORTERM = "truecolor";
|
||||||
|
};
|
||||||
|
settings = {
|
||||||
|
completion = {
|
||||||
|
enable = true;
|
||||||
|
extraCompletions = true;
|
||||||
|
caseInsensitive = true;
|
||||||
|
fuzzySearch = true;
|
||||||
|
};
|
||||||
|
autoSuggestions = {
|
||||||
|
enable = true;
|
||||||
|
strategy = [ "history" "completion" ];
|
||||||
|
};
|
||||||
|
history = {
|
||||||
|
append = true;
|
||||||
|
expanded = true;
|
||||||
|
share = true;
|
||||||
|
ignoreAllDups = true;
|
||||||
|
ignoreSpace = true;
|
||||||
|
};
|
||||||
|
integrations = {
|
||||||
|
fzf.enable = true;
|
||||||
|
starship = {
|
||||||
|
enable = true;
|
||||||
|
package = self'.packages.starship;
|
||||||
|
};
|
||||||
|
zoxide.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extraRC = ''
|
||||||
|
${homeEndKeyBindings}
|
||||||
|
|
||||||
|
HISTFILE=$HOME/.config/zsh/.zsh_history
|
||||||
|
SAVEHIST=${toString historySize}
|
||||||
|
HISTORY_IGNORE=${lib.escapeShellArg "(${lib.concatStringsSep "|" ignorePatterns})"}
|
||||||
|
|
||||||
|
HOSTNAME=$(hostname -s)
|
||||||
|
${aliasStr}
|
||||||
|
'';
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
lazydocker
|
||||||
|
self'.packages.shell-tools
|
||||||
|
];
|
||||||
|
}).wrapper;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,13 @@
|
|||||||
{ inputs, ... }:
|
{ self, inputs, ... }:
|
||||||
{
|
{
|
||||||
flake.modules.nixos.docker = {
|
flake.modules.nixos.docker = {
|
||||||
virtualisation.docker = {
|
virtualisation.docker.enable = true;
|
||||||
enable = true;
|
home-manager.sharedModules = [ inputs.self.modules.homeManager.docker ];
|
||||||
};
|
|
||||||
home-manager.sharedModules = with inputs.self.modules.homeManager; [
|
|
||||||
docker
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.homeManager.docker = { config, lib, pkgs, ... }:
|
flake.modules.homeManager.docker = { config, lib, pkgs, ... }:
|
||||||
{
|
{
|
||||||
options.docker = {
|
options.docker.enable = lib.mkEnableOption "Docker tools and utilities";
|
||||||
enable = lib.mkEnableOption "Docker tools and utilities";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf config.docker.enable {
|
config = lib.mkIf config.docker.enable {
|
||||||
programs.lazydocker.enable = true;
|
programs.lazydocker.enable = true;
|
||||||
programs.docker-cli.enable = true;
|
programs.docker-cli.enable = true;
|
||||||
|
|||||||
+88
-50
@@ -1,22 +1,32 @@
|
|||||||
{inputs, ... }:
|
{ inputs, ... }:
|
||||||
let
|
let
|
||||||
userName = "john";
|
userName = "john";
|
||||||
sshHostCAPubKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNug18oLH0vZxnibXJzMJvTWFPZTnSlhCDDVi+rHhgnIum6ZXQ4SF+VHOOAM5BbzZmMKitNJ5lcrGP15Eur7DzQ=";
|
sshHostCAPubKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNug18oLH0vZxnibXJzMJvTWFPZTnSlhCDDVi+rHhgnIum6ZXQ4SF+VHOOAM5BbzZmMKitNJ5lcrGP15Eur7DzQ=";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.ssh = { pkgs, config, lib, ... }:
|
flake.modules.nixos.ssh = { config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.ssh;
|
cfg = config.ssh;
|
||||||
userCAPath = "ssh/ssh_user_ca.pub";
|
configDir = "/etc/ssh";
|
||||||
hostKeyFile = "ssh/ssh_host_ed25519_key";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.ssh = {
|
options.ssh = {
|
||||||
|
hostKey = lib.mkOption {
|
||||||
|
description = "String path to the host private key file";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "ssh_host_ed25519_key";
|
||||||
|
};
|
||||||
certificates = {
|
certificates = {
|
||||||
enable = lib.mkEnableOption "Enable SSH host certificates";
|
enable = lib.mkEnableOption "Enable SSH host certificates";
|
||||||
userCA = lib.mkOption {
|
userCA = lib.mkOption {
|
||||||
|
description = "Content for the SSH user CA file (public key)";
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
default = ../../keys/ssh_user_ca.pub;
|
default = ../hosts/janus/ssh_user_ca.pub;
|
||||||
|
};
|
||||||
|
userCAFile = lib.mkOption {
|
||||||
|
description = "String path to the SSh user CA";
|
||||||
|
type = lib.types.str;
|
||||||
|
default = "ssh_user_ca.pub";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -29,16 +39,16 @@ in
|
|||||||
{
|
{
|
||||||
PasswordAuthentication = false;
|
PasswordAuthentication = false;
|
||||||
KbdInteractiveAuthentication = false;
|
KbdInteractiveAuthentication = false;
|
||||||
HostKey = "/etc/${hostKeyFile}";
|
HostKey = "${configDir}/${cfg.hostKey}";
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.certificates.enable {
|
(lib.mkIf cfg.certificates.enable {
|
||||||
TrustedUserCAKeys = "/etc/${userCAPath}";
|
TrustedUserCAKeys = "${configDir}/${cfg.certificates.userCAFile}";
|
||||||
HostCertificate = "/etc/${hostKeyFile}-cert.pub";
|
HostCertificate = "${configDir}/${cfg.hostKey}-cert.pub";
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.etc."${userCAPath}" = lib.mkIf cfg.certificates.enable {
|
environment.etc."ssh/${cfg.certificates.userCAFile}" = lib.mkIf cfg.certificates.enable {
|
||||||
source = cfg.certificates.userCA;
|
source = cfg.certificates.userCA;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -55,52 +65,57 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
flake.modules.homeManager.ssh = { pkgs, config, lib, ... }:
|
flake.modules.homeManager.ssh = { config, pkgs, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.ssh;
|
||||||
|
configDir = "${config.home.homeDirectory}/.ssh";
|
||||||
|
identityFile = cfg.identityFile;
|
||||||
|
publicKeyFile = "${identityFile}.pub";
|
||||||
|
certificateFile = "${identityFile}-cert.pub";
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.ssh = {
|
options.ssh = with lib; {
|
||||||
IdentityFile = lib.mkOption {
|
identityFile = mkOption {
|
||||||
# Intentionally not using a path type here because that will end up with the private key getting copied into the store
|
# Intentionally not using a path type here because that will end up with the private key getting copied into the store
|
||||||
type = lib.types.str;
|
type = types.str;
|
||||||
default = "${config.home.homeDirectory}/.ssh/id_ed25519";
|
default = "${config.home.homeDirectory}/.ssh/id_ed25519";
|
||||||
description = "Path to the SSH identity file.";
|
description = "Path to the SSH identity file.";
|
||||||
};
|
};
|
||||||
|
|
||||||
certificates = {
|
certificates = {
|
||||||
enable = lib.mkEnableOption "Enable SSH user certificates";
|
enable = mkEnableOption "Enable SSH client certificates";
|
||||||
# sshCertProvisioner = lib.mkOption {
|
|
||||||
# type = lib.types.str;
|
|
||||||
# default = "admin";
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
knownHostsFile = lib.mkOption {
|
knownHostsFile = mkOption {
|
||||||
type = lib.types.str;
|
type = types.str;
|
||||||
default = "${config.home.homeDirectory}/.ssh/known_hosts";
|
default = "${configDir}/known_hosts";
|
||||||
|
};
|
||||||
|
|
||||||
|
knownHosts = mkOption {
|
||||||
|
description = "";
|
||||||
|
type = types.listOf types.str;
|
||||||
|
default = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
matchSets = {
|
matchSets = {
|
||||||
appdaemon = lib.mkEnableOption "Enable AppDaemon SSH targets";
|
appdaemon = mkEnableOption "Enable AppDaemon SSH targets";
|
||||||
certs = lib.mkEnableOption "Enable Janus and Soteria SSH targets";
|
certs = mkEnableOption "Enable Janus and Soteria SSH targets";
|
||||||
homelab = lib.mkEnableOption "Enable various Homelab targets";
|
homelab = mkEnableOption "Enable various Homelab targets";
|
||||||
dev = lib.mkEnableOption "Enable development targets";
|
dev = mkEnableOption "Enable development targets";
|
||||||
|
tailscale = mkEnableOption "Enable tailscale targets";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# All this stuff has to be wrapped in a config attribute because of the presence of the options here?
|
# All this stuff has to be wrapped in a config attribute because of the presence of the options here?
|
||||||
config = let
|
config = let
|
||||||
cfg = config.ssh;
|
|
||||||
identityFile = cfg.IdentityFile;
|
|
||||||
publicKeyFile = "${identityFile}.pub";
|
|
||||||
certificateFile = "${identityFile}-cert.pub";
|
|
||||||
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
||||||
in {
|
in {
|
||||||
home.file.".ssh/known_hosts" = {
|
home.file.".ssh/known_hosts" = {
|
||||||
text = lib.concatStringsSep "\n" (
|
text = lib.concatStringsSep "\n" (
|
||||||
[
|
cfg.knownHosts ++ lib.optionals cfg.certificates.enable [
|
||||||
"fded:fb16:653e:25da:be24:11ff:fea0:753f ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ9ZqiWPrCwHjxFCiu0lT4rlQs7KyMapxKJQQ5PJP1eh"
|
"@cert-authority 192.168.1.* ${sshHostCAPubKey}"
|
||||||
|
"@cert-authority *.john-stream.com ${sshHostCAPubKey}"
|
||||||
]
|
]
|
||||||
++ (lib.optional cfg.certificates.enable "@cert-authority 192.168.1.* ${sshHostCAPubKey}")
|
|
||||||
++ (lib.optional cfg.certificates.enable "@cert-authority *.john-stream.com ${sshHostCAPubKey}")
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -109,27 +124,33 @@ in
|
|||||||
enableDefaultConfig = false;
|
enableDefaultConfig = false;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
SetEnv TERM="xterm-256color"
|
SetEnv TERM="xterm-256color"
|
||||||
IdentityAgent ~/.1password/agent.sock
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
matchBlocks = lib.mkMerge [
|
matchBlocks = lib.mkMerge [
|
||||||
{
|
{
|
||||||
"*" = {
|
"john-pc-ubuntu" = {
|
||||||
user = "john";
|
hostname = "192.168.1.85";
|
||||||
|
|
||||||
compression = false;
|
|
||||||
serverAliveInterval = 0;
|
|
||||||
serverAliveCountMax = 3;
|
|
||||||
|
|
||||||
identitiesOnly = true;
|
|
||||||
inherit identityFile certificateFile;
|
|
||||||
|
|
||||||
hashKnownHosts = false;
|
|
||||||
userKnownHostsFile = cfg.knownHostsFile;
|
|
||||||
|
|
||||||
addKeysToAgent = "yes";
|
|
||||||
forwardAgent = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
"*" = lib.mkMerge [
|
||||||
|
{
|
||||||
|
user = "john";
|
||||||
|
|
||||||
|
compression = false;
|
||||||
|
serverAliveInterval = 0;
|
||||||
|
serverAliveCountMax = 3;
|
||||||
|
|
||||||
|
identitiesOnly = true;
|
||||||
|
inherit identityFile;
|
||||||
|
|
||||||
|
hashKnownHosts = false;
|
||||||
|
userKnownHostsFile = cfg.knownHostsFile;
|
||||||
|
|
||||||
|
addKeysToAgent = "yes";
|
||||||
|
forwardAgent = false;
|
||||||
|
}
|
||||||
|
(lib.mkIf cfg.certificates.enable { inherit certificateFile; })
|
||||||
|
];
|
||||||
}
|
}
|
||||||
(lib.mkIf cfg.matchSets.appdaemon {
|
(lib.mkIf cfg.matchSets.appdaemon {
|
||||||
"appdaemon" = {
|
"appdaemon" = {
|
||||||
@@ -155,6 +176,10 @@ in
|
|||||||
"docs" = {
|
"docs" = {
|
||||||
hostname = "192.168.1.110";
|
hostname = "192.168.1.110";
|
||||||
user = "root";
|
user = "root";
|
||||||
|
extraOptions = {
|
||||||
|
RequestTTY = "force";
|
||||||
|
RemoteCommand = "~/.nix-profile/bin/jsl-zsh";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
"gitea" = {
|
"gitea" = {
|
||||||
hostname = "192.168.1.104";
|
hostname = "192.168.1.104";
|
||||||
@@ -173,7 +198,20 @@ in
|
|||||||
"test-nix" = {
|
"test-nix" = {
|
||||||
hostname = "fded:fb16:653e:25da:be24:11ff:fea0:753f";
|
hostname = "fded:fb16:653e:25da:be24:11ff:fea0:753f";
|
||||||
user = "john";
|
user = "john";
|
||||||
identityFile = identityFile;
|
extraOptions = {
|
||||||
|
RequestTTY = "auto";
|
||||||
|
# RemoteCommand = "/run/current-system/sw/bin/jsl-zsh";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(lib.mkIf cfg.matchSets.tailscale {
|
||||||
|
"jdl-docker" = {
|
||||||
|
hostname = "jdl-docker.tailcf205.ts.net";
|
||||||
|
user = "john";
|
||||||
|
extraOptions = {
|
||||||
|
RequestTTY = "auto";
|
||||||
|
# RemoteCommand = "~/.nix-profile/bin/jsl-zsh";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,306 +0,0 @@
|
|||||||
{ inputs, lib, ... }:
|
|
||||||
let
|
|
||||||
# Options that will be in common between
|
|
||||||
opts = {
|
|
||||||
enable = lib.mkEnableOption "Enable mTLS";
|
|
||||||
caURL = lib.mkOption {
|
|
||||||
description = "URL to the certificate authority";
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
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.";
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
keyFilename = lib.mkOption {
|
|
||||||
description = "String filename for the private key";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "key.pem";
|
|
||||||
};
|
|
||||||
certFilename = lib.mkOption {
|
|
||||||
description = "String filename for the public certificate";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "cert.pem";
|
|
||||||
};
|
|
||||||
bundleFilename = lib.mkOption {
|
|
||||||
description = "String filename for the mTLS key bundle";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "mtls.pem";
|
|
||||||
};
|
|
||||||
san = lib.mkOption {
|
|
||||||
description = "List of SAN to give the mTLS cert";
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
provisioner = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "admin";
|
|
||||||
};
|
|
||||||
lifetime = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "6h";
|
|
||||||
};
|
|
||||||
renew = {
|
|
||||||
enable = lib.mkOption {
|
|
||||||
description = "Enable automatic mTLS certificate renewal using a systemd timer.";
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = true;
|
|
||||||
};
|
|
||||||
onCalendar = lib.mkOption {
|
|
||||||
description = "systemd OnCalendar schedule for mTLS certificate renewal checks.";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "*:1/15";
|
|
||||||
};
|
|
||||||
randomizedDelaySec = lib.mkOption {
|
|
||||||
description = "Randomized delay added to renewal timer runs to avoid synchronized renewals.";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "5m";
|
|
||||||
};
|
|
||||||
user = lib.mkOption {
|
|
||||||
description = "User account to run the mTLS renewal service as.";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "root";
|
|
||||||
};
|
|
||||||
group = lib.mkOption {
|
|
||||||
description = "Group to run the mTLS renewal service as. Defaults to the configured renewal user when null.";
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
reloadUnits = lib.mkOption {
|
|
||||||
description = "systemd units to try-reload-or-restart after a successful certificate renewal.";
|
|
||||||
type = lib.types.listOf lib.types.str;
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
postCommands = lib.mkOption {
|
|
||||||
description = "Shell commands to run after a successful certificate renewal.";
|
|
||||||
type = lib.types.listOf lib.types.lines;
|
|
||||||
default = [ ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkMtlsRenewScript = {
|
|
||||||
pkgs,
|
|
||||||
tlsCert,
|
|
||||||
tlsKey,
|
|
||||||
mtlsBundle,
|
|
||||||
reloadUnits ? [ ],
|
|
||||||
postCommands ? [ ],
|
|
||||||
systemctlArgs ? [ ],
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
renewReloadScript = lib.concatMapStringsSep "\n" (unit: ''
|
|
||||||
if ${lib.getExe' pkgs.systemd "systemctl"} ${lib.escapeShellArgs systemctlArgs} --quiet is-active "${unit}"; then
|
|
||||||
${lib.getExe' pkgs.systemd "systemctl"} ${lib.escapeShellArgs systemctlArgs} try-reload-or-restart "${unit}"
|
|
||||||
fi
|
|
||||||
'') reloadUnits;
|
|
||||||
renewPostCommands = lib.concatStringsSep "\n" postCommands;
|
|
||||||
in
|
|
||||||
pkgs.writeShellScriptBin "mtls-renew" ''
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
if ${lib.getExe pkgs.step-cli} certificate needs-renewal "${tlsCert}"; then
|
|
||||||
echo "Renewing mTLS certificate"
|
|
||||||
else
|
|
||||||
echo "Skipping renew"
|
|
||||||
exit "$?"
|
|
||||||
fi
|
|
||||||
|
|
||||||
${lib.getExe pkgs.step-cli} ca renew --force "${tlsCert}" "${tlsKey}"
|
|
||||||
|
|
||||||
umask 077
|
|
||||||
${lib.getExe' pkgs.coreutils "cat"} "${tlsCert}" "${tlsKey}" > "${mtlsBundle}"
|
|
||||||
|
|
||||||
${renewReloadScript}
|
|
||||||
${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
|
|
||||||
{
|
|
||||||
description = "Renew the mTLS certificate when Smallstep marks it ready";
|
|
||||||
wantedBy = [ ];
|
|
||||||
after = [ "network-online.target" ];
|
|
||||||
wants = [ "network-online.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
User = user;
|
|
||||||
Group = serviceGroup;
|
|
||||||
ExecStart = lib.getExe renewScript;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkNixosMtlsRenewTimer = {
|
|
||||||
onCalendar,
|
|
||||||
randomizedDelaySec,
|
|
||||||
unit ? "mtls-renew.service",
|
|
||||||
}: {
|
|
||||||
description = "Periodic Smallstep renewal for the mTLS certificate";
|
|
||||||
wantedBy = [ "timers.target" ];
|
|
||||||
timerConfig = {
|
|
||||||
Persistent = true;
|
|
||||||
OnCalendar = onCalendar;
|
|
||||||
AccuracySec = "1us";
|
|
||||||
RandomizedDelaySec = randomizedDelaySec;
|
|
||||||
Unit = unit;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkHomeManagerMtlsRenewService = {
|
|
||||||
pkgs,
|
|
||||||
tlsCert,
|
|
||||||
tlsKey,
|
|
||||||
mtlsBundle,
|
|
||||||
reloadUnits ? [ ],
|
|
||||||
postCommands ? [ ],
|
|
||||||
}:
|
|
||||||
let
|
|
||||||
renewScript = mkMtlsRenewScript {
|
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle reloadUnits postCommands;
|
|
||||||
systemctlArgs = [ "--user" ];
|
|
||||||
};
|
|
||||||
in
|
|
||||||
{
|
|
||||||
Unit = {
|
|
||||||
Description = "Renew the mTLS certificate when Smallstep marks it ready";
|
|
||||||
After = [ "network-online.target" ];
|
|
||||||
Wants = [ "network-online.target" ];
|
|
||||||
};
|
|
||||||
Service = {
|
|
||||||
Type = "oneshot";
|
|
||||||
ExecStart = lib.getExe renewScript;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mkHomeManagerMtlsRenewTimer = {
|
|
||||||
onCalendar,
|
|
||||||
randomizedDelaySec,
|
|
||||||
unit ? "mtls-renew.service",
|
|
||||||
}: {
|
|
||||||
Unit = {
|
|
||||||
Description = "Periodic Smallstep renewal for the mTLS certificate";
|
|
||||||
};
|
|
||||||
Timer = {
|
|
||||||
Persistent = true;
|
|
||||||
OnCalendar = onCalendar;
|
|
||||||
AccuracySec = "1us";
|
|
||||||
RandomizedDelaySec = randomizedDelaySec;
|
|
||||||
Unit = unit;
|
|
||||||
};
|
|
||||||
Install = {
|
|
||||||
WantedBy = [ "timers.target" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in
|
|
||||||
{
|
|
||||||
flake.modules.nixos.mtls = { config, lib, pkgs, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.mtls;
|
|
||||||
certDir = "/etc/step/certs";
|
|
||||||
tlsKey = "${certDir}/${cfg.keyFilename}";
|
|
||||||
tlsCert = "${certDir}/${cfg.certFilename}";
|
|
||||||
mtlsBundle = "${certDir}/${cfg.bundleFilename}";
|
|
||||||
rootCA = "${certDir}/root_ca.crt";
|
|
||||||
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.mtls = opts;
|
|
||||||
config = lib.mkIf cfg.enable {
|
|
||||||
environment.systemPackages = with pkgs; lib.optionals cfg.enable [
|
|
||||||
(writeShellScriptBin "mtls-generate" ''
|
|
||||||
set -euo pipefail
|
|
||||||
${lib.getExe pkgs.step-cli} ca certificate \
|
|
||||||
${cfg.subject} ${tlsCert} ${tlsKey} \
|
|
||||||
--ca-url ${cfg.caURL} \
|
|
||||||
--root ${rootCA} \
|
|
||||||
--provisioner ${cfg.provisioner} \
|
|
||||||
--not-before=-5m --not-after=${cfg.lifetime} \
|
|
||||||
${sanArgs} \
|
|
||||||
"$@"
|
|
||||||
cat ${tlsCert} ${tlsKey} > ${mtlsBundle}
|
|
||||||
'')
|
|
||||||
(writeShellScriptBin "mtls-check" ''
|
|
||||||
${lib.getExe pkgs.openssl} x509 \
|
|
||||||
-noout -subject -issuer \
|
|
||||||
-ext subjectAltName,extendedKeyUsage \
|
|
||||||
-enddate -in ${mtlsBundle}
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.services.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewService {
|
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
|
||||||
inherit (cfg.renew) reloadUnits postCommands user group;
|
|
||||||
});
|
|
||||||
|
|
||||||
systemd.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkNixosMtlsRenewTimer {
|
|
||||||
inherit (cfg.renew) onCalendar randomizedDelaySec;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
flake.modules.homeManager.mtls = { config, lib, pkgs, ... }:
|
|
||||||
let
|
|
||||||
cfg = config.mtls;
|
|
||||||
certDir = cfg.certDir;
|
|
||||||
tlsKey = "${certDir}/${cfg.keyFilename}";
|
|
||||||
tlsCert = "${certDir}/${cfg.certFilename}";
|
|
||||||
mtlsBundle = "${certDir}/${cfg.bundleFilename}";
|
|
||||||
rootCA = "${certDir}/root_ca.crt";
|
|
||||||
sanArgs = lib.concatMapStringsSep " " (san: "--san \"${san}\"") cfg.san;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.mtls = opts // {
|
|
||||||
certDir = lib.mkOption {
|
|
||||||
description = "String path to where the mtls certs will be stored.";
|
|
||||||
type = lib.types.str;
|
|
||||||
default ="${config.home.homeDirectory}/.step/certs";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
|
||||||
home.packages = with pkgs; lib.optionals cfg.enable [
|
|
||||||
step-cli
|
|
||||||
(writeShellScriptBin "mtls-generate" ''
|
|
||||||
set -euo pipefail
|
|
||||||
${lib.getExe pkgs.step-cli} ca certificate \
|
|
||||||
${cfg.subject} ${tlsCert} ${tlsKey} \
|
|
||||||
--not-before=-5m --not-after=${cfg.lifetime} \
|
|
||||||
--provisioner ${cfg.provisioner} \
|
|
||||||
${sanArgs} \
|
|
||||||
"$@"
|
|
||||||
cat ${tlsCert} ${tlsKey} > ${mtlsBundle}
|
|
||||||
'')
|
|
||||||
(writeShellScriptBin "mtls-check" ''
|
|
||||||
${lib.getExe pkgs.openssl} x509 \
|
|
||||||
-noout -subject -issuer \
|
|
||||||
-ext subjectAltName,extendedKeyUsage \
|
|
||||||
-enddate -in ${mtlsBundle}
|
|
||||||
'')
|
|
||||||
(mkMtlsRenewScript { inherit pkgs tlsCert tlsKey mtlsBundle; })
|
|
||||||
];
|
|
||||||
|
|
||||||
systemd.user.services.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewService {
|
|
||||||
inherit pkgs tlsCert tlsKey mtlsBundle;
|
|
||||||
inherit (cfg.renew) reloadUnits postCommands;
|
|
||||||
});
|
|
||||||
|
|
||||||
systemd.user.timers.mtls-renew = lib.mkIf cfg.renew.enable (mkHomeManagerMtlsRenewTimer {
|
|
||||||
inherit (cfg.renew) onCalendar randomizedDelaySec;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
flake.modules.nixos.step-ssh-host = { config, pkgs, lib, ... }:
|
flake.modules.nixos.step-ssh-host = { config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
cfg = config.step-ssh-host;
|
cfg = config.step-ssh-host;
|
||||||
rootCertPath = "/etc/step/certs/root_ca.crt";
|
|
||||||
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
provisionerPasswordPath = config.sops.secrets."janus/admin_jwk".path;
|
||||||
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
|
sshKeyPath = "/etc/ssh/ssh_host_ed25519_key";
|
||||||
sshCertPath = "${sshKeyPath}-cert.pub";
|
sshCertPath = "${sshKeyPath}-cert.pub";
|
||||||
@@ -11,25 +10,9 @@
|
|||||||
# NixOS Options
|
# NixOS Options
|
||||||
options.step-ssh-host = {
|
options.step-ssh-host = {
|
||||||
hostname = lib.mkOption {
|
hostname = lib.mkOption {
|
||||||
description = "Networking host name";
|
description = "Networking host name to register with the CA";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
};
|
};
|
||||||
caURL = lib.mkOption {
|
|
||||||
description = "URL for the certificate authority";
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
rootCertFile = {
|
|
||||||
path = lib.mkOption {
|
|
||||||
description = "String path to where the root_ca.crt file will be stored for the user";
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "step/certs/root_ca.crt";
|
|
||||||
};
|
|
||||||
source = lib.mkOption {
|
|
||||||
description = "Nix path to the root cert file within the repo";
|
|
||||||
type = lib.types.path;
|
|
||||||
default = ../../../keys/root_ca.crt;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
provisioner = lib.mkOption {
|
provisioner = lib.mkOption {
|
||||||
description = "Provisioner inside Step CA to use for the SSH certificates";
|
description = "Provisioner inside Step CA to use for the SSH certificates";
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
@@ -38,6 +21,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
imports = with inputs.self.modules.nixos; [ ssh ];
|
imports = with inputs.self.modules.nixos; [ ssh ];
|
||||||
|
|
||||||
# NixOS Config
|
# NixOS Config
|
||||||
config = {
|
config = {
|
||||||
ssh.certificates.enable = true;
|
ssh.certificates.enable = true;
|
||||||
@@ -48,15 +32,11 @@
|
|||||||
};
|
};
|
||||||
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.etc."${cfg.rootCertFile.path}".source = cfg.rootCertFile.source;
|
|
||||||
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 \
|
||||||
--root "${rootCertPath}" \
|
|
||||||
--ca-url ${cfg.caURL} \
|
|
||||||
--provisioner "${cfg.provisioner}" \
|
--provisioner "${cfg.provisioner}" \
|
||||||
--provisioner-password-file "${provisionerPasswordPath}" \
|
--provisioner-password-file "${provisionerPasswordPath}" \
|
||||||
--principal "${cfg.hostname}" \
|
--principal "${cfg.hostname}" \
|
||||||
@@ -71,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
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
+35
-32
@@ -1,46 +1,49 @@
|
|||||||
{ inputs, ... }:
|
{ self, inputs, lib, ... }:
|
||||||
let
|
let
|
||||||
username = "john";
|
username = "john";
|
||||||
|
baseUserModules = self.factory.user {
|
||||||
|
username = username;
|
||||||
|
isAdmin = true;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake = {
|
flake.meta.users."${username}" = {
|
||||||
meta.users."${username}" = {
|
email = "32917998+jsl12@users.noreply.github.com";
|
||||||
email = "32917998+jsl12@users.noreply.github.com";
|
name = "John Lancaster";
|
||||||
name = "John Lancaster";
|
inherit username;
|
||||||
username = "${username}";
|
key = "";
|
||||||
key = "";
|
keygrip = [ ];
|
||||||
keygrip = [
|
authorizedKeys = [
|
||||||
];
|
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAUa4dcg1TWc4pW++uodyhX4eOqrX/QYIxFWtEP7HFJ john@john-pc-ubuntu"
|
||||||
authorizedKeys = [
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus"
|
||||||
# "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIAUa4dcg1TWc4pW++uodyhX4eOqrX/QYIxFWtEP7HFJ john@john-pc-ubuntu"
|
];
|
||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMOkGLo4N/L3RYvaIZ1FmePlxa1HK0fMciZxKtRhN58F root@janus"
|
};
|
||||||
|
|
||||||
|
flake.modules = {
|
||||||
|
nixos."${username}" = { ... }: {
|
||||||
|
imports = [
|
||||||
|
baseUserModules.nixos."${username}"
|
||||||
];
|
];
|
||||||
|
users.users."${username}" = {
|
||||||
|
openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
modules = {
|
# This module will be imported by the user factory
|
||||||
nixos."${username}" = {
|
homeManager."${username}" = { pkgs, ... }:
|
||||||
imports = [
|
with inputs.self.meta.users."${username}"; {
|
||||||
(inputs.self.factory.user username true).nixos."${username}"
|
|
||||||
];
|
|
||||||
users.users."${username}" = {
|
|
||||||
openssh.authorizedKeys.keys = inputs.self.meta.users."${username}".authorizedKeys;
|
|
||||||
extraGroups = [ "docker" ];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
homeManager."${username}" = with inputs.self.meta.users."${username}"; {
|
|
||||||
home.stateVersion = "25.11";
|
home.stateVersion = "25.11";
|
||||||
|
imports = [
|
||||||
|
inputs.self.modules.homeManager.shell-tools
|
||||||
|
inputs.self.modules.homeManager.ssh
|
||||||
|
inputs.self.modules.homeManager.git
|
||||||
|
];
|
||||||
|
# home.packages = [
|
||||||
|
# inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.shell-tools
|
||||||
|
# ];
|
||||||
xdg.enable = true;
|
xdg.enable = true;
|
||||||
|
|
||||||
programs.git.settings.user.name = name;
|
programs.git.settings.user.name = name;
|
||||||
programs.git.settings.user.email = email;
|
programs.git.settings.user.email = email;
|
||||||
|
|
||||||
imports = with inputs.self.modules.homeManager; [
|
|
||||||
ssh
|
|
||||||
shell-tools
|
|
||||||
git
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +0,0 @@
|
|||||||
{
|
|
||||||
base = {
|
|
||||||
repository = "local:/mnt/backup";
|
|
||||||
password-file = "{{ .ConfigDir }}/password.txt";
|
|
||||||
status-file = "{{ .ConfigDir }}/backup-status.json";
|
|
||||||
retention = {
|
|
||||||
after-backup = true;
|
|
||||||
keep-last = "10";
|
|
||||||
keep-hourly = "8";
|
|
||||||
keep-daily = "14";
|
|
||||||
keep-weekly = "8";
|
|
||||||
};
|
|
||||||
backup = {
|
|
||||||
verbose = true;
|
|
||||||
exclude = [
|
|
||||||
".cache"
|
|
||||||
".devenv"
|
|
||||||
".rustup"
|
|
||||||
".cargo"
|
|
||||||
".venv"
|
|
||||||
".pyenv"
|
|
||||||
".vscode*"
|
|
||||||
"data/postgres"
|
|
||||||
"build"
|
|
||||||
"__pycache__"
|
|
||||||
"*.log"
|
|
||||||
"*.egg-info"
|
|
||||||
"*.csv"
|
|
||||||
"*.m4a"
|
|
||||||
|
|
||||||
".local/share/Steam"
|
|
||||||
".local/share/Trash"
|
|
||||||
"build"
|
|
||||||
"dist"
|
|
||||||
"/home/*/Pictures"
|
|
||||||
"/home/*/Videos"
|
|
||||||
"/home/*/go"
|
|
||||||
"/home/*/snap"
|
|
||||||
"/home/john/john-nas"
|
|
||||||
];
|
|
||||||
schedule-permission = "user";
|
|
||||||
schedule-priority = "background";
|
|
||||||
check-after = true;
|
|
||||||
};
|
|
||||||
prune = {
|
|
||||||
schedule-permission = "user";
|
|
||||||
schedule-lock-wait = "1h";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user