mirror of
https://github.com/nmasur/dotfiles
synced 2024-10-19 00:19:02 +00:00
Compare commits
78 Commits
9ff2def4ae
...
f3bbfd0212
Author | SHA1 | Date | |
---|---|---|---|
|
f3bbfd0212 | ||
|
c2d735f956 | ||
|
e194003f8d | ||
|
3d6f57c324 | ||
|
ef2ee7b871 | ||
|
fc867d60cd | ||
|
d395347a29 | ||
|
080f7395e0 | ||
|
1475172bdb | ||
|
5d6dab3cab | ||
|
3e6232cbee | ||
|
8d72216f13 | ||
|
dd36a3bd82 | ||
|
0ed3633404 | ||
|
95e04de763 | ||
|
b1ebca57d2 | ||
|
939d17ada1 | ||
|
dfd52e2cd5 | ||
|
b589ba5d8a | ||
|
200f790ea1 | ||
|
9f561c822c | ||
|
1f0b04b89b | ||
|
38892b1135 | ||
|
9c2e004c8b | ||
|
bbb210ec4f | ||
|
984fca2021 | ||
|
b284b333c5 | ||
|
3aef23b746 | ||
|
5f36508d2b | ||
|
3387bea109 | ||
|
6f59ea9f22 | ||
|
8d09544663 | ||
|
cb15cc209b | ||
|
b390fff749 | ||
|
20456b444b | ||
|
cce6f6573f | ||
|
52b86efbb1 | ||
|
f41774f641 | ||
|
22cba9acac | ||
|
9e8bac6834 | ||
|
b07a8f5e20 | ||
|
8eb7ef0be7 | ||
|
22ab2acf66 | ||
|
d85e4b1593 | ||
|
6ea99eca5d | ||
|
60e779085e | ||
|
6abcdfa3bd | ||
|
0f0a64b5c4 | ||
|
edb4ec77ca | ||
|
3cc264a857 | ||
|
76a7480a1d | ||
|
9d4bf082c7 | ||
|
e86b2f184f | ||
|
d14054ab17 | ||
|
9b3d2e39c9 | ||
|
5a1a843ecd | ||
|
2ddd980436 | ||
|
febf1071af | ||
|
05adc8a221 | ||
|
a463212023 | ||
|
2457ade6eb | ||
|
88d52614a9 | ||
|
2c663347ee | ||
|
02fc29c482 | ||
|
21cbe29bd8 | ||
|
c0da8391ef | ||
|
d4e203a04c | ||
|
38480e0c0c | ||
|
ee58f7a4ee | ||
|
4c4e250fa1 | ||
|
ffe867e6a8 | ||
|
b599162090 | ||
|
4b0d68089a | ||
|
b304e529b4 | ||
|
2b0f03ba1f | ||
|
2c4f215b6e | ||
|
066ea8e440 | ||
|
cd0c93c6d9 |
20
.github/workflows/check.yml
vendored
Normal file
20
.github/workflows/check.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
name: Check Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
name: Check
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@v4
|
||||||
|
- name: Check Nixpkgs Inputs
|
||||||
|
uses: DeterminateSystems/flake-checker-action@v5
|
||||||
|
- name: Add Nix Cache
|
||||||
|
uses: DeterminateSystems/magic-nix-cache-action@v2
|
||||||
|
- name: Check the Flake
|
||||||
|
run: nix flake check
|
38
.github/workflows/update.yml
vendored
Normal file
38
.github/workflows/update.yml
vendored
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name: Update Flake
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch: # allows manual triggering
|
||||||
|
schedule:
|
||||||
|
- cron: '33 3 * * 0' # runs weekly on Sunday at 03:33
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lockfile:
|
||||||
|
name: Lockfile
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@v4
|
||||||
|
- name: Check Nixpkgs Inputs
|
||||||
|
uses: DeterminateSystems/flake-checker-action@v5
|
||||||
|
- name: Add Nix Cache
|
||||||
|
uses: DeterminateSystems/magic-nix-cache-action@v2
|
||||||
|
- name: Update flake.lock
|
||||||
|
uses: DeterminateSystems/update-flake-lock@v19
|
||||||
|
id: update
|
||||||
|
with:
|
||||||
|
pr-title: "Update flake.lock" # Title of PR to be created
|
||||||
|
pr-labels: | # Labels to be set on the PR
|
||||||
|
dependencies
|
||||||
|
automated
|
||||||
|
- name: Check the Flake
|
||||||
|
run: nix flake check
|
||||||
|
- name: Enable Pull Request Automerge
|
||||||
|
run: gh pr merge --rebase --auto ${{ steps.update.outputs.pull-request-number }}
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,7 +3,6 @@
|
|||||||
*.db
|
*.db
|
||||||
**/.direnv/**
|
**/.direnv/**
|
||||||
result
|
result
|
||||||
.luarc.json
|
|
||||||
private/**
|
private/**
|
||||||
|
templates/**/flake.lock
|
||||||
!private/**.age
|
!private/**.age
|
||||||
!private/**.sha512
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
program = "${
|
program = "${
|
||||||
(import ../modules/common/neovim/package {
|
(import ../modules/common/neovim/package {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
colors = (import ../colorscheme/gruvbox).dark;
|
colors = (import ../colorscheme/nord).dark;
|
||||||
})
|
})
|
||||||
}/bin/nvim";
|
}/bin/nvim";
|
||||||
|
|
||||||
|
@ -1,20 +1,24 @@
|
|||||||
{
|
{
|
||||||
name = "everforest"; # dark, hard
|
name = "everforest"; # dark, hard
|
||||||
author = "Sainnhe Park";
|
author = "Sainnhe Park";
|
||||||
base00 = "#2b3339"; # Default Background
|
dark = {
|
||||||
base01 = "#323c41"; # Lighter Background
|
base00 = "#2b3339"; # Default Background
|
||||||
base02 = "#503946"; # Selection Background
|
base01 = "#323c41"; # Lighter Background
|
||||||
base03 = "#868d80"; # Comments, Invisibles, Line Highlighting
|
base02 = "#503946"; # Selection Background
|
||||||
base04 = "#d3c6aa"; # Dark Foreground (Used for status bars)
|
base03 = "#868d80"; # Comments, Invisibles, Line Highlighting
|
||||||
base05 = "#d3c6aa"; # Default Foreground, Caret, Delimiters, Operators
|
base04 = "#d3c6aa"; # Dark Foreground (Used for status bars)
|
||||||
base06 = "#e9e8d2"; # Light Foreground (Not often used)
|
base05 = "#d3c6aa"; # Default Foreground, Caret, Delimiters, Operators
|
||||||
base07 = "#fff9e8"; # Light Background (Not often used)
|
base06 = "#e9e8d2"; # Light Foreground (Not often used)
|
||||||
base08 = "#7fbbb3"; # Variables, XML Tags, Markup Link Text, ...
|
base07 = "#fff9e8"; # Light Background (Not often used)
|
||||||
base09 = "#d699b6"; # Integers, Boolean, Constants, ...
|
base08 = "#7fbbb3"; # Variables, XML Tags, Markup Link Text, ...
|
||||||
base0A = "#83c092"; # Classes, Markup Bold, Search Text Background
|
base09 = "#d699b6"; # Integers, Boolean, Constants, ...
|
||||||
base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted
|
base0A = "#83c092"; # Classes, Markup Bold, Search Text Background
|
||||||
base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ...
|
base0B = "#dbbc7f"; # Strings, Inherited Class, Markup Code, Diff Inserted
|
||||||
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
|
base0C = "#e69875"; # Support, Regular Expressions, Escape Characters, ...
|
||||||
base0E = "#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
|
base0D = "#a7c080"; # Functions, Methods, Attribute IDs, Headings
|
||||||
base0F = "#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
|
base0E =
|
||||||
|
"#e67e80"; # Keywords, Storage, Selector, Markup Italic, Diff Changed
|
||||||
|
base0F =
|
||||||
|
"#d699b6"; # Deprecated, Opening/Closing Embedded Language Tags, ...
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
|
name = "nord";
|
||||||
|
author = "arcticicestudio";
|
||||||
dark = {
|
dark = {
|
||||||
name = "nord";
|
|
||||||
author = "arcticicestudio";
|
|
||||||
base00 = "#2E3440";
|
base00 = "#2E3440";
|
||||||
base01 = "#3B4252";
|
base01 = "#3B4252";
|
||||||
base02 = "#434C5E";
|
base02 = "#434C5E";
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
local M = {}
|
|
||||||
|
|
||||||
M.packer = function(use)
|
|
||||||
use({
|
|
||||||
"shaunsingh/nord.nvim",
|
|
||||||
config = function()
|
|
||||||
vim.g.nord_italic = true
|
|
||||||
vim.cmd("colorscheme nord")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
return M
|
|
160
flake.lock
160
flake.lock
@ -17,6 +17,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"baleia-nvim-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681806450,
|
||||||
|
"narHash": "sha256-jxRlIzWbnSj89032msc5w+2TVt7zVyzlxdXxiH1dQqY=",
|
||||||
|
"owner": "m00qek",
|
||||||
|
"repo": "baleia.nvim",
|
||||||
|
"rev": "00bb4af31c8c3865b735d40ebefa6c3f07b2dd16",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "m00qek",
|
||||||
|
"repo": "baleia.nvim",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"bufferline-nvim-src": {
|
"bufferline-nvim-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -57,11 +73,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687517837,
|
"lastModified": 1690431538,
|
||||||
"narHash": "sha256-Ea+JTy6NSf+wWIFrgC8gnOnyt01xwmtDEn2KecvaBkg=",
|
"narHash": "sha256-Uml8ivMMOFPB9fNSDcw72imGHRdJpaK12sRm2DTLLe8=",
|
||||||
"owner": "lnl7",
|
"owner": "lnl7",
|
||||||
"repo": "nix-darwin",
|
"repo": "nix-darwin",
|
||||||
"rev": "6460468e7a3e1290f132fee4170ebeaa127f6f32",
|
"rev": "16c07487ac9bc59f58b121d13160c67befa3342e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -78,11 +94,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687598357,
|
"lastModified": 1690548222,
|
||||||
"narHash": "sha256-70ciIe8415oQnQypawaqocEaLJcI1XtkqRNmle8vsrg=",
|
"narHash": "sha256-EcVjLOpbAuL/y55fLlEl3BNM4FP5Pwtp+6DbTiL6FDM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "disko",
|
"repo": "disko",
|
||||||
"rev": "1e7098ee0448dc5d33df394d040f454cd42a809c",
|
"rev": "43f17a8b31c49f6696b8b258d317161afdc7e36b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -93,14 +109,16 @@
|
|||||||
},
|
},
|
||||||
"firefox-darwin": {
|
"firefox-darwin": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687568341,
|
"lastModified": 1690505116,
|
||||||
"narHash": "sha256-5mnjEy1tPfWjlFq/3UB/AyoqkDOJeVu/y/C6Yw2MW9k=",
|
"narHash": "sha256-ec0yX+DdfGtw2TQnG29jt1X/89OHTF0VsRrpp0+7s8Y=",
|
||||||
"owner": "bandithedoge",
|
"owner": "bandithedoge",
|
||||||
"repo": "nixpkgs-firefox-darwin",
|
"repo": "nixpkgs-firefox-darwin",
|
||||||
"rev": "0bb6fa671d1f1964b2cab7a3774cba1e071aa26e",
|
"rev": "69010f2ef9fbcef70d12541910ccc6db7a9997db",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -163,11 +181,11 @@
|
|||||||
"systems": "systems_2"
|
"systems": "systems_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1685518550,
|
"lastModified": 1689068808,
|
||||||
"narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=",
|
"narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef",
|
"rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -183,11 +201,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687627695,
|
"lastModified": 1690652600,
|
||||||
"narHash": "sha256-6Pu7nWb52PRtUmihwuDNShDmsZiXgtXR0OARtH4DSik=",
|
"narHash": "sha256-Dy09g7mezToVwtFPyY25fAx1hzqNXv73/QmY5/qyR44=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "172d46d4b2677b32277d903bdf4cff77c2cc6477",
|
"rev": "f58889c07efa8e1328fdf93dc1796ec2a5c47f38",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -200,7 +218,9 @@
|
|||||||
"nil": {
|
"nil": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils",
|
"flake-utils": "flake-utils",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -241,11 +261,11 @@
|
|||||||
},
|
},
|
||||||
"nixlib": {
|
"nixlib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687049841,
|
"lastModified": 1689469483,
|
||||||
"narHash": "sha256-FBNZQfWtA7bb/rwk92mfiWc85x4hXta2OAouDqO5W8w=",
|
"narHash": "sha256-2SBhY7rZQ/iNCxe04Eqxlz9YK9KgbaTMBssq3/BgdWY=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "908af6d1fa3643c5818ea45aa92b21d6385fbbe5",
|
"rev": "02fea408f27186f139153e1ae88f8ab2abd9c22c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -262,11 +282,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687398392,
|
"lastModified": 1690133435,
|
||||||
"narHash": "sha256-T6kc3NMTpGJk1/dve8PGupeVcxboEb78xtTKhe3LL/A=",
|
"narHash": "sha256-YNZiefETggroaTLsLJG2M+wpF0pJPwiauKG4q48ddNU=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixos-generators",
|
"repo": "nixos-generators",
|
||||||
"rev": "649171f56a45af13ba693c156207eafbbbf7edfe",
|
"rev": "b1171de4d362c022130c92d7c8adc4bf2b83d586",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -277,43 +297,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1639237670,
|
"lastModified": 1690548937,
|
||||||
"narHash": "sha256-RTdL4rEQcgaZGpvtDgkp3oK/V+1LM3I53n0ACPSroAQ=",
|
"narHash": "sha256-x3ZOPGLvtC0/+iFAg9Kvqm/8hTAIkGjc634SqtgaXTA=",
|
||||||
"owner": "NixOS",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "edfb969386ebe6c3cf8f878775a7975cd88f926d",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "NixOS",
|
|
||||||
"ref": "master",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_2": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1680487167,
|
|
||||||
"narHash": "sha256-9FNIqrxDZgSliGGN2XJJSvcDYmQbgOANaZA4UWnTdg4=",
|
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "53dad94e874c9586e71decf82d972dfb640ef044",
|
"rev": "2a9d660ff0f7ffde9d73be328ee6e6f10ef66b28",
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixpkgs-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs_3": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1687502512,
|
|
||||||
"narHash": "sha256-dBL/01TayOSZYxtY4cMXuNCBk8UMLoqRZA+94xiFpJA=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "3ae20aa58a6c0d1ca95c9b11f59a2d12eebc511f",
|
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -323,18 +311,18 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nixpkgs_4": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1686929285,
|
"lastModified": 1690470004,
|
||||||
"narHash": "sha256-WGtVzn+vGMPTXDO0DMNKVFtf+zUSqeW+KKk4Y/Ae99I=",
|
"narHash": "sha256-l57RmPhPz9r1LGDg/0v8bYgJO8R+GGTQZtkIxE7negU=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "93fddcf640ceca0be331210ba3101cee9d91c13d",
|
"rev": "9462344318b376e157c94fa60c20a25b913b2381",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"ref": "nixos-22.11",
|
"ref": "nixos-23.05",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
@ -342,11 +330,11 @@
|
|||||||
"null-ls-nvim-src": {
|
"null-ls-nvim-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1686871437,
|
"lastModified": 1688652536,
|
||||||
"narHash": "sha256-MxIZqyRW8jStiDNXt7Bsw8peDLKpqxKEaUuIJsXkGMI=",
|
"narHash": "sha256-6KJtj9pbvBm6fOVpnyzO2fEVC+cVrw2XtZHOgq9ieIw=",
|
||||||
"owner": "jose-elias-alvarez",
|
"owner": "jose-elias-alvarez",
|
||||||
"repo": "null-ls.nvim",
|
"repo": "null-ls.nvim",
|
||||||
"rev": "bbaf5a96913aa92281f154b08732be2f57021c45",
|
"rev": "db09b6c691def0038c456551e4e2772186449f35",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -357,11 +345,11 @@
|
|||||||
},
|
},
|
||||||
"nur": {
|
"nur": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687625402,
|
"lastModified": 1690721668,
|
||||||
"narHash": "sha256-V+vSWypmm/tGbwNXGhqzmiV7vTjV2gNCEh9N7OhNnyA=",
|
"narHash": "sha256-550poDnDiMXLPQBJnUwhEzv0ZC4zjiFiwTaOIi3jfs4=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nur",
|
"repo": "nur",
|
||||||
"rev": "aeaf37c7538965e45700d39e6b5dc9c9a0e0749c",
|
"rev": "1c4ba84e2cbfd43976a0fd3f848b536611735a79",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -390,11 +378,11 @@
|
|||||||
"nvim-tree-lua-src": {
|
"nvim-tree-lua-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687132855,
|
"lastModified": 1690616703,
|
||||||
"narHash": "sha256-ZRUoCDBv8rO8ZUBUMLgo33EBbqD9+ZOSET9rkFsA++E=",
|
"narHash": "sha256-kTbYvT21wLfiwEpQAgGZtep2GP4F9e7e6XGVpr4D1hY=",
|
||||||
"owner": "kyazdani42",
|
"owner": "kyazdani42",
|
||||||
"repo": "nvim-tree.lua",
|
"repo": "nvim-tree.lua",
|
||||||
"rev": "c3c6544ee00333b0f1d6a13735d0dd302dba4f70",
|
"rev": "4bd30f0137e44dcf3e74cc1164efb568f78f2b02",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -423,6 +411,7 @@
|
|||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"Comment-nvim-src": "Comment-nvim-src",
|
"Comment-nvim-src": "Comment-nvim-src",
|
||||||
|
"baleia-nvim-src": "baleia-nvim-src",
|
||||||
"bufferline-nvim-src": "bufferline-nvim-src",
|
"bufferline-nvim-src": "bufferline-nvim-src",
|
||||||
"cmp-nvim-lsp-src": "cmp-nvim-lsp-src",
|
"cmp-nvim-lsp-src": "cmp-nvim-lsp-src",
|
||||||
"darwin": "darwin",
|
"darwin": "darwin",
|
||||||
@ -432,7 +421,7 @@
|
|||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
"nix2vim": "nix2vim",
|
"nix2vim": "nix2vim",
|
||||||
"nixos-generators": "nixos-generators",
|
"nixos-generators": "nixos-generators",
|
||||||
"nixpkgs": "nixpkgs_3",
|
"nixpkgs": "nixpkgs",
|
||||||
"null-ls-nvim-src": "null-ls-nvim-src",
|
"null-ls-nvim-src": "null-ls-nvim-src",
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"nvim-lspconfig-src": "nvim-lspconfig-src",
|
"nvim-lspconfig-src": "nvim-lspconfig-src",
|
||||||
@ -441,6 +430,7 @@
|
|||||||
"telescope-nvim-src": "telescope-nvim-src",
|
"telescope-nvim-src": "telescope-nvim-src",
|
||||||
"telescope-project-nvim-src": "telescope-project-nvim-src",
|
"telescope-project-nvim-src": "telescope-project-nvim-src",
|
||||||
"toggleterm-nvim-src": "toggleterm-nvim-src",
|
"toggleterm-nvim-src": "toggleterm-nvim-src",
|
||||||
|
"vscode-terraform-snippets": "vscode-terraform-snippets",
|
||||||
"wallpapers": "wallpapers",
|
"wallpapers": "wallpapers",
|
||||||
"wsl": "wsl"
|
"wsl": "wsl"
|
||||||
}
|
}
|
||||||
@ -550,6 +540,22 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"vscode-terraform-snippets": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1614849738,
|
||||||
|
"narHash": "sha256-v392tyzXV+zyBNt5OCB2NBCK7JcByrTa5Ne/nFtSCJI=",
|
||||||
|
"owner": "run-at-scale",
|
||||||
|
"repo": "vscode-terraform-doc-snippets",
|
||||||
|
"rev": "6ab3e44b566e660f38922cf908e6e547eaa5d4b4",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "run-at-scale",
|
||||||
|
"repo": "vscode-terraform-doc-snippets",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"wallpapers": {
|
"wallpapers": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -570,14 +576,14 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-compat": "flake-compat",
|
"flake-compat": "flake-compat",
|
||||||
"flake-utils": "flake-utils_3",
|
"flake-utils": "flake-utils_3",
|
||||||
"nixpkgs": "nixpkgs_4"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1687279045,
|
"lastModified": 1690553050,
|
||||||
"narHash": "sha256-LR0dsXd/A07M61jclyBUW0wRojEQteWReKM35zoJXp0=",
|
"narHash": "sha256-pK3kF30OykL3v6P8UP6ipihlS34KoGq9SryCj3tHrFw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NixOS-WSL",
|
"repo": "NixOS-WSL",
|
||||||
"rev": "a8486b5d191f11d571f15d80b6e265d1712d01cf",
|
"rev": "f7a95a37306c46b42e9ce751977c44c752fd5eca",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
57
flake.nix
57
flake.nix
@ -20,14 +20,17 @@
|
|||||||
home-manager = {
|
home-manager = {
|
||||||
url = "github:nix-community/home-manager/master";
|
url = "github:nix-community/home-manager/master";
|
||||||
inputs.nixpkgs.follows =
|
inputs.nixpkgs.follows =
|
||||||
"nixpkgs"; # Use system packages list where available
|
"nixpkgs"; # Use system packages list for their inputs
|
||||||
};
|
};
|
||||||
|
|
||||||
# Community packages; used for Firefox extensions
|
# Community packages; used for Firefox extensions
|
||||||
nur.url = "github:nix-community/nur";
|
nur.url = "github:nix-community/nur";
|
||||||
|
|
||||||
# Use official Firefox binary for macOS
|
# Use official Firefox binary for macOS
|
||||||
firefox-darwin.url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
firefox-darwin = {
|
||||||
|
url = "github:bandithedoge/nixpkgs-firefox-darwin";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# Manage disk format and partitioning
|
# Manage disk format and partitioning
|
||||||
disko = {
|
disko = {
|
||||||
@ -54,7 +57,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
# Nix language server
|
# Nix language server
|
||||||
nil.url = "github:oxalica/nil/2023-04-03";
|
nil = {
|
||||||
|
url = "github:oxalica/nil/2023-04-03";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
|
||||||
# Neovim plugins
|
# Neovim plugins
|
||||||
nvim-lspconfig-src = {
|
nvim-lspconfig-src = {
|
||||||
@ -69,6 +75,10 @@
|
|||||||
url = "github:jose-elias-alvarez/null-ls.nvim";
|
url = "github:jose-elias-alvarez/null-ls.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
baleia-nvim-src = {
|
||||||
|
url = "github:m00qek/baleia.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
Comment-nvim-src = {
|
Comment-nvim-src = {
|
||||||
url = "github:numToStr/Comment.nvim/v0.8.0";
|
url = "github:numToStr/Comment.nvim/v0.8.0";
|
||||||
flake = false;
|
flake = false;
|
||||||
@ -97,6 +107,10 @@
|
|||||||
url = "github:kyazdani42/nvim-tree.lua";
|
url = "github:kyazdani42/nvim-tree.lua";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
vscode-terraform-snippets = {
|
||||||
|
url = "github:run-at-scale/vscode-terraform-doc-snippets";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -105,7 +119,8 @@
|
|||||||
let
|
let
|
||||||
|
|
||||||
# Global configuration for my systems
|
# Global configuration for my systems
|
||||||
globals = rec {
|
globals = let baseName = "masu.rs";
|
||||||
|
in rec {
|
||||||
user = "noah";
|
user = "noah";
|
||||||
fullName = "Noah Masur";
|
fullName = "Noah Masur";
|
||||||
gitName = fullName;
|
gitName = fullName;
|
||||||
@ -113,7 +128,17 @@
|
|||||||
mail.server = "noahmasur.com";
|
mail.server = "noahmasur.com";
|
||||||
mail.imapHost = "imap.purelymail.com";
|
mail.imapHost = "imap.purelymail.com";
|
||||||
mail.smtpHost = "smtp.purelymail.com";
|
mail.smtpHost = "smtp.purelymail.com";
|
||||||
dotfilesRepo = "git@github.com:nmasur/dotfiles";
|
dotfilesRepo = "https://github.com/nmasur/dotfiles";
|
||||||
|
hostnames = {
|
||||||
|
git = "git.${baseName}";
|
||||||
|
metrics = "metrics.${baseName}";
|
||||||
|
prometheus = "prom.${baseName}";
|
||||||
|
secrets = "vault.${baseName}";
|
||||||
|
stream = "stream.${baseName}";
|
||||||
|
content = "cloud.${baseName}";
|
||||||
|
books = "books.${baseName}";
|
||||||
|
download = "download.${baseName}";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Common overlays to always use
|
# Common overlays to always use
|
||||||
@ -123,6 +148,8 @@
|
|||||||
(import ./overlays/neovim-plugins.nix inputs)
|
(import ./overlays/neovim-plugins.nix inputs)
|
||||||
(import ./overlays/calibre-web.nix)
|
(import ./overlays/calibre-web.nix)
|
||||||
(import ./overlays/disko.nix inputs)
|
(import ./overlays/disko.nix inputs)
|
||||||
|
(import ./overlays/tree-sitter.nix inputs)
|
||||||
|
(import ./overlays/betterlockscreen.nix)
|
||||||
];
|
];
|
||||||
|
|
||||||
# System types to support.
|
# System types to support.
|
||||||
@ -150,7 +177,7 @@
|
|||||||
import ./hosts/lookingglass { inherit inputs globals overlays; };
|
import ./hosts/lookingglass { inherit inputs globals overlays; };
|
||||||
};
|
};
|
||||||
|
|
||||||
# For quickly applying local settings with:
|
# For quickly applying home-manager settings with:
|
||||||
# home-manager switch --flake .#tempest
|
# home-manager switch --flake .#tempest
|
||||||
homeConfigurations = {
|
homeConfigurations = {
|
||||||
tempest =
|
tempest =
|
||||||
@ -201,6 +228,24 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
checks = forAllSystems (system:
|
||||||
|
let pkgs = import nixpkgs { inherit system overlays; };
|
||||||
|
in {
|
||||||
|
neovim = pkgs.runCommand "neovim-check-health" {
|
||||||
|
buildInputs = [ inputs.self.packages.${system}.neovim ];
|
||||||
|
} ''
|
||||||
|
mkdir -p $out
|
||||||
|
export HOME=$TMPDIR
|
||||||
|
nvim -c "checkhealth" -c "write $out/health.log" -c "quitall"
|
||||||
|
|
||||||
|
# Check for errors inside the health log
|
||||||
|
if $(grep "ERROR" $out/health.log); then
|
||||||
|
cat $out/health.log
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
});
|
||||||
|
|
||||||
# Templates for starting other projects quickly
|
# Templates for starting other projects quickly
|
||||||
templates = rec {
|
templates = rec {
|
||||||
default = basic;
|
default = basic;
|
||||||
|
@ -4,14 +4,10 @@ inputs.nixos-generators.nixosGenerate {
|
|||||||
inherit system;
|
inherit system;
|
||||||
format = "amazon";
|
format = "amazon";
|
||||||
modules = [
|
modules = [
|
||||||
|
globals
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
{
|
{
|
||||||
nixpkgs.overlays = overlays;
|
nixpkgs.overlays = overlays;
|
||||||
user = globals.user;
|
|
||||||
fullName = globals.fullName;
|
|
||||||
dotfilesRepo = globals.dotfilesRepo;
|
|
||||||
gitName = globals.gitName;
|
|
||||||
gitEmail = globals.gitEmail;
|
|
||||||
networking.hostName = "sheep";
|
networking.hostName = "sheep";
|
||||||
gui.enable = false;
|
gui.enable = false;
|
||||||
theme.colors = (import ../../colorscheme/gruvbox).dark;
|
theme.colors = (import ../../colorscheme/gruvbox).dark;
|
||||||
|
@ -10,7 +10,7 @@ inputs.nixpkgs.lib.nixosSystem {
|
|||||||
system = "aarch64-linux";
|
system = "aarch64-linux";
|
||||||
specialArgs = { };
|
specialArgs = { };
|
||||||
modules = [
|
modules = [
|
||||||
(removeAttrs globals [ "mail.server" ])
|
globals
|
||||||
inputs.home-manager.nixosModules.home-manager
|
inputs.home-manager.nixosModules.home-manager
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/nixos
|
../../modules/nixos
|
||||||
@ -43,14 +43,27 @@ inputs.nixpkgs.lib.nixosSystem {
|
|||||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB+AbmjGEwITk5CK9y7+Rg27Fokgj9QEjgc9wST6MA3s";
|
||||||
|
|
||||||
# Programs and services
|
# Programs and services
|
||||||
caddy.enable = true;
|
|
||||||
cloudflare.enable = true; # Proxy traffic with Cloudflare
|
cloudflare.enable = true; # Proxy traffic with Cloudflare
|
||||||
dotfiles.enable = true; # Clone dotfiles
|
dotfiles.enable = true; # Clone dotfiles
|
||||||
gaming.minecraft-server.enable = true; # Setup Minecraft server
|
|
||||||
giteaServer = "git.masu.rs";
|
|
||||||
metricsServer = "metrics.masu.rs";
|
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
vaultwardenServer = "vault.masu.rs";
|
|
||||||
|
services.caddy.enable = true;
|
||||||
|
services.grafana.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.victoriametrics.enable = true;
|
||||||
|
services.gitea.enable = true;
|
||||||
|
services.vaultwarden.enable = true;
|
||||||
|
services.minecraft-server.enable = true; # Setup Minecraft server
|
||||||
|
|
||||||
|
cloudflareTunnel = {
|
||||||
|
enable = true;
|
||||||
|
id = "bd250ee1-ed2e-42d2-b627-039f1eb5a4d2";
|
||||||
|
credentialsFile = ../../private/cloudflared-flame.age;
|
||||||
|
ca =
|
||||||
|
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK/6oyVqjFGX3Uvrc3VS8J9sphxzAnRzKC85xgkHfYgR3TK6qBGXzHrknEj21xeZrr3G2y1UsGzphWJd9ZfIcdA= open-ssh-ca@cloudflareaccess.org";
|
||||||
|
};
|
||||||
|
|
||||||
|
giteaRunner.enable = true;
|
||||||
|
|
||||||
# Nextcloud backup config
|
# Nextcloud backup config
|
||||||
backup.s3 = {
|
backup.s3 = {
|
||||||
|
@ -21,7 +21,7 @@ inputs.darwin.lib.darwinSystem {
|
|||||||
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
|
identityFile = "/Users/Noah.Masur/.ssh/id_ed25519";
|
||||||
gui.enable = true;
|
gui.enable = true;
|
||||||
theme = {
|
theme = {
|
||||||
colors = (import ../../colorscheme/gruvbox).dark;
|
colors = (import ../../colorscheme/gruvbox-dark).dark;
|
||||||
dark = true;
|
dark = true;
|
||||||
};
|
};
|
||||||
mail.user = globals.user;
|
mail.user = globals.user;
|
||||||
|
@ -15,6 +15,7 @@ inputs.nixpkgs.lib.nixosSystem {
|
|||||||
{
|
{
|
||||||
# Hardware
|
# Hardware
|
||||||
server = true;
|
server = true;
|
||||||
|
physical = true;
|
||||||
networking.hostName = "swan";
|
networking.hostName = "swan";
|
||||||
|
|
||||||
boot.initrd.availableKernelModules =
|
boot.initrd.availableKernelModules =
|
||||||
@ -48,14 +49,19 @@ inputs.nixpkgs.lib.nixosSystem {
|
|||||||
theme = { colors = (import ../../colorscheme/gruvbox).dark; };
|
theme = { colors = (import ../../colorscheme/gruvbox).dark; };
|
||||||
nixpkgs.overlays = overlays;
|
nixpkgs.overlays = overlays;
|
||||||
neovim.enable = true;
|
neovim.enable = true;
|
||||||
caddy.enable = true;
|
|
||||||
cloudflare.enable = true;
|
cloudflare.enable = true;
|
||||||
dotfiles.enable = true;
|
dotfiles.enable = true;
|
||||||
streamServer = "stream.masu.rs";
|
arrs.enable = true;
|
||||||
nextcloudServer = "cloud.masu.rs";
|
|
||||||
bookServer = "books.masu.rs";
|
services.bind.enable = true;
|
||||||
arrServer = "download.masu.rs";
|
services.caddy.enable = true;
|
||||||
samba.enable = true;
|
services.jellyfin.enable = true;
|
||||||
|
services.nextcloud.enable = true;
|
||||||
|
services.calibre-web.enable = true;
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.prometheus.enable = false;
|
||||||
|
services.vmagent.enable = true;
|
||||||
|
services.samba.enable = true;
|
||||||
|
|
||||||
cloudflareTunnel = {
|
cloudflareTunnel = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -91,6 +91,19 @@ inputs.nixpkgs.lib.nixosSystem {
|
|||||||
leagueoflegends.enable = true;
|
leagueoflegends.enable = true;
|
||||||
ryujinx.enable = true;
|
ryujinx.enable = true;
|
||||||
};
|
};
|
||||||
|
services.vmagent.enable = true;
|
||||||
|
|
||||||
|
services.openssh.enable = true; # Required for Cloudflare tunnel
|
||||||
|
cloudflareTunnel = {
|
||||||
|
enable = true;
|
||||||
|
id = "ac133a82-31fb-480c-942a-cdbcd4c58173";
|
||||||
|
credentialsFile = ../../private/cloudflared-tempest.age;
|
||||||
|
ca =
|
||||||
|
"ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBPY6C0HmdFCaxYtJxFr3qV4/1X4Q8KrYQ1hlme3u1hJXK+xW+lc9Y9glWHrhiTKilB7carYTB80US0O47gI5yU4= open-ssh-ca@cloudflareaccess.org";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Allows requests to force machine to wake up
|
||||||
|
networking.interfaces.enp5s0.wakeOnLan.enable = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
vimium
|
vimium
|
||||||
multi-account-containers
|
multi-account-containers
|
||||||
facebook-container
|
facebook-container
|
||||||
temporary-containers
|
|
||||||
(lib.mkIf config._1password.enable onepassword-password-manager)
|
(lib.mkIf config._1password.enable onepassword-password-manager)
|
||||||
okta-browser-plugin
|
okta-browser-plugin
|
||||||
sponsorblock
|
sponsorblock
|
||||||
@ -74,6 +73,7 @@
|
|||||||
"media.ffmpeg.vaapi.enabled" =
|
"media.ffmpeg.vaapi.enabled" =
|
||||||
true; # Enable hardware video acceleration
|
true; # Enable hardware video acceleration
|
||||||
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
|
"cookiebanners.ui.desktop.enabled" = true; # Reject cookie popups
|
||||||
|
"svg.context-properties.content.enabled" = true; # Sidebery styling
|
||||||
};
|
};
|
||||||
userChrome = ''
|
userChrome = ''
|
||||||
:root {
|
:root {
|
||||||
|
@ -11,22 +11,15 @@
|
|||||||
|
|
||||||
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
config = lib.mkIf (config.gui.enable && config.kitty.enable) {
|
||||||
|
|
||||||
# Set the Rofi-Systemd terminal for viewing logs
|
terminal = "${pkgs.kitty}/bin/kitty";
|
||||||
# Using optionalAttrs because only available in NixOS
|
|
||||||
environment = { } // lib.attrsets.optionalAttrs
|
|
||||||
(builtins.hasAttr "sessionVariables" config.environment) {
|
|
||||||
sessionVariables.ROFI_SYSTEMD_TERM = "${pkgs.kitty}/bin/kitty";
|
|
||||||
};
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
# Set the i3 terminal
|
# Display images in the terminal
|
||||||
xsession.windowManager.i3.config.terminal =
|
programs.fish.shellAliases = {
|
||||||
lib.mkIf pkgs.stdenv.isLinux "kitty";
|
icat = "kitty +kitten icat";
|
||||||
|
ssh = "kitty +kitten ssh";
|
||||||
# Set the Rofi terminal for running programs
|
};
|
||||||
programs.rofi.terminal =
|
|
||||||
lib.mkIf pkgs.stdenv.isLinux "${pkgs.kitty}/bin/kitty";
|
|
||||||
|
|
||||||
programs.kitty = {
|
programs.kitty = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@ -34,7 +27,10 @@
|
|||||||
extraConfig = "";
|
extraConfig = "";
|
||||||
font.size = 14;
|
font.size = 14;
|
||||||
keybindings = {
|
keybindings = {
|
||||||
|
# Use shift+enter to complete text suggestions in fish
|
||||||
"shift+enter" = "send_text all \\x1F";
|
"shift+enter" = "send_text all \\x1F";
|
||||||
|
|
||||||
|
# Easy fullscreen toggle (for macOS)
|
||||||
"super+f" = "toggle_fullscreen";
|
"super+f" = "toggle_fullscreen";
|
||||||
};
|
};
|
||||||
settings = {
|
settings = {
|
||||||
@ -85,7 +81,6 @@
|
|||||||
# Scrollback
|
# Scrollback
|
||||||
scrolling_lines = 10000;
|
scrolling_lines = 10000;
|
||||||
scrollback_pager_history_size = 10; # MB
|
scrollback_pager_history_size = 10; # MB
|
||||||
scrollback_pager = "${pkgs.neovim}/bin/nvim -c 'normal G'";
|
|
||||||
|
|
||||||
# Window
|
# Window
|
||||||
window_padding_width = 6;
|
window_padding_width = 6;
|
||||||
@ -93,7 +88,7 @@
|
|||||||
tab_bar_edge = "top";
|
tab_bar_edge = "top";
|
||||||
tab_bar_style = "slant";
|
tab_bar_style = "slant";
|
||||||
|
|
||||||
# Audio
|
# Disable audio
|
||||||
enable_audio_bell = false;
|
enable_audio_bell = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
bindings = { };
|
bindings = { };
|
||||||
config = {
|
config = {
|
||||||
image-display-duration = 2;
|
image-display-duration = 2; # For cycling through images
|
||||||
hwdec = "auto-safe";
|
hwdec = "auto-safe"; # Attempt to use GPU decoding for video
|
||||||
};
|
};
|
||||||
scripts = [
|
scripts = [
|
||||||
|
|
||||||
@ -49,7 +49,7 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set default for opening PDFs
|
# Set default programs for opening PDFs and other media
|
||||||
xdg.mimeApps = {
|
xdg.mimeApps = {
|
||||||
associations.added = {
|
associations.added = {
|
||||||
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
"application/pdf" = [ "pwmt.zathura-cb.desktop" ];
|
||||||
|
@ -59,13 +59,47 @@
|
|||||||
};
|
};
|
||||||
dotfilesRepo = lib.mkOption {
|
dotfilesRepo = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Link to dotfiles repository.";
|
description = "Link to dotfiles repository HTTPS URL.";
|
||||||
};
|
};
|
||||||
unfreePackages = lib.mkOption {
|
unfreePackages = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
description = "List of unfree packages to allow.";
|
description = "List of unfree packages to allow.";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
|
hostnames = {
|
||||||
|
git = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for git server (Gitea).";
|
||||||
|
};
|
||||||
|
metrics = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for metrics server.";
|
||||||
|
};
|
||||||
|
prometheus = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for Prometheus server.";
|
||||||
|
};
|
||||||
|
secrets = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for passwords and secrets (Vaultwarden).";
|
||||||
|
};
|
||||||
|
stream = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for video/media library (Jellyfin).";
|
||||||
|
};
|
||||||
|
content = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for personal content system (Nextcloud).";
|
||||||
|
};
|
||||||
|
books = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for books library (Calibre-Web).";
|
||||||
|
};
|
||||||
|
download = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Hostname for download services.";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = let stateVersion = "23.05";
|
config = let stateVersion = "23.05";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
imports = [ ./himalaya.nix ./aerc.nix ];
|
imports = [ ./himalaya.nix ./aerc.nix ./system.nix ];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
mail.enable = lib.mkEnableOption "Mail service.";
|
mail.enable = lib.mkEnableOption "Mail service.";
|
||||||
@ -27,15 +27,31 @@
|
|||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
programs.mbsync = { enable = true; };
|
programs.mbsync = { enable = true; };
|
||||||
|
|
||||||
|
# Automatically check for mail and keep files synced locally
|
||||||
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
services.mbsync = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
enable = true;
|
enable = true;
|
||||||
frequency = "*:0/5";
|
frequency = "*:0/5";
|
||||||
postExec = "${pkgs.notmuch}/bin/notmuch new";
|
postExec = "${pkgs.notmuch}/bin/notmuch new";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Used to watch for new mail and trigger sync
|
||||||
services.imapnotify.enable = pkgs.stdenv.isLinux;
|
services.imapnotify.enable = pkgs.stdenv.isLinux;
|
||||||
programs.notmuch.enable = true;
|
|
||||||
|
# Allows sending email from CLI/sendmail
|
||||||
|
programs.msmtp.enable = true;
|
||||||
|
|
||||||
|
# Better local mail search
|
||||||
|
programs.notmuch = {
|
||||||
|
enable = true;
|
||||||
|
new.ignore = [ ".mbsyncstate.lock" ".mbsyncstate.journal" ];
|
||||||
|
};
|
||||||
|
|
||||||
accounts.email = {
|
accounts.email = {
|
||||||
|
|
||||||
|
# Where email files are stored
|
||||||
maildirBasePath = "${config.homePath}/mail";
|
maildirBasePath = "${config.homePath}/mail";
|
||||||
|
|
||||||
accounts = {
|
accounts = {
|
||||||
home = let address = "${config.mail.user}@${config.mail.server}";
|
home = let address = "${config.mail.user}@${config.mail.server}";
|
||||||
in {
|
in {
|
||||||
@ -48,13 +64,17 @@
|
|||||||
"hey"
|
"hey"
|
||||||
"admin"
|
"admin"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Options for contact completion
|
||||||
alot = { };
|
alot = { };
|
||||||
flavor = "plain";
|
|
||||||
imap = {
|
imap = {
|
||||||
host = config.mail.imapHost;
|
host = config.mail.imapHost;
|
||||||
port = 993;
|
port = 993;
|
||||||
tls.enable = true;
|
tls.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Watch for mail and run notifications or sync
|
||||||
imapnotify = {
|
imapnotify = {
|
||||||
enable = true;
|
enable = true;
|
||||||
boxes = [ "Inbox" ];
|
boxes = [ "Inbox" ];
|
||||||
@ -63,7 +83,11 @@
|
|||||||
config.home-manager.users.${config.user}.services.dunst.enable
|
config.home-manager.users.${config.user}.services.dunst.enable
|
||||||
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
|
"${pkgs.libnotify}/bin/notify-send 'New mail arrived'";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Name of the directory in maildir for this account
|
||||||
maildir = { path = "main"; };
|
maildir = { path = "main"; };
|
||||||
|
|
||||||
|
# Bi-directional syncing options for local files
|
||||||
mbsync = {
|
mbsync = {
|
||||||
enable = true;
|
enable = true;
|
||||||
create = "both";
|
create = "both";
|
||||||
@ -74,12 +98,17 @@
|
|||||||
CopyArrivalDate = "yes"; # Sync time of original message
|
CopyArrivalDate = "yes"; # Sync time of original message
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Enable indexing
|
||||||
notmuch.enable = true;
|
notmuch.enable = true;
|
||||||
|
|
||||||
|
# Used to login and send and receive emails
|
||||||
passwordCommand =
|
passwordCommand =
|
||||||
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
|
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
|
||||||
pkgs.writeText "mailpass.age"
|
pkgs.writeText "mailpass.age"
|
||||||
(builtins.readFile ../../../private/mailpass.age)
|
(builtins.readFile ../../../private/mailpass.age)
|
||||||
}";
|
}";
|
||||||
|
|
||||||
smtp = {
|
smtp = {
|
||||||
host = config.mail.smtpHost;
|
host = config.mail.smtpHost;
|
||||||
port = 465;
|
port = 465;
|
||||||
|
34
modules/common/mail/system.nix
Normal file
34
modules/common/mail/system.nix
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
|
config = lib.mkIf (config.mail.enable || config.server) {
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
programs.msmtp.enable = true;
|
||||||
|
|
||||||
|
# The system user for sending automatic notifications
|
||||||
|
accounts.email.accounts.system =
|
||||||
|
let address = "system@${config.mail.server}";
|
||||||
|
in {
|
||||||
|
userName = address;
|
||||||
|
realName = "NixOS System";
|
||||||
|
primary = !config.mail.enable; # Only primary if mail not enabled
|
||||||
|
inherit address;
|
||||||
|
passwordCommand =
|
||||||
|
"${pkgs.age}/bin/age --decrypt --identity ${config.identityFile} ${
|
||||||
|
pkgs.writeText "mailpass-system.age"
|
||||||
|
(builtins.readFile ../../../private/mailpass-system.age)
|
||||||
|
}";
|
||||||
|
msmtp.enable = true;
|
||||||
|
smtp = {
|
||||||
|
host = config.mail.smtpHost;
|
||||||
|
port = 465;
|
||||||
|
tls.enable = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,7 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }: {
|
||||||
|
|
||||||
|
# Plugin for aligning text programmatically
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.tabular ];
|
plugins = [ pkgs.vimPlugins.tabular ];
|
||||||
lua = ''
|
lua = ''
|
||||||
-- Align
|
-- Align
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, ... }: {
|
||||||
|
|
||||||
|
# Shows buffers in a VSCode-style tab layout
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.bufferline-nvim
|
pkgs.vimPlugins.bufferline-nvim
|
||||||
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
pkgs.vimPlugins.vim-bbye # Better closing of buffers
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ pkgs, lib, config, ... }: {
|
{ pkgs, lib, config, ... }: {
|
||||||
|
|
||||||
|
# Sets Neovim colors based on Nix colorscheme
|
||||||
|
|
||||||
options.colors = lib.mkOption {
|
options.colors = lib.mkOption {
|
||||||
type = lib.types.attrsOf lib.types.str;
|
type = lib.types.attrsOf lib.types.str;
|
||||||
description = "Attrset of base16 colorscheme key value pairs.";
|
description = "Attrset of base16 colorscheme key value pairs.";
|
||||||
|
@ -24,12 +24,14 @@
|
|||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Enable Luasnip snippet completion
|
||||||
snippet.expand = dsl.rawLua ''
|
snippet.expand = dsl.rawLua ''
|
||||||
function(args)
|
function(args)
|
||||||
require("luasnip").lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
# Basic completion keybinds
|
||||||
mapping = {
|
mapping = {
|
||||||
"['<C-n>']" = dsl.rawLua
|
"['<C-n>']" = dsl.rawLua
|
||||||
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
"require('cmp').mapping.select_next_item({ behavior = require('cmp').SelectBehavior.Insert })";
|
||||||
@ -64,24 +66,26 @@
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# These are where the completion engine gets its suggestions
|
||||||
sources = [
|
sources = [
|
||||||
{ name = "nvim_lua"; }
|
{ name = "nvim_lua"; } # Fills in common Neovim lua functions
|
||||||
{ name = "nvim_lsp"; }
|
{ name = "nvim_lsp"; } # LSP results
|
||||||
{ name = "luasnip"; }
|
{ name = "luasnip"; } # Snippets
|
||||||
{ name = "path"; }
|
{ name = "path"; } # Shell completion from current PATH
|
||||||
{
|
{
|
||||||
name = "buffer";
|
name = "buffer"; # Grep for text from the current text buffer
|
||||||
keyword_length = 3;
|
keyword_length = 3;
|
||||||
max_item_count = 10;
|
max_item_count = 10;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
name = "rg";
|
name = "rg"; # Grep for text from the current directory
|
||||||
keyword_length = 6;
|
keyword_length = 6;
|
||||||
max_item_count = 10;
|
max_item_count = 10;
|
||||||
option = { additional_arguments = "--ignore-case"; };
|
option = { additional_arguments = "--ignore-case"; };
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Styling of the completion menu
|
||||||
formatting = {
|
formatting = {
|
||||||
fields = [ "kind" "abbr" "menu" ];
|
fields = [ "kind" "abbr" "menu" ];
|
||||||
format = dsl.rawLua ''
|
format = dsl.rawLua ''
|
||||||
@ -135,6 +139,13 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
lua = ''
|
lua = ''
|
||||||
|
-- Load snippets
|
||||||
|
-- Check status: :lua require("luasnip").log.open()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
require("luasnip.loaders.from_vscode").lazy_load({ paths = { "${
|
||||||
|
builtins.toString pkgs.vscode-terraform-snippets
|
||||||
|
}" } })
|
||||||
|
|
||||||
-- Use buffer source for `/`
|
-- Use buffer source for `/`
|
||||||
require('cmp').setup.cmdline("/", {
|
require('cmp').setup.cmdline("/", {
|
||||||
sources = {
|
sources = {
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
lua = ''
|
lua = ''
|
||||||
${builtins.readFile ./lsp.lua}
|
${builtins.readFile ./lsp.lua}
|
||||||
|
|
||||||
|
-- Prevent infinite log size (change this when debugging)
|
||||||
|
vim.lsp.set_log_level("off")
|
||||||
|
|
||||||
require("null-ls").setup({
|
require("null-ls").setup({
|
||||||
sources = {
|
sources = {
|
||||||
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
require("null-ls").builtins.formatting.stylua.with({ command = "${pkgs.stylua}/bin/stylua" }),
|
||||||
|
@ -7,10 +7,14 @@
|
|||||||
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
pkgs.vimPlugins.comment-nvim # Smart comment commands
|
||||||
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
pkgs.vimPlugins.glow-nvim # Markdown preview popup
|
||||||
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
pkgs.vimPlugins.nvim-colorizer-lua # Hex color previews
|
||||||
|
pkgs.vimPlugins.which-key-nvim # Keybind helper
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Initialize some plugins
|
||||||
setup.Comment = { };
|
setup.Comment = { };
|
||||||
setup.colorizer = { };
|
setup.colorizer = { };
|
||||||
|
setup.glow = { };
|
||||||
|
setup.which-key = { };
|
||||||
|
|
||||||
vim.o = {
|
vim.o = {
|
||||||
termguicolors = true; # Set to truecolor
|
termguicolors = true; # Set to truecolor
|
||||||
@ -40,6 +44,10 @@
|
|||||||
relativenumber = true; # Relative numbers instead of absolute
|
relativenumber = true; # Relative numbers instead of absolute
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# For which-key-nvim
|
||||||
|
vim.o.timeout = true;
|
||||||
|
vim.o.timeoutlen = 300;
|
||||||
|
|
||||||
# Better backup, swap and undo storage
|
# Better backup, swap and undo storage
|
||||||
vim.o.backup = true; # Easier to recover and more secure
|
vim.o.backup = true; # Easier to recover and more secure
|
||||||
vim.bo.swapfile = false; # Instead of swaps, create backups
|
vim.bo.swapfile = false; # Instead of swaps, create backups
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
plugins = [ pkgs.vimPlugins.lualine-nvim ];
|
||||||
setup.lualine = {
|
setup.lualine = {
|
||||||
options = {
|
options = {
|
||||||
theme = "gruvbox";
|
theme = "base16";
|
||||||
icons_enabled = true;
|
icons_enabled = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -1,26 +1,39 @@
|
|||||||
{ pkgs, ... }: {
|
{ pkgs, lib, ... }: {
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
|
(pkgs.vimPlugins.nvim-treesitter.withPlugins (_plugins:
|
||||||
with pkgs.tree-sitter-grammars; [
|
with pkgs.tree-sitter-grammars; [
|
||||||
tree-sitter-hcl
|
tree-sitter-bash
|
||||||
tree-sitter-python
|
|
||||||
tree-sitter-lua
|
|
||||||
tree-sitter-nix
|
|
||||||
tree-sitter-fish
|
tree-sitter-fish
|
||||||
|
tree-sitter-hcl
|
||||||
|
tree-sitter-ini
|
||||||
|
tree-sitter-json
|
||||||
|
tree-sitter-lua
|
||||||
|
tree-sitter-markdown
|
||||||
|
tree-sitter-markdown-inline
|
||||||
|
tree-sitter-nix
|
||||||
|
tree-sitter-puppet
|
||||||
|
tree-sitter-python
|
||||||
|
tree-sitter-rasi
|
||||||
tree-sitter-toml
|
tree-sitter-toml
|
||||||
tree-sitter-yaml
|
tree-sitter-yaml
|
||||||
tree-sitter-json
|
|
||||||
]))
|
]))
|
||||||
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
pkgs.vimPlugins.vim-matchup # Better % jumping in languages
|
||||||
|
pkgs.vimPlugins.playground # Tree-sitter experimenting
|
||||||
pkgs.vimPlugins.nginx-vim
|
pkgs.vimPlugins.nginx-vim
|
||||||
pkgs.vimPlugins.vim-helm
|
pkgs.vimPlugins.vim-helm
|
||||||
pkgs.vimPlugins.vim-puppet
|
pkgs.baleia-nvim # Clean ANSI from kitty scrollback
|
||||||
|
(pkgs.vimUtils.buildVimPluginFrom2Nix {
|
||||||
|
pname = "nmasur";
|
||||||
|
version = "0.1";
|
||||||
|
src = ../plugin;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
setup."nvim-treesitter.configs" = {
|
setup."nvim-treesitter.configs" = {
|
||||||
highlight = { enable = true; };
|
highlight = { enable = true; };
|
||||||
indent = { enable = true; };
|
indent = { enable = true; };
|
||||||
|
matchup = { enable = true; }; # Uses vim-matchup
|
||||||
|
|
||||||
textobjects = {
|
textobjects = {
|
||||||
select = {
|
select = {
|
||||||
@ -49,4 +62,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Use mkAfter to ensure tree-sitter is already loaded
|
||||||
|
lua = lib.mkAfter ''
|
||||||
|
-- Use HCL parser with .tf files
|
||||||
|
vim.treesitter.language.register('hcl', 'terraform')
|
||||||
|
'';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }: {
|
||||||
|
|
||||||
|
# Telescope is a fuzzy finder that can work with different sub-plugins
|
||||||
|
|
||||||
plugins = [
|
plugins = [
|
||||||
pkgs.vimPlugins.telescope-nvim
|
pkgs.vimPlugins.telescope-nvim
|
||||||
pkgs.vimPlugins.project-nvim
|
pkgs.vimPlugins.project-nvim
|
||||||
|
@ -12,6 +12,8 @@ vim.api.nvim_create_autocmd("TermOpen", {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- These are all the different types of terminals we can trigger
|
||||||
|
|
||||||
local terminal = require("toggleterm.terminal").Terminal
|
local terminal = require("toggleterm.terminal").Terminal
|
||||||
|
|
||||||
local basicterminal = terminal:new()
|
local basicterminal = terminal:new()
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }: {
|
||||||
|
|
||||||
|
# Toggleterm provides a floating terminal inside the editor for quick access
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
plugins = [ pkgs.vimPlugins.toggleterm-nvim ];
|
||||||
|
|
||||||
use.toggleterm.setup = dsl.callWith {
|
use.toggleterm.setup = dsl.callWith {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ pkgs, dsl, ... }: {
|
{ pkgs, dsl, ... }: {
|
||||||
|
|
||||||
|
# This plugin creates a side drawer for navigating the current project
|
||||||
|
|
||||||
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
plugins = [ pkgs.vimPlugins.nvim-tree-lua pkgs.vimPlugins.nvim-web-devicons ];
|
||||||
|
|
||||||
# Disable netrw eagerly
|
# Disable netrw eagerly
|
||||||
@ -10,16 +12,16 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
setup.nvim-tree = {
|
setup.nvim-tree = {
|
||||||
disable_netrw = true;
|
disable_netrw = true; # Disable the built-in file manager
|
||||||
hijack_netrw = true;
|
hijack_netrw = true; # Works as the file manager
|
||||||
sync_root_with_cwd = true;
|
sync_root_with_cwd = true; # Change project whenever currend dir changes
|
||||||
respect_buf_cwd = true;
|
respect_buf_cwd = true; # Change to exact location of focused buffer
|
||||||
update_focused_file = {
|
update_focused_file = { # Change project based on the focused buffer
|
||||||
enable = true;
|
enable = true;
|
||||||
update_root = true;
|
update_root = true;
|
||||||
ignore_list = { };
|
ignore_list = { };
|
||||||
};
|
};
|
||||||
diagnostics = {
|
diagnostics = { # Enable LSP and linter integration
|
||||||
enable = true;
|
enable = true;
|
||||||
icons = {
|
icons = {
|
||||||
hint = "";
|
hint = "";
|
||||||
@ -28,7 +30,7 @@
|
|||||||
error = "";
|
error = "";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
renderer = {
|
renderer = { # Show files with changes vs. current commit
|
||||||
icons = {
|
icons = {
|
||||||
glyphs = {
|
glyphs = {
|
||||||
git = {
|
git = {
|
||||||
@ -43,6 +45,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# Set keybinds and initialize program
|
||||||
on_attach = dsl.rawLua ''
|
on_attach = dsl.rawLua ''
|
||||||
function (bufnr)
|
function (bufnr)
|
||||||
local api = require('nvim-tree.api')
|
local api = require('nvim-tree.api')
|
||||||
@ -58,7 +61,7 @@
|
|||||||
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
|
vim.keymap.set('n', 'v', api.node.open.vertical, opts('Open: Vertical Split'))
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
view = {
|
view = { # Set look and feel
|
||||||
width = 30;
|
width = 30;
|
||||||
hide_root_folder = false;
|
hide_root_folder = false;
|
||||||
side = "left";
|
side = "left";
|
||||||
@ -67,6 +70,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Toggle the sidebar
|
||||||
lua = ''
|
lua = ''
|
||||||
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
vim.keymap.set("n", "<Leader>e", ":NvimTreeFindFileToggle<CR>", { silent = true })
|
||||||
'';
|
'';
|
||||||
|
@ -18,11 +18,16 @@ in {
|
|||||||
|
|
||||||
home.packages = [ neovim ];
|
home.packages = [ neovim ];
|
||||||
|
|
||||||
|
# Use Neovim as the editor for git commit messages
|
||||||
programs.git.extraConfig.core.editor = "nvim";
|
programs.git.extraConfig.core.editor = "nvim";
|
||||||
|
|
||||||
|
# Set Neovim as the default app for text editing and manual pages
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
EDITOR = "nvim";
|
EDITOR = "nvim";
|
||||||
MANPAGER = "nvim +Man!";
|
MANPAGER = "nvim +Man!";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Create quick aliases for launching Neovim
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
shellAliases = { vim = "nvim"; };
|
shellAliases = { vim = "nvim"; };
|
||||||
shellAbbrs = {
|
shellAbbrs = {
|
||||||
@ -31,12 +36,20 @@ in {
|
|||||||
vll = "nvim -c 'Telescope oldfiles'";
|
vll = "nvim -c 'Telescope oldfiles'";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
programs.kitty.settings.scrollback_pager = lib.mkForce ''
|
|
||||||
${neovim}/bin/nvim -c 'setlocal nonumber nolist showtabline=0 foldcolumn=0|Man!' -c "autocmd VimEnter * normal G" -'';
|
|
||||||
|
|
||||||
|
# Set Neovim as the kitty terminal "scrollback" (vi mode) option.
|
||||||
|
# Requires removing some of the ANSI escape codes that are sent to the
|
||||||
|
# scrollback using sed and baleia, as well as removing several
|
||||||
|
# unnecessary features.
|
||||||
|
programs.kitty.settings.scrollback_pager = ''
|
||||||
|
$SHELL -c 'sed -r "s/[[:cntrl:]]\]133;[AC]..//g" | ${neovim}/bin/nvim -c "setlocal nonumber norelativenumber nolist laststatus=0" -c "lua baleia = require(\"baleia\").setup({}); baleia.once(0)" -c "map <silent> q :qa!<CR>" -c "autocmd VimEnter * normal G"' '';
|
||||||
|
|
||||||
|
# Create a desktop option for launching Neovim from a file manager
|
||||||
|
# (Requires launching the terminal and then executing Neovim)
|
||||||
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
|
xdg.desktopEntries.nvim = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
name = "Neovim wrapper";
|
name = "Neovim wrapper";
|
||||||
exec = "kitty nvim %F";
|
exec = "kitty nvim %F";
|
||||||
|
mimeType = [ "text/plain" "text/markdown" ];
|
||||||
};
|
};
|
||||||
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
|
xdg.mimeApps.defaultApplications = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
"text/plain" = [ "nvim.desktop" ];
|
"text/plain" = [ "nvim.desktop" ];
|
||||||
@ -45,9 +58,6 @@ in {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# # Used for icons in Vim
|
|
||||||
# fonts.fonts = with pkgs; [ nerdfonts ];
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ key("n", "<Leader>fs", ":write<CR>")
|
|||||||
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
|
key("n", "<Leader>fd", ":lcd %:p:h<CR>", { silent = true })
|
||||||
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
|
key("n", "<Leader>fu", ":lcd ..<CR>", { silent = true })
|
||||||
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
|
key("n", "<Leader><Tab>", ":b#<CR>", { silent = true })
|
||||||
key("n", "<Leader>gr", ":!gh repo view -w<CR><CR>", { silent = true })
|
key("n", "<Leader>gr", ":!gh browse %<CR><CR>", { silent = true })
|
||||||
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
|
key("n", "<Leader>tt", [[<Cmd>exe 'edit $NOTES_PATH/journal/'.strftime("%Y-%m-%d_%a").'.md'<CR>]])
|
||||||
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
|
key("n", "<Leader>jj", ":!journal<CR>:e<CR>")
|
||||||
|
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
vim.filetype.add({
|
vim.filetype.add({
|
||||||
pattern = {
|
pattern = {
|
||||||
[".*%.tfvars"] = "hcl",
|
[".*%.tfvars"] = "terraform",
|
||||||
[".*%.tf"] = "hcl",
|
[".*%.tf"] = "terraform",
|
||||||
[".*%.rasi"] = "css",
|
[".*%.rasi"] = "rasi",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
{ pkgs, colors, ... }:
|
{ pkgs, colors, ... }:
|
||||||
|
|
||||||
|
# Comes from nix2vim overlay:
|
||||||
|
# https://github.com/gytis-ivaskevicius/nix2vim/blob/master/lib/neovim-builder.nix
|
||||||
pkgs.neovimBuilder {
|
pkgs.neovimBuilder {
|
||||||
package = pkgs.neovim-unwrapped;
|
package = pkgs.neovim-unwrapped;
|
||||||
inherit colors;
|
inherit colors;
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
expression: (apply_expression
|
||||||
|
function: (apply_expression
|
||||||
|
function: (select_expression
|
||||||
|
attrpath: (attrpath) @writeshell (#match? @writeshell "^writeShell.*$")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(indented_string_expression) @bash
|
||||||
|
)
|
@ -1,5 +1,7 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
|
# Allows me to make sure I can work on my dotfiles locally
|
||||||
|
|
||||||
options.dotfiles.enable = lib.mkEnableOption "Clone dotfiles.";
|
options.dotfiles.enable = lib.mkEnableOption "Clone dotfiles.";
|
||||||
|
|
||||||
config = lib.mkIf config.dotfiles.enable {
|
config = lib.mkIf config.dotfiles.enable {
|
||||||
@ -14,13 +16,8 @@
|
|||||||
[ "writeBoundary" ] ''
|
[ "writeBoundary" ] ''
|
||||||
if [ ! -d "${config.dotfilesPath}" ]; then
|
if [ ! -d "${config.dotfilesPath}" ]; then
|
||||||
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
|
$DRY_RUN_CMD mkdir --parents $VERBOSE_ARG $(dirname "${config.dotfilesPath}")
|
||||||
|
$DRY_RUN_CMD ${pkgs.git}/bin/git \
|
||||||
# Force HTTPS because anonymous SSH doesn't work
|
clone ${config.dotfilesRepo} "${config.dotfilesPath}"
|
||||||
GIT_CONFIG_COUNT=1 \
|
|
||||||
GIT_CONFIG_KEY_0="url.https://github.com/.insteadOf" \
|
|
||||||
GIT_CONFIG_VALUE_0="git@github.com:" \
|
|
||||||
$DRY_RUN_CMD \
|
|
||||||
${pkgs.git}/bin/git clone ${config.dotfilesRepo} "${config.dotfilesPath}"
|
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
|
|
||||||
|
# This is just a placeholder as I expect to interact with my notes in a
|
||||||
|
# certain location
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
home.sessionVariables = {
|
home.sessionVariables = {
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
|
# Convenience utilities from charm.sh
|
||||||
|
|
||||||
options.charm.enable = lib.mkEnableOption "Charm utilities.";
|
options.charm.enable = lib.mkEnableOption "Charm utilities.";
|
||||||
|
|
||||||
config.home-manager.users.${config.user} = lib.mkIf config.charm.enable {
|
config.home-manager.users.${config.user} = lib.mkIf config.charm.enable {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
|
|
||||||
|
# Enables quickly entering Nix shells when changing directories
|
||||||
home-manager.users.${config.user}.programs.direnv = {
|
home-manager.users.${config.user}.programs.direnv = {
|
||||||
enable = true;
|
enable = true;
|
||||||
nix-direnv.enable = true;
|
nix-direnv.enable = true;
|
||||||
|
@ -14,7 +14,7 @@ bind -M insert \cp projects
|
|||||||
bind -M default \cp projects
|
bind -M default \cp projects
|
||||||
bind -M insert \x1F accept-autosuggestion
|
bind -M insert \x1F accept-autosuggestion
|
||||||
bind -M default \x1F accept-autosuggestion
|
bind -M default \x1F accept-autosuggestion
|
||||||
bind -M insert \cn 'commandline -r "nix run nixpkgs#"'
|
bind -M insert \cn 'commandline -r "nix shell nixpkgs#"'
|
||||||
bind -M default \cn 'commandline -r "nix run nixpkgs#"'
|
bind -M default \cn 'commandline -r "nix shell nixpkgs#"'
|
||||||
bind -M insert \x11F nix-fzf
|
bind -M insert \x11F nix-fzf
|
||||||
bind -M default \x11F nix-fzf
|
bind -M default \x11F nix-fzf
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
{ config, ... }: {
|
{ config, ... }: {
|
||||||
|
|
||||||
|
# FZF is a fuzzy-finder for the terminal
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
programs.fzf.enable = true;
|
programs.fzf.enable = true;
|
||||||
|
@ -73,6 +73,9 @@
|
|||||||
path = builtins.toString pkgs.path;
|
path = builtins.toString pkgs.path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# For security, only allow specific users
|
||||||
|
settings.allowed-users = [ "@wheel" config.user ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ in {
|
|||||||
dig # DNS lookup
|
dig # DNS lookup
|
||||||
fd # find
|
fd # find
|
||||||
htop # Show system processes
|
htop # Show system processes
|
||||||
|
killall # Force quit
|
||||||
inetutils # Includes telnet, whois
|
inetutils # Includes telnet, whois
|
||||||
jq # JSON manipulation
|
jq # JSON manipulation
|
||||||
lf # File viewer
|
lf # File viewer
|
||||||
@ -34,6 +35,9 @@ in {
|
|||||||
tree # View directory hierarchy
|
tree # View directory hierarchy
|
||||||
vimv-rs # Batch rename files
|
vimv-rs # Batch rename files
|
||||||
unzip # Extract zips
|
unzip # Extract zips
|
||||||
|
dua # File sizes (du)
|
||||||
|
du-dust # Disk usage tree (ncdu)
|
||||||
|
duf # Basic disk information (df)
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.zoxide.enable = true; # Shortcut jump command
|
programs.zoxide.enable = true; # Shortcut jump command
|
||||||
@ -52,10 +56,6 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.fish.shellAbbrs = {
|
|
||||||
cat = "bat"; # Swap cat with bat
|
|
||||||
};
|
|
||||||
|
|
||||||
programs.fish.functions = {
|
programs.fish.functions = {
|
||||||
ping = {
|
ping = {
|
||||||
description = "Improved ping";
|
description = "Improved ping";
|
||||||
|
@ -20,12 +20,22 @@
|
|||||||
};
|
};
|
||||||
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source =
|
xdg.configFile."hammerspoon/Spoons/MoveWindow.spoon".source =
|
||||||
./hammerspoon/Spoons/MoveWindow.spoon;
|
./hammerspoon/Spoons/MoveWindow.spoon;
|
||||||
|
|
||||||
|
home.activation.reloadHammerspoon =
|
||||||
|
config.home-manager.users.${config.user}.lib.dag.entryAfter
|
||||||
|
[ "writeBoundary" ] ''
|
||||||
|
$DRY_RUN_CMD /usr/local/bin/hs -c "hs.reload()"
|
||||||
|
$DRY_RUN_CMD sleep 1
|
||||||
|
$DRY_RUN_CMD /usr/local/bin/hs -c "hs.console.clearConsole()"
|
||||||
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
homebrew.casks = [ "hammerspoon" ];
|
homebrew.casks = [ "hammerspoon" ];
|
||||||
|
|
||||||
system.activationScripts.postUserActivation.text = ''
|
system.activationScripts.postUserActivation.text = ''
|
||||||
defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua"
|
defaults write org.hammerspoon.Hammerspoon MJConfigFile "~/.config/hammerspoon/init.lua"
|
||||||
|
sudo killall Dock
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -2,3 +2,4 @@ hs.loadSpoon("ControlEscape"):start() -- Load Hammerspoon bits from https://gith
|
|||||||
hs.loadSpoon("Launcher"):init()
|
hs.loadSpoon("Launcher"):init()
|
||||||
hs.loadSpoon("DismissAlerts"):init()
|
hs.loadSpoon("DismissAlerts"):init()
|
||||||
hs.loadSpoon("MoveWindow"):init()
|
hs.loadSpoon("MoveWindow"):init()
|
||||||
|
hs.ipc.cliInstall() -- Install Hammerspoon CLI program
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
home.packages = with pkgs; [ calibre ];
|
home.packages = with pkgs; [ calibre ];
|
||||||
# home.sessionVariables = { CALIBRE_USE_DARK_PALETTE = 1; };
|
# home.sessionVariables = { CALIBRE_USE_DARK_PALETTE = 1; };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Forces Calibre to use dark mode
|
||||||
environment.sessionVariables = { CALIBRE_USE_DARK_PALETTE = "1"; };
|
environment.sessionVariables = { CALIBRE_USE_DARK_PALETTE = "1"; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,14 @@
|
|||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
# Quick button for launching nautilus
|
||||||
xsession.windowManager.i3.config.keybindings = {
|
xsession.windowManager.i3.config.keybindings = {
|
||||||
"${
|
"${
|
||||||
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
|
config.home-manager.users.${config.user}.xsession.windowManager.i3.config.modifier
|
||||||
}+n" = "exec --no-startup-id ${pkgs.gnome.nautilus}/bin/nautilus";
|
}+n" = "exec --no-startup-id ${pkgs.gnome.nautilus}/bin/nautilus";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Generates a QR code and previews it with sushi
|
||||||
programs.fish.functions = {
|
programs.fish.functions = {
|
||||||
qr = {
|
qr = {
|
||||||
body =
|
body =
|
||||||
@ -31,7 +33,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Set default for opening directories
|
# Set Nautilus as default for opening directories
|
||||||
xdg.mimeApps = {
|
xdg.mimeApps = {
|
||||||
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
|
associations.added."inode/directory" = [ "org.gnome.Nautilus.desktop" ];
|
||||||
# associations.removed = {
|
# associations.removed = {
|
||||||
@ -40,6 +42,7 @@
|
|||||||
defaultApplications."inode/directory" =
|
defaultApplications."inode/directory" =
|
||||||
lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
|
lib.mkBefore [ "org.gnome.Nautilus.desktop" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# # Set default for opening directories
|
# # Set default for opening directories
|
||||||
@ -50,6 +53,13 @@
|
|||||||
# lib.mkForce [ "org.gnome.Nautilus.desktop" ];
|
# lib.mkForce [ "org.gnome.Nautilus.desktop" ];
|
||||||
# };
|
# };
|
||||||
|
|
||||||
|
# Delete Trash files older than 1 week
|
||||||
|
systemd.user.services.empty-trash = {
|
||||||
|
description = "Empty Trash on a regular basis";
|
||||||
|
wantedBy = [ "default.target" ];
|
||||||
|
script = "${pkgs.trash-cli}/bin/trash-empty 7";
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,15 +9,11 @@ let
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options.gaming.minecraft-server.enable =
|
config = lib.mkIf config.services.minecraft-server.enable {
|
||||||
lib.mkEnableOption "Minecraft Server.";
|
|
||||||
|
|
||||||
config = lib.mkIf config.gaming.minecraft-server.enable {
|
|
||||||
|
|
||||||
unfreePackages = [ "minecraft-server" ];
|
unfreePackages = [ "minecraft-server" ];
|
||||||
|
|
||||||
services.minecraft-server = {
|
services.minecraft-server = {
|
||||||
enable = true;
|
|
||||||
eula = true;
|
eula = true;
|
||||||
declarative = true;
|
declarative = true;
|
||||||
whitelist = { };
|
whitelist = { };
|
||||||
|
@ -12,14 +12,6 @@
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
launcherCommand = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Command to use for launching";
|
|
||||||
};
|
|
||||||
systemdSearch = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Command to use for interacting with systemd";
|
|
||||||
};
|
|
||||||
altTabCommand = lib.mkOption {
|
altTabCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for choosing windows";
|
description = "Command to use for choosing windows";
|
||||||
@ -36,14 +28,30 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for quick calculations";
|
description = "Command to use for quick calculations";
|
||||||
};
|
};
|
||||||
toggleBarCommand = lib.mkOption {
|
launcherCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to hide and show the status bar.";
|
description = "Command to use for launching";
|
||||||
|
};
|
||||||
|
lockScreenCommand = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to use to lock the screen";
|
||||||
};
|
};
|
||||||
powerCommand = lib.mkOption {
|
powerCommand = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Command to use for power options menu";
|
description = "Command to use for power options menu";
|
||||||
};
|
};
|
||||||
|
systemdSearch = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to use for interacting with systemd";
|
||||||
|
};
|
||||||
|
terminal = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Package to use for graphical terminal";
|
||||||
|
};
|
||||||
|
toggleBarCommand = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Command to hide and show the status bar.";
|
||||||
|
};
|
||||||
wallpaper = lib.mkOption {
|
wallpaper = lib.mkOption {
|
||||||
type = lib.types.path;
|
type = lib.types.path;
|
||||||
description = "Wallpaper background image file";
|
description = "Wallpaper background image file";
|
||||||
|
@ -6,7 +6,7 @@ in {
|
|||||||
|
|
||||||
config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) {
|
config = lib.mkIf (config.gui.enable && pkgs.stdenv.isLinux) {
|
||||||
|
|
||||||
fonts.fonts = with pkgs; [
|
fonts.packages = with pkgs; [
|
||||||
victor-mono # Used for Vim and Terminal
|
victor-mono # Used for Vim and Terminal
|
||||||
(nerdfonts.override { fonts = [ "Hack" ]; }) # For Polybar, Rofi
|
(nerdfonts.override { fonts = [ "Hack" ]; }) # For Polybar, Rofi
|
||||||
];
|
];
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
lockCmd =
|
|
||||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
|
||||||
lockUpdate =
|
lockUpdate =
|
||||||
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --update ${config.wallpaper} --display 1 --span";
|
||||||
|
|
||||||
@ -29,12 +27,6 @@ in {
|
|||||||
ws2 = "2:II";
|
ws2 = "2:II";
|
||||||
ws3 = "3:III";
|
ws3 = "3:III";
|
||||||
ws4 = "4:IV";
|
ws4 = "4:IV";
|
||||||
ws5 = "5:V";
|
|
||||||
ws6 = "6:VI";
|
|
||||||
ws7 = "7:VII";
|
|
||||||
ws8 = "8:VIII";
|
|
||||||
ws9 = "9:IX";
|
|
||||||
ws10 = "10:X";
|
|
||||||
in {
|
in {
|
||||||
modifier = modifier;
|
modifier = modifier;
|
||||||
assigns = {
|
assigns = {
|
||||||
@ -92,118 +84,6 @@ in {
|
|||||||
followMouse = false;
|
followMouse = false;
|
||||||
};
|
};
|
||||||
keybindings = {
|
keybindings = {
|
||||||
|
|
||||||
# Adjust screen brightness
|
|
||||||
"Shift+F12" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
|
|
||||||
"Shift+F11" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
|
|
||||||
"XF86MonBrightnessUp" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 + 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 + 30";
|
|
||||||
"XF86MonBrightnessDown" =
|
|
||||||
"exec ${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 - 30 && sleep 1; exec ${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 - 30";
|
|
||||||
|
|
||||||
# Media player controls
|
|
||||||
"XF86AudioPlay" = "exec ${pkgs.playerctl}/bin/playerctl play-pause";
|
|
||||||
"XF86AudioStop" = "exec ${pkgs.playerctl}/bin/playerctl stop";
|
|
||||||
"XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next";
|
|
||||||
"XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous";
|
|
||||||
|
|
||||||
# Launchers
|
|
||||||
"${modifier}+Return" =
|
|
||||||
"exec --no-startup-id kitty; workspace ${ws2}; layout tabbed";
|
|
||||||
"${modifier}+space" =
|
|
||||||
"exec --no-startup-id ${config.launcherCommand}";
|
|
||||||
"${modifier}+Shift+s" =
|
|
||||||
"exec --no-startup-id ${config.systemdSearch}";
|
|
||||||
"${modifier}+Shift+a" =
|
|
||||||
"exec --no-startup-id ${config.audioSwitchCommand}";
|
|
||||||
"Mod1+Tab" = "exec --no-startup-id ${config.altTabCommand}";
|
|
||||||
"${modifier}+Shift+period" =
|
|
||||||
"exec --no-startup-id ${config.powerCommand}";
|
|
||||||
"${modifier}+Shift+m" =
|
|
||||||
"exec --no-startup-id ${config.brightnessCommand}";
|
|
||||||
"${modifier}+c" =
|
|
||||||
"exec --no-startup-id ${config.calculatorCommand}";
|
|
||||||
"${modifier}+Shift+c" = "reload";
|
|
||||||
"${modifier}+Shift+r" = "restart";
|
|
||||||
"${modifier}+Shift+q" = ''
|
|
||||||
exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"'';
|
|
||||||
"${modifier}+Shift+x" = "exec ${lockCmd}";
|
|
||||||
"${modifier}+Mod1+h" =
|
|
||||||
"exec --no-startup-id kitty sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
|
||||||
"${modifier}+Mod1+r" =
|
|
||||||
"exec --no-startup-id kitty sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
|
||||||
|
|
||||||
# Window options
|
|
||||||
"${modifier}+q" = "kill";
|
|
||||||
"${modifier}+b" = "exec ${config.toggleBarCommand}";
|
|
||||||
"${modifier}+f" = "fullscreen toggle";
|
|
||||||
"${modifier}+h" = "focus left";
|
|
||||||
"${modifier}+j" = "focus down";
|
|
||||||
"${modifier}+k" = "focus up";
|
|
||||||
"${modifier}+l" = "focus right";
|
|
||||||
"${modifier}+Left" = "focus left";
|
|
||||||
"${modifier}+Down" = "focus down";
|
|
||||||
"${modifier}+Up" = "focus up";
|
|
||||||
"${modifier}+Right" = "focus right";
|
|
||||||
"${modifier}+Shift+h" = "move left";
|
|
||||||
"${modifier}+Shift+j" = "move down";
|
|
||||||
"${modifier}+Shift+k" = "move up";
|
|
||||||
"${modifier}+Shift+l" = "move right";
|
|
||||||
"${modifier}+Shift+Left" = "move left";
|
|
||||||
"${modifier}+Shift+Down" = "move down";
|
|
||||||
"${modifier}+Shift+Up" = "move up";
|
|
||||||
"${modifier}+Shift+Right" = "move right";
|
|
||||||
|
|
||||||
# Tiling
|
|
||||||
"${modifier}+i" = "split h";
|
|
||||||
"${modifier}+v" = "split v";
|
|
||||||
"${modifier}+s" = "layout stacking";
|
|
||||||
"${modifier}+t" = "layout tabbed";
|
|
||||||
"${modifier}+e" = "layout toggle split";
|
|
||||||
"${modifier}+Shift+space" = "floating toggle";
|
|
||||||
"${modifier}+Control+space" = "focus mode_toggle";
|
|
||||||
"${modifier}+a" = "focus parent";
|
|
||||||
|
|
||||||
# Workspaces
|
|
||||||
"${modifier}+1" = "workspace ${ws1}";
|
|
||||||
"${modifier}+2" = "workspace ${ws2}";
|
|
||||||
"${modifier}+3" = "workspace ${ws3}";
|
|
||||||
"${modifier}+4" = "workspace ${ws4}";
|
|
||||||
"${modifier}+5" = "workspace ${ws5}";
|
|
||||||
"${modifier}+6" = "workspace ${ws6}";
|
|
||||||
"${modifier}+7" = "workspace ${ws7}";
|
|
||||||
"${modifier}+8" = "workspace ${ws8}";
|
|
||||||
"${modifier}+9" = "workspace ${ws9}";
|
|
||||||
"${modifier}+0" = "workspace ${ws10}";
|
|
||||||
|
|
||||||
# Move windows
|
|
||||||
"${modifier}+Shift+1" =
|
|
||||||
"move container to workspace ${ws1}; workspace ${ws1}";
|
|
||||||
"${modifier}+Shift+2" =
|
|
||||||
"move container to workspace ${ws2}; workspace ${ws2}";
|
|
||||||
"${modifier}+Shift+3" =
|
|
||||||
"move container to workspace ${ws3}; workspace ${ws3}";
|
|
||||||
"${modifier}+Shift+4" =
|
|
||||||
"move container to workspace ${ws4}; workspace ${ws4}";
|
|
||||||
"${modifier}+Shift+5" =
|
|
||||||
"move container to workspace ${ws5}; workspace ${ws5}";
|
|
||||||
"${modifier}+Shift+6" =
|
|
||||||
"move container to workspace ${ws6}; workspace ${ws6}";
|
|
||||||
"${modifier}+Shift+7" =
|
|
||||||
"move container to workspace ${ws7}; workspace ${ws7}";
|
|
||||||
"${modifier}+Shift+8" =
|
|
||||||
"move container to workspace ${ws8}; workspace ${ws8}";
|
|
||||||
"${modifier}+Shift+9" =
|
|
||||||
"move container to workspace ${ws9}; workspace ${ws9}";
|
|
||||||
"${modifier}+Shift+0" =
|
|
||||||
"move container to workspace ${ws10}; workspace ${ws10}";
|
|
||||||
|
|
||||||
# Move screens
|
|
||||||
"${modifier}+Control+l" = "move workspace to output right";
|
|
||||||
"${modifier}+Control+h" = "move workspace to output left";
|
|
||||||
|
|
||||||
# Resizing
|
# Resizing
|
||||||
"${modifier}+r" = ''mode "resize"'';
|
"${modifier}+r" = ''mode "resize"'';
|
||||||
"${modifier}+Control+Shift+h" =
|
"${modifier}+Control+Shift+h" =
|
||||||
@ -232,6 +112,7 @@ in {
|
|||||||
notification = false;
|
notification = false;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
terminal = config.terminal;
|
||||||
window = {
|
window = {
|
||||||
border = 0;
|
border = 0;
|
||||||
hideEdgeBorders = "smart";
|
hideEdgeBorders = "smart";
|
||||||
@ -239,22 +120,13 @@ in {
|
|||||||
};
|
};
|
||||||
workspaceAutoBackAndForth = false;
|
workspaceAutoBackAndForth = false;
|
||||||
workspaceOutputAssign = [ ];
|
workspaceOutputAssign = [ ];
|
||||||
# gaps = {
|
|
||||||
# bottom = 8;
|
|
||||||
# top = 8;
|
|
||||||
# left = 8;
|
|
||||||
# right = 8;
|
|
||||||
# horizontal = 15;
|
|
||||||
# vertical = 15;
|
|
||||||
# inner = 15;
|
|
||||||
# outer = 0;
|
|
||||||
# smartBorders = "off";
|
|
||||||
# smartGaps = false;
|
|
||||||
# };
|
|
||||||
};
|
};
|
||||||
extraConfig = "";
|
extraConfig = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
lockScreenCommand =
|
||||||
|
"${pkgs.betterlockscreen}/bin/betterlockscreen --lock --display 1 --blur 0.5 --span";
|
||||||
|
|
||||||
programs.fish.functions = {
|
programs.fish.functions = {
|
||||||
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
update-lock-screen = lib.mkIf config.services.xserver.enable {
|
||||||
description = "Update lockscreen with wallpaper";
|
description = "Update lockscreen with wallpaper";
|
||||||
@ -278,14 +150,14 @@ in {
|
|||||||
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
# Ref: https://github.com/betterlockscreen/betterlockscreen/blob/next/system/betterlockscreen%40.service
|
||||||
systemd.services.lock = {
|
systemd.services.lock = {
|
||||||
enable = config.services.xserver.enable;
|
enable = config.services.xserver.enable;
|
||||||
description = "Lock the screen on resume from suspend";
|
description = "Lock the screen before suspend";
|
||||||
before = [ "sleep.target" "suspend.target" ];
|
before = [ "sleep.target" "suspend.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
User = config.user;
|
User = config.user;
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
Environment = "DISPLAY=:0";
|
Environment = "DISPLAY=:0";
|
||||||
TimeoutSec = "infinity";
|
TimeoutSec = "infinity";
|
||||||
ExecStart = lockCmd;
|
ExecStart = config.lockScreenCommand;
|
||||||
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
ExecStartPost = "${pkgs.coreutils-full}/bin/sleep 1";
|
||||||
};
|
};
|
||||||
wantedBy = [ "sleep.target" "suspend.target" ];
|
wantedBy = [ "sleep.target" "suspend.target" ];
|
||||||
|
100
modules/nixos/graphical/keybinds.nix
Normal file
100
modules/nixos/graphical/keybinds.nix
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
keybindings =
|
||||||
|
config.home-manager.users.${config.user}.programs.sxhkd.keybindings;
|
||||||
|
|
||||||
|
workspaceBindings = let
|
||||||
|
workspaces = {
|
||||||
|
"1" = "1:I";
|
||||||
|
"2" = "2:II";
|
||||||
|
"3" = "3:III";
|
||||||
|
"4" = "4:IV";
|
||||||
|
"5" = "5:V";
|
||||||
|
"6" = "6:VI";
|
||||||
|
"7" = "7:VII";
|
||||||
|
"8" = "8:VIII";
|
||||||
|
"9" = "9:IX";
|
||||||
|
"0" = "10:X";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create an attrset of keybinds to actions for every workspace by number
|
||||||
|
bindAll = keybindFunction: actionFunction:
|
||||||
|
(lib.genAttrs (map keybindFunction (builtins.attrNames workspaces))
|
||||||
|
actionFunction);
|
||||||
|
|
||||||
|
# Look up the name of the workspace based on its number
|
||||||
|
lookup = num: builtins.getAttr num workspaces;
|
||||||
|
|
||||||
|
in (bindAll (num: "super + ${num}")
|
||||||
|
(num: ''${pkgs.i3}/bin/i3-msg "workspace ${lookup num}"''))
|
||||||
|
// (bindAll (num: "super + shift + ${num}") (num:
|
||||||
|
''
|
||||||
|
${pkgs.i3}/bin/i3-msg "move container to workspace ${
|
||||||
|
lookup num
|
||||||
|
}; workspace ${lookup num}"''));
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
home-manager.users.${config.user}.programs.sxhkd = {
|
||||||
|
enable = true;
|
||||||
|
keybindings = {
|
||||||
|
|
||||||
|
# Adjust screen brightness (TODO: replace with pkgs.light?)
|
||||||
|
"shift + {F11,F12}" = ''
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil --display 1 setvcp 10 {- 30,+ 30} && sleep 1; \\
|
||||||
|
${pkgs.ddcutil}/bin/ddcutil --display 2 setvcp 10 {- 30,+ 30}
|
||||||
|
'';
|
||||||
|
"XF86MonBrightness{Down,Up}" = keybindings."shift + {F11,F12}";
|
||||||
|
|
||||||
|
# Media controls
|
||||||
|
"XF86Audio{Play,Stop,Next,Prev}" =
|
||||||
|
"${pkgs.playerctl}/bin/playerctl {play-pause,stop,next,previous}";
|
||||||
|
|
||||||
|
# Window management
|
||||||
|
"super + q" = ''${pkgs.i3}/bin/i3-msg "kill"'';
|
||||||
|
"super + b" = config.toggleBarCommand;
|
||||||
|
"super + f" = ''${pkgs.i3}/bin/i3-msg "fullscreen toggle"'';
|
||||||
|
"super + {h,j,k,l}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "focus {left,down,up,right}"'';
|
||||||
|
"super + {Left,Down,Up,Right}" = keybindings."super + {h,j,k,l}";
|
||||||
|
"super + shift + {h,j,k,l}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move {left,down,up,right}"'';
|
||||||
|
"super + shift + {Left,Down,Up,Right}" =
|
||||||
|
keybindings."super + shift + {h,j,k,l}";
|
||||||
|
|
||||||
|
# Screen management
|
||||||
|
"super + control + l" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move workspace to output right"'';
|
||||||
|
"super + control + h" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "move workspace to output left"'';
|
||||||
|
|
||||||
|
# Window layouts and tiling
|
||||||
|
"super + {i,v}" = ''${pkgs.i3}/bin/i3-msg "split {h,v}"'';
|
||||||
|
"super + {s,t,e}" =
|
||||||
|
''${pkgs.i3}/bin/i3-msg "layout {stacking,tabbed,toggle split}"'';
|
||||||
|
"super + shift + space" = ''${pkgs.i3}/bin/i3-msg "floating toggle"'';
|
||||||
|
"super + control + space" = ''${pkgs.i3}/bin/i3-msg "focus mode_toggle"'';
|
||||||
|
"super + a" = ''${pkgs.i3}/bin/i3-msg "focus parent"'';
|
||||||
|
|
||||||
|
# Launchers
|
||||||
|
"super + Return" = config.terminal;
|
||||||
|
"super + space" = config.launcherCommand;
|
||||||
|
"super + shift + s" = config.systemdSearch;
|
||||||
|
"super + shift + a" = config.audioSwitchCommand;
|
||||||
|
"alt + Tab" = config.altTabCommand;
|
||||||
|
"super + shift + period" = config.powerCommand;
|
||||||
|
"super + shift + m" = config.brightnessCommand;
|
||||||
|
"super + c" = config.calculatorCommand;
|
||||||
|
"super + shift + {c,r}" = ''${pkgs.i3}/bin/i3-msg "{reload,restart}"'';
|
||||||
|
"super + shift + x" = config.lockScreenCommand;
|
||||||
|
"super + alt + h" =
|
||||||
|
"${config.terminal} sh -c '${pkgs.home-manager}/bin/home-manager switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||||
|
"super + alt + r" =
|
||||||
|
"${config.terminal} sh -c 'doas nixos-rebuild switch --flake ${config.dotfilesPath}#${config.networking.hostName} || read'";
|
||||||
|
|
||||||
|
} // workspaceBindings;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
services.picom = {
|
services.picom = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
|
|
||||||
toggleBarCommand = "polybar-msg cmd toggle";
|
toggleBarCommand = "polybar-msg cmd toggle";
|
||||||
|
|
||||||
@ -36,7 +36,7 @@
|
|||||||
module-margin = 1;
|
module-margin = 1;
|
||||||
modules-left = "i3";
|
modules-left = "i3";
|
||||||
modules-center = "xwindow";
|
modules-center = "xwindow";
|
||||||
modules-right = "mailcount pulseaudio date power";
|
modules-right = "mailcount network pulseaudio date power";
|
||||||
cursor-click = "pointer";
|
cursor-click = "pointer";
|
||||||
cursor-scroll = "ns-resize";
|
cursor-scroll = "ns-resize";
|
||||||
enable-ipc = true;
|
enable-ipc = true;
|
||||||
@ -106,8 +106,14 @@
|
|||||||
interval = 10;
|
interval = 10;
|
||||||
format = "<label>";
|
format = "<label>";
|
||||||
exec = builtins.toString (pkgs.writeShellScript "mailcount.sh" ''
|
exec = builtins.toString (pkgs.writeShellScript "mailcount.sh" ''
|
||||||
${pkgs.notmuch}/bin/notmuch new > /dev/null
|
${pkgs.notmuch}/bin/notmuch new --quiet 2>&1>/dev/null
|
||||||
UNREAD=$(${pkgs.notmuch}/bin/notmuch count is:inbox and is:unread and folder:main/Inbox)
|
UNREAD=$(
|
||||||
|
${pkgs.notmuch}/bin/notmuch count \
|
||||||
|
is:inbox and \
|
||||||
|
is:unread and \
|
||||||
|
folder:main/Inbox \
|
||||||
|
2>/dev/null
|
||||||
|
)
|
||||||
if [ $UNREAD = "0" ]; then
|
if [ $UNREAD = "0" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
else
|
else
|
||||||
@ -118,6 +124,16 @@
|
|||||||
"i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
|
"i3-msg 'exec --no-startup-id kitty --class aerc aerc'; sleep 0.15; i3-msg '[class=aerc] focus'";
|
||||||
|
|
||||||
};
|
};
|
||||||
|
"module/network" = {
|
||||||
|
type = "internal/network";
|
||||||
|
interface-type = "wired";
|
||||||
|
interval = 3;
|
||||||
|
accumulate-stats = true;
|
||||||
|
format-connected = "<label-connected>";
|
||||||
|
format-disconnected = "<label-disconnected>";
|
||||||
|
label-connected = "";
|
||||||
|
label-disconnected = "";
|
||||||
|
};
|
||||||
"module/pulseaudio" = {
|
"module/pulseaudio" = {
|
||||||
type = "internal/pulseaudio";
|
type = "internal/pulseaudio";
|
||||||
# format-volume-prefix = "VOL ";
|
# format-volume-prefix = "VOL ";
|
||||||
@ -127,10 +143,10 @@
|
|||||||
# label-volume-background = colors.background;
|
# label-volume-background = colors.background;
|
||||||
format-volume-foreground = config.theme.colors.base0B;
|
format-volume-foreground = config.theme.colors.base0B;
|
||||||
label-volume = "%percentage%%";
|
label-volume = "%percentage%%";
|
||||||
label-muted = "ﱝ ---";
|
label-muted = " ---";
|
||||||
label-muted-foreground = config.theme.colors.base03;
|
label-muted-foreground = config.theme.colors.base03;
|
||||||
ramp-volume-0 = "";
|
ramp-volume-0 = "";
|
||||||
ramp-volume-1 = "墳";
|
ramp-volume-1 = "";
|
||||||
ramp-volume-2 = "";
|
ramp-volume-2 = "";
|
||||||
click-right = config.audioSwitchCommand;
|
click-right = config.audioSwitchCommand;
|
||||||
};
|
};
|
||||||
|
@ -8,11 +8,10 @@ in {
|
|||||||
|
|
||||||
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
|
imports = [ ./rofi/power.nix ./rofi/brightness.nix ];
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.services.xserver.enable) {
|
config = lib.mkIf config.services.xserver.enable {
|
||||||
|
|
||||||
# Set the Rofi-Systemd terminal for viewing logs
|
# Set the Rofi-Systemd terminal for viewing logs
|
||||||
environment.sessionVariables.ROFI_SYSTEMD_TERM =
|
environment.sessionVariables.ROFI_SYSTEMD_TERM = config.terminal;
|
||||||
lib.mkIf config.kitty.enable "${pkgs.kitty}/bin/kitty";
|
|
||||||
|
|
||||||
home-manager.users.${config.user} = {
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
@ -24,6 +23,13 @@ in {
|
|||||||
programs.rofi = {
|
programs.rofi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
cycle = true;
|
cycle = true;
|
||||||
|
extraConfig = {
|
||||||
|
show-icons = true;
|
||||||
|
kb-cancel = "Escape,Super+space";
|
||||||
|
modi = "window,run,ssh,emoji,calc,systemd";
|
||||||
|
sort = true;
|
||||||
|
# levenshtein-sort = true;
|
||||||
|
};
|
||||||
location = "center";
|
location = "center";
|
||||||
pass = { };
|
pass = { };
|
||||||
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ];
|
plugins = [ pkgs.rofi-calc pkgs.rofi-emoji pkgs.rofi-systemd ];
|
||||||
@ -143,15 +149,9 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
terminal = config.terminal;
|
||||||
xoffset = 0;
|
xoffset = 0;
|
||||||
yoffset = -20;
|
yoffset = -20;
|
||||||
extraConfig = {
|
|
||||||
show-icons = true;
|
|
||||||
kb-cancel = "Escape,Super+space";
|
|
||||||
modi = "window,run,ssh,emoji,calc,systemd";
|
|
||||||
sort = true;
|
|
||||||
# levenshtein-sort = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file.".local/share/rofi/themes" = {
|
home.file.".local/share/rofi/themes" = {
|
||||||
|
0
modules/nixos/graphical/rofi/brightness.nix
Executable file → Normal file
0
modules/nixos/graphical/rofi/brightness.nix
Executable file → Normal file
0
modules/nixos/graphical/rofi/power.nix
Executable file → Normal file
0
modules/nixos/graphical/rofi/power.nix
Executable file → Normal file
25
modules/nixos/graphical/sway.nix
Normal file
25
modules/nixos/graphical/sway.nix
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
|
config = lib.mkIf config.gui.enable {
|
||||||
|
|
||||||
|
programs.sway = {
|
||||||
|
enable = true;
|
||||||
|
package = null; # Use home-manager Sway instead
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.${config.user} = {
|
||||||
|
|
||||||
|
wayland.windowManager.sway = {
|
||||||
|
enable = true;
|
||||||
|
config =
|
||||||
|
config.home-manager.users.${config.user}.xsession.windowManager.i3.config;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
# TODO: swaybg
|
||||||
|
# TODO: swaylock
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
boot.loader = lib.mkIf config.physical {
|
boot.loader = lib.mkIf (config.physical && !config.server) {
|
||||||
grub = {
|
grub = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
|
@ -15,7 +15,12 @@
|
|||||||
# Use capslock as escape and/or control
|
# Use capslock as escape and/or control
|
||||||
services.keyd = {
|
services.keyd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = { main = { capslock = "overload(control, esc)"; }; };
|
keyboards = {
|
||||||
|
default = {
|
||||||
|
ids = [ "*" ];
|
||||||
|
settings = { main = { capslock = "overload(control, esc)"; }; };
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Enable num lock on login
|
# Enable num lock on login
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf config.physical {
|
config = lib.mkIf config.physical {
|
||||||
|
|
||||||
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
|
networking.useDHCP = true;
|
||||||
# Per-interface useDHCP will be mandatory in the future, so this generated config
|
|
||||||
# replicates the default behaviour.
|
|
||||||
networking.useDHCP = false;
|
|
||||||
networking.interfaces.enp5s0.useDHCP = true;
|
|
||||||
networking.interfaces.wlp4s0.useDHCP = true;
|
|
||||||
|
|
||||||
networking.firewall.allowPing = lib.mkIf config.server true;
|
networking.firewall.allowPing = lib.mkIf config.server true;
|
||||||
|
|
||||||
@ -15,6 +10,9 @@
|
|||||||
services.avahi = {
|
services.avahi = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domainName = "local";
|
domainName = "local";
|
||||||
|
ipv6 = false; # Should work either way
|
||||||
|
# Resolve local hostnames using Avahi DNS
|
||||||
|
nssmdns = true;
|
||||||
publish = {
|
publish = {
|
||||||
enable = true;
|
enable = true;
|
||||||
addresses = true;
|
addresses = true;
|
||||||
@ -23,8 +21,10 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Resolve local hostnames using Avahi DNS
|
environment.systemPackages = [
|
||||||
services.avahi.nssmdns = true;
|
(pkgs.writeShellScriptBin "wake-tempest"
|
||||||
|
"${pkgs.wakeonlan}/bin/wakeonlan --ip=192.168.1.255 74:56:3C:40:37:5D")
|
||||||
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux && config.server) {
|
config = lib.mkIf config.server {
|
||||||
|
|
||||||
# Servers need a bootloader or they won't start
|
# Servers need a bootloader or they won't start
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot.loader.systemd-boot.enable = true;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
config = lib.mkIf config.physical {
|
config = lib.mkIf (config.physical && !config.server) {
|
||||||
|
|
||||||
# Prevent wake from keyboard
|
# Prevent wake from keyboard
|
||||||
powerManagement.powerDownCommands = ''
|
powerManagement.powerDownCommands = ''
|
||||||
|
@ -1,16 +1,21 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
options = { zfs.enable = lib.mkEnableOption "ZFS file system."; };
|
options = { zfs.enable = lib.mkEnableOption "ZFS file system."; };
|
||||||
|
|
||||||
config =
|
config = lib.mkIf (config.server && config.zfs.enable) {
|
||||||
lib.mkIf (pkgs.stdenv.isLinux && config.server && config.zfs.enable) {
|
|
||||||
|
|
||||||
# Only use compatible Linux kernel, since ZFS can be behind
|
# Only use compatible Linux kernel, since ZFS can be behind
|
||||||
boot.kernelPackages =
|
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||||
config.boot.zfs.package.latestCompatibleLinuxPackages;
|
boot.kernelParams = [ "nohibernate" ];
|
||||||
boot.kernelParams = [ "nohibernate" ];
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
boot.supportedFilesystems = [ "zfs" ];
|
services.prometheus.exporters.zfs.enable =
|
||||||
|
config.prometheus.exporters.enable;
|
||||||
|
prometheus.scrapeTargets = [
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.prometheus.exporters.zfs.port
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,35 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
options = {
|
let
|
||||||
arrServer = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
arrConfig = {
|
||||||
description = "Hostname for arr services";
|
radarr = {
|
||||||
default = null;
|
exportarrPort = "9707";
|
||||||
|
url = "localhost:7878";
|
||||||
|
apiKey = config.secrets.radarrApiKey.dest;
|
||||||
|
};
|
||||||
|
sonarr = {
|
||||||
|
exportarrPort = "9708";
|
||||||
|
url = "localhost:8989";
|
||||||
|
apiKey = config.secrets.sonarrApiKey.dest;
|
||||||
|
};
|
||||||
|
prowlarr = {
|
||||||
|
exportarrPort = "9709";
|
||||||
|
url = "localhost:9696";
|
||||||
|
apiKey = config.secrets.prowlarrApiKey.dest;
|
||||||
|
};
|
||||||
|
sabnzbd = {
|
||||||
|
exportarrPort = "9710";
|
||||||
|
url = "localhost:8085";
|
||||||
|
apiKey = config.secrets.sabnzbdApiKey.dest;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.arrServer != null) {
|
in {
|
||||||
|
|
||||||
|
options = { arrs.enable = lib.mkEnableOption "Arr services"; };
|
||||||
|
|
||||||
|
config = lib.mkIf config.arrs.enable {
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
bazarr = {
|
bazarr = {
|
||||||
@ -44,29 +65,29 @@
|
|||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{
|
match = [{
|
||||||
host = [ config.arrServer ];
|
host = [ config.hostnames.download ];
|
||||||
path = [ "/sonarr*" ];
|
path = [ "/sonarr*" ];
|
||||||
}];
|
}];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:8989"; }];
|
upstreams = [{ dial = arrConfig.sonarr.url; }];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{
|
match = [{
|
||||||
host = [ config.arrServer ];
|
host = [ config.hostnames.download ];
|
||||||
path = [ "/radarr*" ];
|
path = [ "/radarr*" ];
|
||||||
}];
|
}];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:7878"; }];
|
upstreams = [{ dial = arrConfig.radarr.url; }];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{
|
match = [{
|
||||||
host = [ config.arrServer ];
|
host = [ config.hostnames.download ];
|
||||||
path = [ "/prowlarr*" ];
|
path = [ "/prowlarr*" ];
|
||||||
}];
|
}];
|
||||||
handle = [{
|
handle = [{
|
||||||
@ -77,35 +98,111 @@
|
|||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{
|
match = [{
|
||||||
host = [ config.arrServer ];
|
host = [ config.hostnames.download ];
|
||||||
path = [ "/bazarr*" ];
|
path = [ "/bazarr*" ];
|
||||||
}];
|
}];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:6767"; }];
|
upstreams = [{
|
||||||
|
dial = "localhost:${
|
||||||
|
builtins.toString config.services.bazarr.listenPort
|
||||||
|
}";
|
||||||
|
}];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{
|
match = [{
|
||||||
host = [ config.arrServer ];
|
host = [ config.hostnames.download ];
|
||||||
path = [ "/sabnzbd*" ];
|
path = [ "/sabnzbd*" ];
|
||||||
}];
|
}];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:8085"; }];
|
upstreams = [{ dial = arrConfig.sabnzbd.url; }];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
group = "download";
|
group = "download";
|
||||||
match = [{ host = [ config.arrServer ]; }];
|
match = [{ host = [ config.hostnames.download ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:5055"; }];
|
upstreams = [{
|
||||||
|
dial =
|
||||||
|
"localhost:${builtins.toString config.services.jellyseerr.port}";
|
||||||
|
}];
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# Enable Prometheus exporters
|
||||||
|
systemd.services = lib.mapAttrs' (name: attrs: {
|
||||||
|
name = "prometheus-${name}-exporter";
|
||||||
|
value = {
|
||||||
|
description = "Export Prometheus metrics for ${name}";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
wantedBy = [ "${name}.service" ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "simple";
|
||||||
|
DynamicUser = true;
|
||||||
|
ExecStart = let
|
||||||
|
url = if name != "sabnzbd" then
|
||||||
|
"http://${attrs.url}/${name}"
|
||||||
|
else
|
||||||
|
"http://${attrs.url}";
|
||||||
|
in ''
|
||||||
|
${pkgs.exportarr}/bin/exportarr ${name} \
|
||||||
|
--url ${url} \
|
||||||
|
--port ${attrs.exportarrPort}'';
|
||||||
|
EnvironmentFile =
|
||||||
|
lib.mkIf (builtins.hasAttr "apiKey" attrs) attrs.apiKey;
|
||||||
|
Restart = "on-failure";
|
||||||
|
ProtectHome = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
PrivateTmp = true;
|
||||||
|
PrivateDevices = true;
|
||||||
|
ProtectHostname = true;
|
||||||
|
ProtectClock = true;
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectKernelModules = true;
|
||||||
|
ProtectKernelLogs = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
RestrictRealtime = true;
|
||||||
|
RestrictSUIDSGID = true;
|
||||||
|
RemoveIPC = true;
|
||||||
|
PrivateMounts = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}) arrConfig;
|
||||||
|
|
||||||
|
# Secrets for Prometheus exporters
|
||||||
|
secrets.radarrApiKey = {
|
||||||
|
source = ../../../private/radarr-api-key.age;
|
||||||
|
dest = "/var/private/radarr-api";
|
||||||
|
prefix = "API_KEY=";
|
||||||
|
};
|
||||||
|
secrets.sonarrApiKey = {
|
||||||
|
source = ../../../private/sonarr-api-key.age;
|
||||||
|
dest = "/var/private/sonarr-api";
|
||||||
|
prefix = "API_KEY=";
|
||||||
|
};
|
||||||
|
secrets.prowlarrApiKey = {
|
||||||
|
source = ../../../private/prowlarr-api-key.age;
|
||||||
|
dest = "/var/private/prowlarr-api";
|
||||||
|
prefix = "API_KEY=";
|
||||||
|
};
|
||||||
|
secrets.sabnzbdApiKey = {
|
||||||
|
source = ../../../private/sabnzbd-api-key.age;
|
||||||
|
dest = "/var/private/sabnzbd-api";
|
||||||
|
prefix = "API_KEY=";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Prometheus scrape targets
|
||||||
|
prometheus.scrapeTargets = map (key:
|
||||||
|
"127.0.0.1:${
|
||||||
|
lib.attrsets.getAttrFromPath [ key "exportarrPort" ] arrConfig
|
||||||
|
}") (builtins.attrNames arrConfig);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
55
modules/nixos/services/bind.nix
Normal file
55
modules/nixos/services/bind.nix
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
localIp = "192.168.1.218";
|
||||||
|
localServices = [
|
||||||
|
config.hostnames.stream
|
||||||
|
config.hostnames.content
|
||||||
|
config.hostnames.books
|
||||||
|
config.hostnames.download
|
||||||
|
];
|
||||||
|
mkRecord = service: "${service} A ${localIp}";
|
||||||
|
localRecords = lib.concatLines (map mkRecord localServices);
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.bind.enable {
|
||||||
|
|
||||||
|
caddy.cidrAllowlist = [ "192.168.0.0/16" ];
|
||||||
|
|
||||||
|
services.bind = {
|
||||||
|
cacheNetworks = [ "127.0.0.0/24" "192.168.0.0/16" ];
|
||||||
|
forwarders = [ "1.1.1.1" "1.0.0.1" ];
|
||||||
|
ipv4Only = true;
|
||||||
|
|
||||||
|
# Use rpz zone as an override
|
||||||
|
extraOptions = ''response-policy { zone "rpz"; };'';
|
||||||
|
|
||||||
|
zones = {
|
||||||
|
rpz = {
|
||||||
|
master = true;
|
||||||
|
file = pkgs.writeText "db.rpz" ''
|
||||||
|
$TTL 60 ; 1 minute
|
||||||
|
@ IN SOA localhost. root.localhost. (
|
||||||
|
2023071800 ; serial
|
||||||
|
1h ; refresh
|
||||||
|
30m ; retry
|
||||||
|
1w ; expire
|
||||||
|
30m ; minimum ttl
|
||||||
|
)
|
||||||
|
IN NS localhost.
|
||||||
|
localhost A 127.0.0.1
|
||||||
|
${localRecords}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = [ 53 ];
|
||||||
|
networking.firewall.allowedUDPPorts = [ 53 ];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,28 +1,43 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
caddy.enable = lib.mkEnableOption "Caddy reverse proxy.";
|
caddy = {
|
||||||
caddy.tlsPolicies = lib.mkOption {
|
tlsPolicies = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.attrs;
|
type = lib.types.listOf lib.types.attrs;
|
||||||
description = "Caddy JSON TLS policies";
|
description = "Caddy JSON TLS policies";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
caddy.routes = lib.mkOption {
|
routes = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.attrs;
|
type = lib.types.listOf lib.types.attrs;
|
||||||
description = "Caddy JSON routes for http servers";
|
description = "Caddy JSON routes for http servers";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
caddy.blocks = lib.mkOption {
|
blocks = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.attrs;
|
type = lib.types.listOf lib.types.attrs;
|
||||||
description = "Caddy JSON error blocks for http servers";
|
description = "Caddy JSON error blocks for http servers";
|
||||||
default = [ ];
|
default = [ ];
|
||||||
|
};
|
||||||
|
cidrAllowlist = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
description = "CIDR blocks to allow for requests";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.caddy.enable && config.caddy.routes != [ ]) {
|
config = lib.mkIf config.services.caddy.enable {
|
||||||
|
|
||||||
|
# Force Caddy to 403 if not coming from allowlisted source
|
||||||
|
caddy.cidrAllowlist = [ "127.0.0.1/32" ];
|
||||||
|
caddy.routes = [{
|
||||||
|
match = [{ not = [{ remote_ip.ranges = config.caddy.cidrAllowlist; }]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
status_code = "403";
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
services.caddy = {
|
services.caddy = {
|
||||||
enable = true;
|
|
||||||
adapter = "''"; # Required to enable JSON
|
adapter = "''"; # Required to enable JSON
|
||||||
configFile = pkgs.writeText "Caddyfile" (builtins.toJSON {
|
configFile = pkgs.writeText "Caddyfile" (builtins.toJSON {
|
||||||
apps.http.servers.main = {
|
apps.http.servers.main = {
|
||||||
@ -31,6 +46,7 @@
|
|||||||
errors.routes = config.caddy.blocks;
|
errors.routes = config.caddy.blocks;
|
||||||
# logs = { }; # Uncomment to collect access logs
|
# logs = { }; # Uncomment to collect access logs
|
||||||
};
|
};
|
||||||
|
apps.http.servers.metrics = { }; # Enables Prometheus metrics
|
||||||
apps.tls.automation.policies = config.caddy.tlsPolicies;
|
apps.tls.automation.policies = config.caddy.tlsPolicies;
|
||||||
logging.logs.main = {
|
logging.logs.main = {
|
||||||
encoder = { format = "console"; };
|
encoder = { format = "console"; };
|
||||||
@ -48,6 +64,8 @@
|
|||||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
networking.firewall.allowedUDPPorts = [ 443 ];
|
networking.firewall.allowedUDPPorts = [ 443 ];
|
||||||
|
|
||||||
|
prometheus.scrapeTargets = [ "127.0.0.1:2019" ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,6 @@ let
|
|||||||
in {
|
in {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
bookServer = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "Hostname for Calibre library";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
backups.calibre = lib.mkOption {
|
backups.calibre = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
description = "Whether to backup Calibre library";
|
description = "Whether to backup Calibre library";
|
||||||
@ -19,10 +14,9 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.bookServer != null) {
|
config = lib.mkIf config.services.calibre-web.enable {
|
||||||
|
|
||||||
services.calibre-web = {
|
services.calibre-web = {
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
options = {
|
options = {
|
||||||
reverseProxyAuth.enable = false;
|
reverseProxyAuth.enable = false;
|
||||||
@ -33,7 +27,7 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
caddy.routes = [{
|
caddy.routes = [{
|
||||||
match = [{ host = [ config.bookServer ]; }];
|
match = [{ host = [ config.hostnames.books ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:8083"; }];
|
upstreams = [{ dial = "localhost:8083"; }];
|
||||||
|
@ -10,6 +10,11 @@
|
|||||||
# Set tunnel.id = "<id>"
|
# Set tunnel.id = "<id>"
|
||||||
# Remove ~/.cloudflared/
|
# Remove ~/.cloudflared/
|
||||||
|
|
||||||
|
# For SSH access:
|
||||||
|
# Cloudflare Zero Trust -> Access -> Applications -> Create Application
|
||||||
|
# Service Auth -> SSH -> Select Application -> Generate Certificate
|
||||||
|
# Set ca = "<public key>"
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
options.cloudflareTunnel = {
|
options.cloudflareTunnel = {
|
||||||
|
@ -41,13 +41,7 @@ in {
|
|||||||
config = lib.mkIf config.cloudflare.enable {
|
config = lib.mkIf config.cloudflare.enable {
|
||||||
|
|
||||||
# Forces Caddy to error if coming from a non-Cloudflare IP
|
# Forces Caddy to error if coming from a non-Cloudflare IP
|
||||||
caddy.blocks = [{
|
caddy.cidrAllowlist = cloudflareIpRanges;
|
||||||
match = [{ not = [{ remote_ip.ranges = cloudflareIpRanges; }]; }];
|
|
||||||
handle = [{
|
|
||||||
handler = "static_response";
|
|
||||||
abort = true;
|
|
||||||
}];
|
|
||||||
}];
|
|
||||||
|
|
||||||
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
|
# Tell Caddy to use Cloudflare DNS for ACME challenge validation
|
||||||
services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix {
|
services.caddy.package = (pkgs.callPackage ../../../overlays/caddy.nix {
|
||||||
|
@ -3,12 +3,15 @@
|
|||||||
imports = [
|
imports = [
|
||||||
./arr.nix
|
./arr.nix
|
||||||
./backups.nix
|
./backups.nix
|
||||||
|
./bind.nix
|
||||||
./caddy.nix
|
./caddy.nix
|
||||||
./calibre.nix
|
./calibre.nix
|
||||||
./cloudflare-tunnel.nix
|
./cloudflare-tunnel.nix
|
||||||
./cloudflare.nix
|
./cloudflare.nix
|
||||||
|
./gitea-runner.nix
|
||||||
./gitea.nix
|
./gitea.nix
|
||||||
./gnupg.nix
|
./gnupg.nix
|
||||||
|
./grafana.nix
|
||||||
./honeypot.nix
|
./honeypot.nix
|
||||||
./jellyfin.nix
|
./jellyfin.nix
|
||||||
./keybase.nix
|
./keybase.nix
|
||||||
@ -22,6 +25,7 @@
|
|||||||
./sshd.nix
|
./sshd.nix
|
||||||
./transmission.nix
|
./transmission.nix
|
||||||
./vaultwarden.nix
|
./vaultwarden.nix
|
||||||
|
./victoriametrics.nix
|
||||||
./wireguard.nix
|
./wireguard.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
|
58
modules/nixos/services/gitea-runner.nix
Normal file
58
modules/nixos/services/gitea-runner.nix
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
options.giteaRunner.enable =
|
||||||
|
lib.mkEnableOption "Enable Gitea Actions runner.";
|
||||||
|
|
||||||
|
config = lib.mkIf config.giteaRunner.enable {
|
||||||
|
|
||||||
|
services.gitea-actions-runner.instances.${config.networking.hostName} = {
|
||||||
|
enable = true;
|
||||||
|
labels = [
|
||||||
|
# Provide a Debian base with NodeJS for actions
|
||||||
|
# "debian-latest:docker://node:18-bullseye"
|
||||||
|
# Fake the Ubuntu name, because Node provides no Ubuntu builds
|
||||||
|
# "ubuntu-latest:docker://node:18-bullseye"
|
||||||
|
# Provide native execution on the host using below packages
|
||||||
|
"native:host"
|
||||||
|
];
|
||||||
|
hostPackages = with pkgs; [
|
||||||
|
bash
|
||||||
|
coreutils
|
||||||
|
curl
|
||||||
|
gawk
|
||||||
|
gitMinimal
|
||||||
|
gnused
|
||||||
|
nodejs
|
||||||
|
wget
|
||||||
|
];
|
||||||
|
name = config.networking.hostName;
|
||||||
|
url = "https://${config.hostnames.git}";
|
||||||
|
tokenFile = config.secrets.giteaRunnerToken.dest;
|
||||||
|
};
|
||||||
|
|
||||||
|
# Make sure the runner doesn't start until after Gitea
|
||||||
|
systemd.services."gitea-runner-${config.networking.hostName}".after =
|
||||||
|
[ "gitea.service" ];
|
||||||
|
|
||||||
|
# API key needed to connect to Gitea
|
||||||
|
secrets.giteaRunnerToken = {
|
||||||
|
source = ../../../private/gitea-runner-token.age; # TOKEN=xyz
|
||||||
|
dest = "${config.secretsDirectory}/gitea-runner-token";
|
||||||
|
};
|
||||||
|
systemd.services.giteaRunnerToken-secret = {
|
||||||
|
requiredBy = [
|
||||||
|
"gitea-runner-${
|
||||||
|
config.services.gitea-actions-runner.instances.${config.networking.hostName}.name
|
||||||
|
}.service"
|
||||||
|
];
|
||||||
|
before = [
|
||||||
|
"gitea-runner-${
|
||||||
|
config.services.gitea-actions-runner.instances.${config.networking.hostName}.name
|
||||||
|
}.service"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,28 +1,19 @@
|
|||||||
{ config, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
let giteaPath = "/var/lib/gitea"; # Default service directory
|
let giteaPath = "/var/lib/gitea"; # Default service directory
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options = {
|
config = lib.mkIf config.services.gitea.enable {
|
||||||
|
|
||||||
giteaServer = lib.mkOption {
|
|
||||||
description = "Hostname for Gitea.";
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf (config.giteaServer != null) {
|
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
|
||||||
database.type = "sqlite3";
|
database.type = "sqlite3";
|
||||||
settings = {
|
settings = {
|
||||||
|
actions.ENABLED = true;
|
||||||
|
metrics.ENABLED = true;
|
||||||
repository = {
|
repository = {
|
||||||
DEFAULT_PUSH_CREATE_PRIVATE = true;
|
DEFAULT_PUSH_CREATE_PRIVATE = true;
|
||||||
DISABLE_HTTP_GIT = false;
|
DISABLE_HTTP_GIT = false;
|
||||||
ACCESS_CONTROL_ALLOW_ORIGIN = config.giteaServer;
|
ACCESS_CONTROL_ALLOW_ORIGIN = config.hostnames.git;
|
||||||
ENABLE_PUSH_CREATE_USER = true;
|
ENABLE_PUSH_CREATE_USER = true;
|
||||||
ENABLE_PUSH_CREATE_ORG = true;
|
ENABLE_PUSH_CREATE_ORG = true;
|
||||||
DEFAULT_BRANCH = "main";
|
DEFAULT_BRANCH = "main";
|
||||||
@ -30,7 +21,7 @@ in {
|
|||||||
server = {
|
server = {
|
||||||
HTTP_PORT = 3001;
|
HTTP_PORT = 3001;
|
||||||
HTTP_ADDRESS = "127.0.0.1";
|
HTTP_ADDRESS = "127.0.0.1";
|
||||||
ROOT_URL = "https://${config.giteaServer}/";
|
ROOT_URL = "https://${config.hostnames.git}/";
|
||||||
SSH_PORT = 22;
|
SSH_PORT = 22;
|
||||||
START_SSH_SERVER = false; # Use sshd instead
|
START_SSH_SERVER = false; # Use sshd instead
|
||||||
DISABLE_SSH = false;
|
DISABLE_SSH = false;
|
||||||
@ -45,14 +36,38 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 122 ];
|
networking.firewall.allowedTCPPorts = [ 122 ];
|
||||||
|
users.users.${config.user}.extraGroups = [ "gitea" ];
|
||||||
|
|
||||||
caddy.routes = [{
|
caddy.routes = [
|
||||||
match = [{ host = [ config.giteaServer ]; }];
|
{
|
||||||
handle = [{
|
match = [{
|
||||||
handler = "reverse_proxy";
|
host = [ config.hostnames.git ];
|
||||||
upstreams = [{ dial = "localhost:3001"; }];
|
path = [ "/metrics*" ];
|
||||||
}];
|
}];
|
||||||
}];
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
status_code = "403";
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
match = [{ host = [ config.hostnames.git ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
upstreams = [{
|
||||||
|
dial = "localhost:${
|
||||||
|
builtins.toString
|
||||||
|
config.services.gitea.settings.server.HTTP_PORT
|
||||||
|
}";
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
prometheus.scrapeTargets = [
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.gitea.settings.server.HTTP_PORT
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
|
||||||
## Backup config
|
## Backup config
|
||||||
|
|
||||||
@ -85,6 +100,34 @@ in {
|
|||||||
requires = [ "gitea.service" ];
|
requires = [ "gitea.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Run a repository file backup on a schedule
|
||||||
|
systemd.timers.gitea-backup = lib.mkIf (config.backup.s3.endpoint != null) {
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar = "*-*-* 00:00:00"; # Once per day
|
||||||
|
Unit = "gitea-backup.service";
|
||||||
|
};
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
# Backup Gitea repos to object storage
|
||||||
|
systemd.services.gitea-backup =
|
||||||
|
lib.mkIf (config.backup.s3.endpoint != null) {
|
||||||
|
description = "Backup Gitea data";
|
||||||
|
environment.AWS_ACCESS_KEY_ID = config.backup.s3.accessKeyId;
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
User = "gitea";
|
||||||
|
Group = "backup";
|
||||||
|
EnvironmentFile = config.secrets.backup.dest;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
${pkgs.awscli2}/bin/aws s3 sync --exclude */gitea.db* \
|
||||||
|
${giteaPath}/ \
|
||||||
|
s3://${config.backup.s3.bucket}/gitea-data/ \
|
||||||
|
--endpoint-url=https://${config.backup.s3.endpoint}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
27
modules/nixos/services/grafana.nix
Normal file
27
modules/nixos/services/grafana.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
|
config = lib.mkIf config.services.grafana.enable {
|
||||||
|
|
||||||
|
services.grafana.settings.server = {
|
||||||
|
domain = config.hostnames.metrics;
|
||||||
|
http_addr = "127.0.0.1";
|
||||||
|
http_port = 3000;
|
||||||
|
protocol = "http";
|
||||||
|
};
|
||||||
|
|
||||||
|
caddy.routes = [{
|
||||||
|
match = [{ host = [ config.hostnames.metrics ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
upstreams = [{
|
||||||
|
dial = "localhost:${
|
||||||
|
builtins.toString
|
||||||
|
config.services.grafana.settings.server.http_port
|
||||||
|
}";
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -1,26 +1,29 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
options = {
|
config = lib.mkIf config.services.jellyfin.enable {
|
||||||
streamServer = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "Hostname for Jellyfin library";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf (config.streamServer != null) {
|
|
||||||
|
|
||||||
services.jellyfin.enable = true;
|
|
||||||
services.jellyfin.group = "media";
|
services.jellyfin.group = "media";
|
||||||
users.users.jellyfin = { isSystemUser = true; };
|
users.users.jellyfin = { isSystemUser = true; };
|
||||||
|
|
||||||
caddy.routes = [{
|
caddy.routes = [
|
||||||
match = [{ host = [ config.streamServer ]; }];
|
{
|
||||||
handle = [{
|
match = [{
|
||||||
handler = "reverse_proxy";
|
host = [ config.hostnames.stream ];
|
||||||
upstreams = [{ dial = "localhost:8096"; }];
|
path = [ "/metrics*" ];
|
||||||
}];
|
}];
|
||||||
}];
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
status_code = "403";
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
match = [{ host = [ config.hostnames.stream ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
upstreams = [{ dial = "localhost:8096"; }];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
# Create videos directory, allow anyone in Jellyfin group to manage it
|
# Create videos directory, allow anyone in Jellyfin group to manage it
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
@ -44,6 +47,9 @@
|
|||||||
users.users.jellyfin.extraGroups =
|
users.users.jellyfin.extraGroups =
|
||||||
[ "render" "video" ]; # Access to /dev/dri
|
[ "render" "video" ]; # Access to /dev/dri
|
||||||
|
|
||||||
|
# Requires MetricsEnable is true in /var/lib/jellyfin/config/system.xml
|
||||||
|
prometheus.scrapeTargets = [ "127.0.0.1:8096" ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,43 +1,134 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
options = {
|
config = lib.mkIf config.services.nextcloud.enable {
|
||||||
|
|
||||||
nextcloudServer = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
description = "Hostname for Nextcloud";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf (config.nextcloudServer != null) {
|
|
||||||
|
|
||||||
services.nextcloud = {
|
services.nextcloud = {
|
||||||
enable = true;
|
package = pkgs.nextcloud27; # Required to specify
|
||||||
package = pkgs.nextcloud26; # Required to specify
|
|
||||||
datadir = "/data/nextcloud";
|
datadir = "/data/nextcloud";
|
||||||
https = true;
|
https = true;
|
||||||
hostName = "localhost";
|
hostName = "localhost";
|
||||||
maxUploadSize = "50G";
|
maxUploadSize = "50G";
|
||||||
config = {
|
config = {
|
||||||
adminpassFile = config.secrets.nextcloud.dest;
|
adminpassFile = config.secrets.nextcloud.dest;
|
||||||
extraTrustedDomains = [ config.nextcloudServer ];
|
extraTrustedDomains = [ config.hostnames.content ];
|
||||||
|
trustedProxies = [ "127.0.0.1" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Don't let Nginx use main ports (using Caddy instead)
|
# Don't let Nginx use main ports (using Caddy instead)
|
||||||
services.nginx.virtualHosts."localhost".listen = [{
|
services.nginx.enable = false;
|
||||||
addr = "127.0.0.1";
|
|
||||||
port = 8080;
|
services.phpfpm.pools.nextcloud.settings = {
|
||||||
}];
|
"listen.owner" = config.services.caddy.user;
|
||||||
|
"listen.group" = config.services.caddy.group;
|
||||||
|
};
|
||||||
|
users.users.caddy.extraGroups = [ "nextcloud" ];
|
||||||
|
|
||||||
# Point Caddy to Nginx
|
# Point Caddy to Nginx
|
||||||
caddy.routes = [{
|
caddy.routes = [{
|
||||||
match = [{ host = [ config.nextcloudServer ]; }];
|
match = [{ host = [ config.hostnames.content ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "subroute";
|
||||||
upstreams = [{ dial = "localhost:8080"; }];
|
routes = [
|
||||||
|
# Sets variables and headers
|
||||||
|
{
|
||||||
|
handle = [
|
||||||
|
{
|
||||||
|
handler = "vars";
|
||||||
|
root = config.services.nextcloud.package;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
handler = "headers";
|
||||||
|
response.set.Strict-Transport-Security =
|
||||||
|
[ "max-age=31536000;" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{
|
||||||
|
match = [{ path = [ "/nix-apps*" "/store-apps*" ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "vars";
|
||||||
|
root = config.services.nextcloud.home;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Reroute carddav and caldav traffic
|
||||||
|
{
|
||||||
|
match =
|
||||||
|
[{ path = [ "/.well-known/carddav" "/.well-known/caldav" ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
headers = { Location = [ "/remote.php/dav" ]; };
|
||||||
|
status_code = 301;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Block traffic to sensitive files
|
||||||
|
{
|
||||||
|
match = [{
|
||||||
|
path = [
|
||||||
|
"/.htaccess"
|
||||||
|
"/data/*"
|
||||||
|
"/config/*"
|
||||||
|
"/db_structure"
|
||||||
|
"/.xml"
|
||||||
|
"/README"
|
||||||
|
"/3rdparty/*"
|
||||||
|
"/lib/*"
|
||||||
|
"/templates/*"
|
||||||
|
"/occ"
|
||||||
|
"/console.php"
|
||||||
|
];
|
||||||
|
}];
|
||||||
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
status_code = 404;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Redirect index.php to the homepage
|
||||||
|
{
|
||||||
|
match = [{
|
||||||
|
file = { try_files = [ "{http.request.uri.path}/index.php" ]; };
|
||||||
|
not = [{ path = [ "*/" ]; }];
|
||||||
|
}];
|
||||||
|
handle = [{
|
||||||
|
handler = "static_response";
|
||||||
|
headers = { Location = [ "{http.request.orig_uri.path}/" ]; };
|
||||||
|
status_code = 308;
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Rewrite paths to be relative
|
||||||
|
{
|
||||||
|
match = [{
|
||||||
|
file = {
|
||||||
|
split_path = [ ".php" ];
|
||||||
|
try_files = [
|
||||||
|
"{http.request.uri.path}"
|
||||||
|
"{http.request.uri.path}/index.php"
|
||||||
|
"index.php"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
handle = [{
|
||||||
|
handler = "rewrite";
|
||||||
|
uri = "{http.matchers.file.relative}";
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Send all PHP traffic to Nextcloud PHP service
|
||||||
|
{
|
||||||
|
match = [{ path = [ "*.php" ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
transport = {
|
||||||
|
protocol = "fastcgi";
|
||||||
|
split_path = [ ".php" ];
|
||||||
|
};
|
||||||
|
upstreams = [{ dial = "unix//run/phpfpm/nextcloud.sock"; }];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
# Finally, send the rest to the file server
|
||||||
|
{ handle = [{ handler = "file_server"; }]; }
|
||||||
|
];
|
||||||
}];
|
}];
|
||||||
|
terminal = true;
|
||||||
}];
|
}];
|
||||||
|
|
||||||
# Create credentials file for nextcloud
|
# Create credentials file for nextcloud
|
||||||
@ -85,6 +176,24 @@
|
|||||||
requires = [ "phpfpm-nextcloud.service" ];
|
requires = [ "phpfpm-nextcloud.service" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Log metrics to prometheus
|
||||||
|
networking.hosts."127.0.0.1" = [ config.hostnames.content ];
|
||||||
|
services.prometheus.exporters.nextcloud = {
|
||||||
|
enable = config.prometheus.exporters.enable;
|
||||||
|
username = config.services.nextcloud.config.adminuser;
|
||||||
|
url = "https://${config.hostnames.content}";
|
||||||
|
passwordFile = config.services.nextcloud.config.adminpassFile;
|
||||||
|
};
|
||||||
|
prometheus.scrapeTargets = [
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.prometheus.exporters.nextcloud.port
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
# Allows nextcloud-exporter to read passwordFile
|
||||||
|
users.users.nextcloud-exporter.extraGroups =
|
||||||
|
lib.mkIf config.services.prometheus.exporters.nextcloud.enable
|
||||||
|
[ "nextcloud" ];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,32 +1,103 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
options.metricsServer = lib.mkOption {
|
options.prometheus = {
|
||||||
type = lib.types.nullOr lib.types.str;
|
exporters.enable = lib.mkEnableOption "Enable Prometheus exporters";
|
||||||
description = "Hostname of the Grafana server.";
|
scrapeTargets = lib.mkOption {
|
||||||
default = null;
|
type = lib.types.listOf lib.types.str;
|
||||||
|
description = "Prometheus scrape targets";
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.metricsServer != null) {
|
config = let
|
||||||
|
|
||||||
services.grafana.enable = true;
|
# If hosting Grafana, host local Prometheus and listen for inbound jobs. If
|
||||||
|
# not hosting Grafana, send remote Prometheus writes to primary host.
|
||||||
|
isServer = config.services.grafana.enable;
|
||||||
|
|
||||||
# Required to fix error in latest nixpkgs
|
in {
|
||||||
services.grafana.settings = { };
|
|
||||||
|
# Turn on exporters if any Prometheus scraper is running
|
||||||
|
prometheus.exporters.enable = builtins.any (x: x) [
|
||||||
|
config.services.prometheus.enable
|
||||||
|
config.services.victoriametrics.enable
|
||||||
|
config.services.vmagent.enable
|
||||||
|
];
|
||||||
|
|
||||||
|
prometheus.scrapeTargets = [
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.prometheus.exporters.node.port
|
||||||
|
}"
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.prometheus.exporters.systemd.port
|
||||||
|
}"
|
||||||
|
"127.0.0.1:${
|
||||||
|
builtins.toString config.services.prometheus.exporters.process.port
|
||||||
|
}"
|
||||||
|
];
|
||||||
|
|
||||||
services.prometheus = {
|
services.prometheus = {
|
||||||
enable = true;
|
exporters.node.enable = config.prometheus.exporters.enable;
|
||||||
exporters.node.enable = true;
|
exporters.node.enabledCollectors = [ ];
|
||||||
|
exporters.node.disabledCollectors = [ "cpufreq" ];
|
||||||
|
exporters.systemd.enable = config.prometheus.exporters.enable;
|
||||||
|
exporters.process.enable = config.prometheus.exporters.enable;
|
||||||
|
exporters.process.settings.process_names = [
|
||||||
|
# Remove nix store path from process name
|
||||||
|
{
|
||||||
|
name = "{{.Matches.Wrapped}} {{ .Matches.Args }}";
|
||||||
|
cmdline = [ "^/nix/store[^ ]*/(?P<Wrapped>[^ /]*) (?P<Args>.*)" ];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
extraFlags = lib.mkIf isServer [ "--web.enable-remote-write-receiver" ];
|
||||||
scrapeConfigs = [{
|
scrapeConfigs = [{
|
||||||
job_name = "local";
|
job_name = config.networking.hostName;
|
||||||
static_configs = [{ targets = [ "127.0.0.1:9100" ]; }];
|
static_configs = [{ targets = config.scrapeTargets; }];
|
||||||
|
}];
|
||||||
|
webExternalUrl =
|
||||||
|
lib.mkIf isServer "https://${config.hostnames.prometheus}";
|
||||||
|
# Web config file: https://prometheus.io/docs/prometheus/latest/configuration/https/
|
||||||
|
webConfigFile = lib.mkIf isServer
|
||||||
|
((pkgs.formats.yaml { }).generate "webconfig.yml" {
|
||||||
|
basic_auth_users = {
|
||||||
|
# Generate password: htpasswd -nBC 10 "" | tr -d ':\n'
|
||||||
|
# Encrypt and place in private/prometheus.age
|
||||||
|
"prometheus" =
|
||||||
|
"$2y$10$r7FWHLHTGPAY312PdhkPEuvb05aGn9Nk1IO7qtUUUjmaDl35l6sLa";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
remoteWrite = lib.mkIf (!isServer) [{
|
||||||
|
name = config.networking.hostName;
|
||||||
|
url = "https://${config.hostnames.prometheus}/api/v1/write";
|
||||||
|
basic_auth = {
|
||||||
|
# Uses password hashed with bcrypt above
|
||||||
|
username = "prometheus";
|
||||||
|
password_file = config.secrets.prometheus.dest;
|
||||||
|
};
|
||||||
}];
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
caddy.routes = [{
|
# Create credentials file for remote Prometheus push
|
||||||
match = [{ host = [ config.metricsServer ]; }];
|
secrets.prometheus =
|
||||||
|
lib.mkIf (config.services.prometheus.enable && !isServer) {
|
||||||
|
source = ../../../private/prometheus.age;
|
||||||
|
dest = "${config.secretsDirectory}/prometheus";
|
||||||
|
owner = "prometheus";
|
||||||
|
group = "prometheus";
|
||||||
|
permissions = "0440";
|
||||||
|
};
|
||||||
|
systemd.services.prometheus-secret =
|
||||||
|
lib.mkIf (config.services.prometheus.enable && !isServer) {
|
||||||
|
requiredBy = [ "prometheus.service" ];
|
||||||
|
before = [ "prometheus.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
caddy.routes = lib.mkIf (config.services.prometheus.enable && isServer) [{
|
||||||
|
match = [{ host = [ config.hostnames.prometheus ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:3000"; }];
|
upstreams =
|
||||||
|
[{ dial = "localhost:${config.services.prometheus.port}"; }];
|
||||||
}];
|
}];
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
{ config, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
options = { samba.enable = lib.mkEnableOption "Enable Samba sharing."; };
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
||||||
services.samba = lib.mkIf (config.samba.enable) {
|
services.samba = lib.mkIf config.services.samba.enable {
|
||||||
enable = true;
|
|
||||||
openFirewall = true;
|
openFirewall = true;
|
||||||
shares.data = {
|
shares.data = {
|
||||||
path = "/data";
|
path = "/data";
|
||||||
|
@ -39,6 +39,11 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
description = "Permissions expressed as octal.";
|
description = "Permissions expressed as octal.";
|
||||||
};
|
};
|
||||||
|
prefix = lib.mkOption {
|
||||||
|
default = "";
|
||||||
|
type = lib.types.str;
|
||||||
|
description = "Prefix for secret value (for environment files).";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
description = "Set of secrets to decrypt to disk.";
|
description = "Set of secrets to decrypt to disk.";
|
||||||
@ -65,10 +70,10 @@
|
|||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
script = ''
|
script = ''
|
||||||
${pkgs.age}/bin/age --decrypt \
|
echo "${attrs.prefix}$(
|
||||||
--identity ${config.identityFile} \
|
${pkgs.age}/bin/age --decrypt \
|
||||||
--output ${attrs.dest} \
|
--identity ${config.identityFile} ${attrs.source}
|
||||||
${attrs.source}
|
)" > ${attrs.dest}
|
||||||
|
|
||||||
chown '${attrs.owner}':'${attrs.group}' '${attrs.dest}'
|
chown '${attrs.owner}':'${attrs.group}' '${attrs.dest}'
|
||||||
chmod '${attrs.permissions}' '${attrs.dest}'
|
chmod '${attrs.permissions}' '${attrs.dest}'
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (config.publicKey != null) {
|
config = lib.mkIf config.services.openssh.enable {
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = true;
|
|
||||||
ports = [ 22 ];
|
ports = [ 22 ];
|
||||||
allowSFTP = true;
|
allowSFTP = true;
|
||||||
settings = {
|
settings = {
|
||||||
@ -27,7 +26,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
users.users.${config.user}.openssh.authorizedKeys.keys =
|
users.users.${config.user}.openssh.authorizedKeys.keys =
|
||||||
[ config.publicKey ];
|
lib.mkIf (config.publicKey != null) [ config.publicKey ];
|
||||||
|
|
||||||
# Implement a simple fail2ban service for sshd
|
# Implement a simple fail2ban service for sshd
|
||||||
services.sshguard.enable = true;
|
services.sshguard.enable = true;
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
# Create reverse proxy for web UI
|
# Create reverse proxy for web UI
|
||||||
caddy.routes = lib.mkAfter [{
|
caddy.routes = lib.mkAfter [{
|
||||||
group = if (config.arrServer == config.transmissionServer) then
|
group = if (config.hostnames.download == config.transmissionServer) then
|
||||||
"download"
|
"download"
|
||||||
else
|
else
|
||||||
"transmission";
|
"transmission";
|
||||||
|
@ -4,21 +4,10 @@ let vaultwardenPath = "/var/lib/bitwarden_rs"; # Default service directory
|
|||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
options = {
|
config = lib.mkIf config.services.vaultwarden.enable {
|
||||||
|
|
||||||
vaultwardenServer = lib.mkOption {
|
|
||||||
description = "Hostname for Vaultwarden.";
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkIf (config.vaultwardenServer != null) {
|
|
||||||
services.vaultwarden = {
|
services.vaultwarden = {
|
||||||
enable = true;
|
|
||||||
config = {
|
config = {
|
||||||
DOMAIN = "https://${config.vaultwardenServer}";
|
DOMAIN = "https://${config.hostnames.secrets}";
|
||||||
SIGNUPS_ALLOWED = false;
|
SIGNUPS_ALLOWED = false;
|
||||||
SIGNUPS_VERIFY = true;
|
SIGNUPS_VERIFY = true;
|
||||||
INVITATIONS_ALLOWED = true;
|
INVITATIONS_ALLOWED = true;
|
||||||
@ -47,7 +36,7 @@ in {
|
|||||||
networking.firewall.allowedTCPPorts = [ 3012 ];
|
networking.firewall.allowedTCPPorts = [ 3012 ];
|
||||||
|
|
||||||
caddy.routes = [{
|
caddy.routes = [{
|
||||||
match = [{ host = [ config.vaultwardenServer ]; }];
|
match = [{ host = [ config.hostnames.secrets ]; }];
|
||||||
handle = [{
|
handle = [{
|
||||||
handler = "reverse_proxy";
|
handler = "reverse_proxy";
|
||||||
upstreams = [{ dial = "localhost:8222"; }];
|
upstreams = [{ dial = "localhost:8222"; }];
|
||||||
|
95
modules/nixos/services/victoriametrics.nix
Normal file
95
modules/nixos/services/victoriametrics.nix
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
{ config, pkgs, lib, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
username = "prometheus";
|
||||||
|
|
||||||
|
prometheusConfig = (pkgs.formats.yaml { }).generate "prometheus.yml" {
|
||||||
|
scrape_configs = [{
|
||||||
|
job_name = config.networking.hostName;
|
||||||
|
stream_parse = true;
|
||||||
|
static_configs = [{ targets = config.prometheus.scrapeTargets; }];
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
authConfig = (pkgs.formats.yaml { }).generate "auth.yml" {
|
||||||
|
users = [{
|
||||||
|
username = username;
|
||||||
|
password = "%{PASSWORD}";
|
||||||
|
url_prefix =
|
||||||
|
"http://localhost${config.services.victoriametrics.listenAddress}";
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
|
authPort = "8427";
|
||||||
|
|
||||||
|
in {
|
||||||
|
|
||||||
|
config = {
|
||||||
|
|
||||||
|
services.victoriametrics.extraOptions =
|
||||||
|
[ "-promscrape.config=${prometheusConfig}" ];
|
||||||
|
|
||||||
|
systemd.services.vmauth = lib.mkIf config.services.victoriametrics.enable {
|
||||||
|
description = "VictoriaMetrics basic auth proxy";
|
||||||
|
after = [ "network.target" ];
|
||||||
|
startLimitBurst = 5;
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 1;
|
||||||
|
DynamicUser = true;
|
||||||
|
EnvironmentFile = config.secrets.vmauth.dest;
|
||||||
|
ExecStart = ''
|
||||||
|
${pkgs.victoriametrics}/bin/vmauth \
|
||||||
|
-auth.config=${authConfig} \
|
||||||
|
-httpListenAddr=:${authPort}'';
|
||||||
|
};
|
||||||
|
wantedBy = [ "multi-user.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
secrets.vmauth = lib.mkIf config.services.victoriametrics.enable {
|
||||||
|
source = ../../../private/prometheus.age;
|
||||||
|
dest = "${config.secretsDirectory}/vmauth";
|
||||||
|
prefix = "PASSWORD=";
|
||||||
|
};
|
||||||
|
systemd.services.vmauth-secret =
|
||||||
|
lib.mkIf config.services.victoriametrics.enable {
|
||||||
|
requiredBy = [ "vmauth.service" ];
|
||||||
|
before = [ "vmauth.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
caddy.routes = lib.mkIf config.services.victoriametrics.enable [{
|
||||||
|
match = [{ host = [ config.hostnames.prometheus ]; }];
|
||||||
|
handle = [{
|
||||||
|
handler = "reverse_proxy";
|
||||||
|
upstreams = [{ dial = "localhost:${authPort}"; }];
|
||||||
|
}];
|
||||||
|
}];
|
||||||
|
|
||||||
|
# VMAgent
|
||||||
|
|
||||||
|
services.vmagent.prometheusConfig = prometheusConfig; # Overwritten below
|
||||||
|
systemd.services.vmagent.serviceConfig =
|
||||||
|
lib.mkIf config.services.vmagent.enable {
|
||||||
|
ExecStart = lib.mkForce ''
|
||||||
|
${pkgs.victoriametrics}/bin/vmagent \
|
||||||
|
-promscrape.config=${prometheusConfig} \
|
||||||
|
-remoteWrite.url="https://${config.hostnames.prometheus}/api/v1/write" \
|
||||||
|
-remoteWrite.basicAuth.username=${username} \
|
||||||
|
-remoteWrite.basicAuth.passwordFile=${config.secrets.vmagent.dest}'';
|
||||||
|
};
|
||||||
|
|
||||||
|
secrets.vmagent = lib.mkIf config.services.vmagent.enable {
|
||||||
|
source = ../../../private/prometheus.age;
|
||||||
|
dest = "${config.secretsDirectory}/vmagent";
|
||||||
|
owner = "vmagent";
|
||||||
|
group = "vmagent";
|
||||||
|
};
|
||||||
|
systemd.services.vmagent-secret = lib.mkIf config.services.vmagent.enable {
|
||||||
|
requiredBy = [ "vmagent.service" ];
|
||||||
|
before = [ "vmagent.service" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
47
modules/nixos/system/auto-upgrade.nix
Normal file
47
modules/nixos/system/auto-upgrade.nix
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
|
# This setting only applies to NixOS, different on Darwin
|
||||||
|
nix.gc.dates = "03:03"; # Run every morning (but before upgrade)
|
||||||
|
|
||||||
|
# Update the system daily by pointing it at the flake repository
|
||||||
|
system.autoUpgrade = {
|
||||||
|
enable = config.server; # Only auto upgrade servers
|
||||||
|
dates = "03:33";
|
||||||
|
flake = "git+${config.dotfilesRepo}";
|
||||||
|
randomizedDelaySec = "25min";
|
||||||
|
operation = "switch";
|
||||||
|
allowReboot = true;
|
||||||
|
rebootWindow = {
|
||||||
|
lower = "00:01";
|
||||||
|
upper = "06:00";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
# Create an email notification service for failed jobs
|
||||||
|
systemd.services."notify-email@" =
|
||||||
|
let address = "system@${config.mail.server}";
|
||||||
|
in {
|
||||||
|
enable = config.mail.enable;
|
||||||
|
environment.SERVICE_ID = "%i";
|
||||||
|
script = ''
|
||||||
|
TEMPFILE=$(mktemp)
|
||||||
|
echo "From: ${address}" > $TEMPFILE
|
||||||
|
echo "To: ${address}" >> $TEMPFILE
|
||||||
|
echo "Subject: Failure in $SERVICE_ID" >> $TEMPFILE
|
||||||
|
echo -e "\nGot an error with $SERVICE_ID\n\n" >> $TEMPFILE
|
||||||
|
set +e
|
||||||
|
systemctl status $SERVICE_ID >> $TEMPFILE
|
||||||
|
set -e
|
||||||
|
${pkgs.msmtp}/bin/msmtp \
|
||||||
|
--file=${config.homePath}/.config/msmtp/config \
|
||||||
|
--account=system \
|
||||||
|
${address} < $TEMPFILE
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Send an email whenever auto upgrade fails
|
||||||
|
systemd.services.nixos-upgrade.onFailure =
|
||||||
|
lib.mkIf config.systemd.services."notify-email@".enable
|
||||||
|
[ "notify-email@%i.service" ];
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, pkgs, lib, ... }: {
|
||||||
|
|
||||||
imports = [ ./doas.nix ./journald.nix ./user.nix ./timezone.nix ];
|
imports =
|
||||||
|
[ ./auto-upgrade.nix ./doas.nix ./journald.nix ./user.nix ./timezone.nix ];
|
||||||
|
|
||||||
config = lib.mkIf pkgs.stdenv.isLinux {
|
config = lib.mkIf pkgs.stdenv.isLinux {
|
||||||
|
|
||||||
@ -8,13 +9,6 @@
|
|||||||
system.stateVersion =
|
system.stateVersion =
|
||||||
config.home-manager.users.${config.user}.home.stateVersion;
|
config.home-manager.users.${config.user}.home.stateVersion;
|
||||||
|
|
||||||
# This setting only applies to NixOS, different on Darwin
|
|
||||||
nix.gc.dates = "weekly";
|
|
||||||
|
|
||||||
systemd.timers.nix-gc.timerConfig = { WakeSystem = true; };
|
|
||||||
systemd.services.nix-gc.postStop =
|
|
||||||
lib.mkIf (!config.server) "systemctl suspend";
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
doas = {
|
doas = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
# No password required
|
# No password required for trusted users
|
||||||
wheelNeedsPassword = false;
|
wheelNeedsPassword = false;
|
||||||
|
|
||||||
# Pass environment variables from user to root
|
# Pass environment variables from user to root
|
||||||
# Also requires removing password here
|
# Also requires specifying that we are removing password here
|
||||||
extraRules = [{
|
extraRules = [{
|
||||||
groups = [ "wheel" ];
|
groups = [ "wheel" ];
|
||||||
noPass = true;
|
noPass = true;
|
||||||
@ -26,6 +26,7 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Alias sudo to doas for convenience
|
||||||
home-manager.users.${config.user}.programs.fish.shellAliases = {
|
home-manager.users.${config.user}.programs.fish.shellAliases = {
|
||||||
sudo = "doas";
|
sudo = "doas";
|
||||||
};
|
};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ ... }: {
|
{ ... }: {
|
||||||
|
|
||||||
# How long to keep journalctl entries
|
# How long to keep journalctl entries
|
||||||
|
# This helps to make sure log disk usage doesn't grow too unwieldy
|
||||||
services.journald.extraConfig = ''
|
services.journald.extraConfig = ''
|
||||||
SystemMaxUse=100M
|
SystemMaxUse=100M
|
||||||
MaxFileSec=1month
|
MaxFileSec=1month
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ config, pkgs, lib, ... }: {
|
{ config, lib, ... }: {
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf (pkgs.stdenv.isLinux) {
|
config = {
|
||||||
|
|
||||||
# Allows us to declaritively set password
|
# Allows us to declaritively set password
|
||||||
users.mutableUsers = false;
|
users.mutableUsers = false;
|
||||||
|
4
overlays/betterlockscreen.nix
Normal file
4
overlays/betterlockscreen.nix
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Disable dunst so that it's not attempting to reach a non-existent dunst service
|
||||||
|
_final: prev: {
|
||||||
|
betterlockscreen = prev.betterlockscreen.override { withDunst = false; };
|
||||||
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
# Adds the Cloudflare DNS validation module
|
||||||
|
|
||||||
{ lib, buildGo118Module, fetchFromGitHub, plugins ? [ ] }:
|
{ lib, buildGo118Module, fetchFromGitHub, plugins ? [ ] }:
|
||||||
let
|
let
|
||||||
goImports = lib.flip lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n");
|
goImports = lib.flip lib.concatMapStrings plugins (pkg: " _ \"${pkg}\"\n");
|
||||||
|
@ -7,16 +7,17 @@ let
|
|||||||
# Use nixpkgs vimPlugin but with source directly from plugin author
|
# Use nixpkgs vimPlugin but with source directly from plugin author
|
||||||
withSrc = pkg: src: pkg.overrideAttrs (_: { inherit src; });
|
withSrc = pkg: src: pkg.overrideAttrs (_: { inherit src; });
|
||||||
|
|
||||||
# Package plugin - disabling until in use
|
# Package plugin - for plugins not found in nixpkgs at all
|
||||||
# plugin = pname: src:
|
plugin = pname: src:
|
||||||
# prev.vimUtils.buildVimPluginFrom2Nix {
|
prev.vimUtils.buildVimPluginFrom2Nix {
|
||||||
# inherit pname src;
|
inherit pname src;
|
||||||
# version = "master";
|
version = "master";
|
||||||
# };
|
};
|
||||||
|
|
||||||
in {
|
in {
|
||||||
|
|
||||||
nil = inputs.nil.packages.${prev.system}.nil;
|
nil = inputs.nil.packages.${prev.system}.nil;
|
||||||
|
vscode-terraform-snippets = inputs.vscode-terraform-snippets;
|
||||||
|
|
||||||
nvim-lspconfig =
|
nvim-lspconfig =
|
||||||
(withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig);
|
(withSrc prev.vimPlugins.nvim-lspconfig inputs.nvim-lspconfig);
|
||||||
@ -35,8 +36,7 @@ in {
|
|||||||
(withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim);
|
(withSrc prev.vimPlugins.bufferline-nvim inputs.bufferline-nvim);
|
||||||
nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua);
|
nvim-tree-lua = (withSrc prev.vimPlugins.nvim-tree-lua inputs.nvim-tree-lua);
|
||||||
|
|
||||||
# Packaging plugins with Nix
|
# Packaging plugins entirely with Nix
|
||||||
# comment-nvim = plugin "comment-nvim" comment-nvim-src;
|
baleia-nvim = plugin "baleia-nvim" inputs.baleia-nvim-src;
|
||||||
# plenary-nvim = plugin "plenary-nvim" plenary-nvim-src;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
61
overlays/tree-sitter.nix
Normal file
61
overlays/tree-sitter.nix
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
inputs: _final: prev: {
|
||||||
|
tree-sitter-grammars = prev.tree-sitter-grammars // {
|
||||||
|
|
||||||
|
# Fix: bash highlighting doesn't work as of this commit:
|
||||||
|
# https://github.com/NixOS/nixpkgs/commit/49cce41b7c5f6b88570a482355d9655ca19c1029
|
||||||
|
tree-sitter-bash = prev.tree-sitter-grammars.tree-sitter-bash.overrideAttrs
|
||||||
|
(old: {
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "tree-sitter";
|
||||||
|
repo = "tree-sitter-bash";
|
||||||
|
rev = "493646764e7ad61ce63ce3b8c59ebeb37f71b841";
|
||||||
|
sha256 = "sha256-gl5F3IeZa2VqyH/qFj8ey2pRbGq4X8DL5wiyvRrH56U=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
# Fix: invalid node in position. Broken as of this commit (replaced with newer):
|
||||||
|
# https://github.com/NixOS/nixpkgs/commit/8ec3627796ecc899e6f47f5bf3c3220856ead9c5
|
||||||
|
tree-sitter-python =
|
||||||
|
prev.tree-sitter-grammars.tree-sitter-python.overrideAttrs (old: {
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "tree-sitter";
|
||||||
|
repo = "tree-sitter-python";
|
||||||
|
rev = "5af00f64af6bbf822f208243cce5cf75396fb6f5";
|
||||||
|
sha256 = "sha256-2btd/NRE6NuGNlx4cq535OrwtWXihiP3VMCJjPCiDOk=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
# Add grammars not in nixpks
|
||||||
|
tree-sitter-ini = prev.tree-sitter.buildGrammar {
|
||||||
|
language = "ini";
|
||||||
|
version = "1.0.0";
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "justinmk";
|
||||||
|
repo = "tree-sitter-ini";
|
||||||
|
rev = "1a0ce072ebf3afac7d5603d9a95bb7c9a6709b44";
|
||||||
|
sha256 = "sha256-pPtKokpTgjoNzPW4dRkOnyzBBJFeJj3+CW3LbHSKsmU=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
tree-sitter-puppet = prev.tree-sitter.buildGrammar {
|
||||||
|
language = "puppet";
|
||||||
|
version = "1.0.0";
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "amaanq";
|
||||||
|
repo = "tree-sitter-puppet";
|
||||||
|
rev = "v1.0.0";
|
||||||
|
sha256 = "sha256-vk5VJZ9zW2bBuc+DM+fwFyhM1htZGeLlmkjMAH66jBA=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
tree-sitter-rasi = prev.tree-sitter.buildGrammar {
|
||||||
|
language = "rasi";
|
||||||
|
version = "0.1.1";
|
||||||
|
src = prev.fetchFromGitHub {
|
||||||
|
owner = "Fymyte";
|
||||||
|
repo = "tree-sitter-rasi";
|
||||||
|
rev = "371dac6bcce0df5566c1cfebde69d90ecbeefd2d";
|
||||||
|
sha256 = "sha256-2nYZoLcrxxxiOJEySwHUm93lzMg8mU+V7LIP63ntFdA=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
15
private/cloudflared-flame.age
Normal file
15
private/cloudflared-flame.age
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBQVzVy
|
||||||
|
ZmRldHhVenI3RVdOQXkyQ3pQUWM3N2l0bFBqT3ozakp3Nk5nS1dVCmoxb1lzVWd1
|
||||||
|
YWZ0UWd4TExELzJ1cElsQ0o2L1g4TVBpZW16TmxvT05GaFEKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIDR2TjdhbG1MelVVTXF3WUhFRWZKRGVoYUNwdy9hc05uajg2enlY
|
||||||
|
S0x5eWcKSlM2YjFCRi9yN3ozVkhScXM5S0dNRnhpeisvNlE1Q09CNVFvN0YwL2JR
|
||||||
|
NAotPiBzc2gtZWQyNTUxOSBuanZYNUEgMEJtR2JpVk5PZnRpOUVuZHZJTDI3Z0Fa
|
||||||
|
UUdwWXFLT1gxZ0c3WFBlU2dDawpreE0yYUxoUktveGF5NXE4VHRva1hNdjdpYmZn
|
||||||
|
R08wQ0l6cXpvYmhRMXRvCi0tLSB0UmFTdVBlR3NTSkVzdGtzOTdmSFVERC85dU1z
|
||||||
|
cHdMVFdYSTFWUGRDTm1nCrengYn1phCUDmVH29uRjKMLNDIucrpi1s4t8ciQ3ILG
|
||||||
|
sz605ztO3UUlm4SQTJnXmktRDBlLu/xICzEo5okkNl9HwK7s2Ok2DAoz8K/KeFbS
|
||||||
|
65K3a3RcZEdWryZyu/N12HAqu5FDw0wIbvLJP4X+EcpUJXYHr8FluLUSEQg+sORW
|
||||||
|
FnL5tr1vK32ZQY4GIHZXh4hQbNoZo1v2ezkcK21siDkeA3e3PT6Bi0I90nuXS9Pc
|
||||||
|
0rZFZeYlNtI1Y4aeg6NEWytt
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
15
private/cloudflared-tempest.age
Normal file
15
private/cloudflared-tempest.age
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyB1VnBt
|
||||||
|
RTV5eWc3RDNUR2lOWFRaMlgzREQyMlcvUFNxV0N2Vm9lVVZKOUZ3ClJjaWtYZjR5
|
||||||
|
ZTB4L2M4MFB0UThaMzlRT3JkUEE1N3RrSUlpZnRFbmFDdWcKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIE5iTUs1ak9VZjRIRGpLMWtDcVB0RjVFRW8vOENQZlkzeGhsYmFB
|
||||||
|
QzJ6Z00KZmcvZ0hYMjN1bGZwY3NvMjlCbnpHUWVjdVU4cnBGcDQxTU8wZ0EyQXdU
|
||||||
|
MAotPiBzc2gtZWQyNTUxOSBuanZYNUEgazRzK2ZnSUZNWURoKzZMZmM4VTlDbVBh
|
||||||
|
WGc4MlE5TGFiN1MzV01FT1oyQQppRUhUNjdlQURNQm8rR0JOOUJFNm9vaXhPTXFW
|
||||||
|
U2lJU09jWVA0TDRrVHY4Ci0tLSBudWJTclRTek1RWHYzYzA4aTduODB0NUNWbVVP
|
||||||
|
cUIyVzJncWhDS053d25nCneJhp1QT1v+dAguW9wAKDgWST59KNBgbY01jkf1IqXc
|
||||||
|
FbmkctPIMggim3uCBqjzBboYvf+dtt0Fcu9aiB+4YmGUeQNb+9mdPweXoHmVrego
|
||||||
|
XygVsbuSP4xKWtIJhBJ/3/jEK9LqBtv+owdUIxbw5Ci6A0JvSu+tnUj5oAgMyT2z
|
||||||
|
YrGRK9plQZteeUkMcd6+anSEUpP45lzfz/T7loD9ViCbPHRuUFgwkwUcRGjQStm3
|
||||||
|
pnx9bi8N4ac599f4KqInm5gd
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
12
private/gitea-runner-token.age
Normal file
12
private/gitea-runner-token.age
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBoOVF1
|
||||||
|
NmZocHpQQnRJcWpWUHh2bU93NkdnZWNzSlFiaHdTd24rcHpsczFRCmJaSzNkNGs1
|
||||||
|
UDJCN2dYUVE3UTE1OU5RUWljQlN4dmxuUnpOMFYxQTdUaVEKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIE5HdGd6aTlKM0lFUlYzT1VhS05nZ2ZxTndVZHBNQlJxYlovdXkx
|
||||||
|
ei96d2cKdzlUYVFFaEIzaS9LZmY3MzM1RmNnR0xjOEpHK1kxM0FMTWRQSlVnczVF
|
||||||
|
dwotPiBzc2gtZWQyNTUxOSBuanZYNUEgQ1lhMGQvUy9OWkRBR3BZV1pFNmNtb2pq
|
||||||
|
Y2VEUzhRWGVWUkZJY1l4RGtWdwphdFZtM0ZLZURvYVZQYjV4bWVPdWJxa3RmWmVh
|
||||||
|
SHl0T0pQWmxnVlFPR2drCi0tLSBnd2lwS3dqUk5Jelg0b3RxbFdEcnJ6ZkkvZTVN
|
||||||
|
UllBeUUyOXBxVDBKMG5BCkGo9kj9sMVhbnXVM35lGScAb8r5LH9vf5jOdhLC/Wj2
|
||||||
|
+uA0ONIh7F2GELzf5Cw1KZJ8aHTURM2r41vZvfAQN1RwrmYOiUzlyMrvTDe78cY=
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
12
private/mailpass-system.age
Normal file
12
private/mailpass-system.age
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyA3Ynp0
|
||||||
|
UUVDdVk1MG1nQmZ3cDl5UmY5VnpMSkdyYmluTlJGWUdnRVQyVWhvCkNlQkY0RUR5
|
||||||
|
ODZTYUEzQlBmelBLcUxuWjdiYms2RUtmYlFFeEpXM3JCMlUKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIFNySTEvUXhycFhZa3h5ZnZyaXJEZ3BGRW03WGRvM29FQlZJQ2xx
|
||||||
|
ZnMwVzgKbGFVMDlYZjVzeUJyY1kyc0ZXRnVydHkzOWtPaE1uTXllbHhaQTdIa016
|
||||||
|
VQotPiBzc2gtZWQyNTUxOSBuanZYNUEgdjh4T2FkckZYQlpsd3ZSTmc4VGRxWjg4
|
||||||
|
TVRCTUl4U1BnanVwV29POXhIZwpEcHBUOFJjTXBGTExYTWtmd01XQlZndklXTkdU
|
||||||
|
NHBnYkNBTSs5K1A3cE9vCi0tLSBBa01zRTdNYW5wRlltVkgrWG9mdHcrZ1NXRUwz
|
||||||
|
UUhsalZSeU1CVENmbnp3CphGOZ7hu3mq3UI69UCJq7ptFDMUmdmYW4ydzz2RVlYX
|
||||||
|
P1JWkX0IpnHtcFPK1XmRrBkiyto=
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
12
private/prometheus.age
Normal file
12
private/prometheus.age
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyBDRWNi
|
||||||
|
YlJubmg1Ly94cHgxbHV3dStaRkZDRXdNZzVjRCt0R2RNMFkxUEZNCnJxZnc1UHFB
|
||||||
|
MURselZuL1U5OHFQb0tPLytWelRzYXlvNngya3RQOXREUEkKLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIDRiR2ZEMUZsYTlGbXFoR0NyZXVXMEZmS3BONDNFQUo4VU1XNkZ0
|
||||||
|
ZWFzMHcKM1crbDVsR2VmVTFNckxaa21MTW9UVWE3Z01qMi9VT0kwMm80V0tMSWM1
|
||||||
|
bwotPiBzc2gtZWQyNTUxOSBuanZYNUEgd0tIampOVU5ZeWtxNWZpaGdFQTBlWlha
|
||||||
|
Z0lBQWp0dzhMRHU5UnVzWVlUSQpnUHlCZ0w5Z1hMYm1Dc1UxQ1lLRHlnaUhJQllW
|
||||||
|
RGMvTEhhc29VL2JXZnhNCi0tLSB6TThQbmV0eFJ0d2pZd1h0c2RuTGFzUHhyYWJp
|
||||||
|
b2RhVTNkSXczRGJpN1UwCt7I+OsqQdQbFXhYPV5/kqDAr/jVoJ9H5PSfdLkeVIrr
|
||||||
|
AqScUaOrdctUZEBIF8/FouJkSbIiU8muBNrBKx9CylI=
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
12
private/prowlarr-api-key.age
Normal file
12
private/prowlarr-api-key.age
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
-----BEGIN AGE ENCRYPTED FILE-----
|
||||||
|
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IHNzaC1lZDI1NTE5IE1nSGFPdyAyVkNR
|
||||||
|
d1lsUmJWVmlxb3NnNTJNN052ckRPOURYR3VCWUFpd25aQTBPVldJCnBNRTdlOTNP
|
||||||
|
SkhHZkZVU2VrV1hVcGczUVVZVHBtRTNoNUliZHNpeXltZW8KLT4gc3NoLWVkMjU1
|
||||||
|
MTkgWXlTVU1RIGJCWktmWDE1Z1Q4M0RDKytaZndtZmlCeU5paXUxTld4d2FNV3dT
|
||||||
|
Nyt3aWsKTUlqTys0Q1RiTERlMnZRUDJMZHJheStYak0rY01jWVM3STF2QjExZzFm
|
||||||
|
UQotPiBzc2gtZWQyNTUxOSBuanZYNUEgcm9wVTlCKzFEejdlNVp0ZVpnRUxDUmpo
|
||||||
|
YmRlZWVpSGJocUtNN05KS0cwTQpYUmdpYVNVemZXWUd1ZUlQTks4VUdmaEZPZ2x2
|
||||||
|
YVdqWG0ySkt2dDNSQzJvCi0tLSBaN0gwclJpcUFvT0pHcUhyVERnZ1Nralg5bGxZ
|
||||||
|
b0hyaVB6OStpczQxclFJCmHfg8XI+AzbijptcC6Zhqigp8D3CvB8mSF5H6kPFmJU
|
||||||
|
odbXmgzihXxWjnG6tH4LgEiEI2dWfbELIwqLs4BIiLlt
|
||||||
|
-----END AGE ENCRYPTED FILE-----
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user