Compare commits
64 Commits
de7a7866e9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 3bcd4c3c13 | |||
| d975d49844 | |||
| 1ead7fe7be | |||
| 7dd2fc7e59 | |||
| 95ffe7b908 | |||
| ce02cc5538 | |||
| 0dbc007a90 | |||
| 57e0d49278 | |||
| ee44b26147 | |||
| 675306ec91 | |||
| a829f160fb | |||
| 4cfe0387e2 | |||
| 2efccdb4de | |||
| 8aafaf7d35 | |||
| dce57f907a | |||
| 1bda05280e | |||
| d39071da06 | |||
| 781f379aff | |||
| 2203b48cde | |||
| 35f6f7890f | |||
| 83958847f4 | |||
| b66b0c4003 | |||
| efd2771d8c | |||
| 94331531e2 | |||
| 5b1e7efcd2 | |||
| 730dd23967 | |||
| 8f5caaed41 | |||
| db2bbb86ba | |||
| 72c3710a3c | |||
| b62f3c20ac | |||
| dd31da5a8f | |||
| bc6d8b6305 | |||
| fce3aa45ec | |||
| 949917a809 | |||
| 0dd1ecef91 | |||
| fcdb52cc42 | |||
| b6500b97ff | |||
| 8f756554ad | |||
| 583b9ea5f3 | |||
| 6a30a431f8 | |||
| 38818e7508 | |||
| 94c64e9d33 | |||
| a9854ac144 | |||
| 8b109af08b | |||
| 82dde7d749 | |||
| 59ce48d65e | |||
| 9b9c580a7f | |||
| 0e27b181ad | |||
| 6b43660491 | |||
| db5e8855d2 | |||
| 2f1f60b836 | |||
| a13a19e8e9 | |||
| fee4b43104 | |||
| faf3afad79 | |||
| db116cc4de | |||
| 75ee011369 | |||
| ae63c4737a | |||
| d6bc3c0293 | |||
| fd3a38da62 | |||
| e30ca9d8dd | |||
| 79eb5c27e9 | |||
| 677728c440 | |||
| 483b05fc27 | |||
| cb4709b1a6 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -9,4 +9,5 @@ result-*
|
|||||||
|
|
||||||
nixos-efi-vars.fd
|
nixos-efi-vars.fd
|
||||||
|
|
||||||
/.pre-commit-config.yaml
|
.direnv/
|
||||||
|
.pre-commit-config.yaml
|
||||||
|
|||||||
@@ -8,29 +8,26 @@ let
|
|||||||
utils = import ../utils { inherit lib; };
|
utils = import ../utils { inherit lib; };
|
||||||
hostDirNames = utils.dirNames ../hosts;
|
hostDirNames = utils.dirNames ../hosts;
|
||||||
|
|
||||||
mkNode = hostname: tags: {
|
mkNode = hostname: meta: {
|
||||||
imports = [ ../hosts/${hostname} ];
|
imports = [ ../hosts/${hostname} ];
|
||||||
deployment = {
|
deployment = {
|
||||||
targetHost = self.nixosConfigurations.${hostname}.config.ssh.publicHostname;
|
inherit (meta.deployment) targetHost targetUser tags;
|
||||||
targetUser = self.nixosConfigurations.${hostname}.config.ssh.username;
|
buildOnTarget = builtins.any (t: t != "local" && t != "arm") meta.deployment.tags;
|
||||||
buildOnTarget = builtins.any (t: t != "local" && t != "arm") tags;
|
|
||||||
inherit tags;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = lib.genAttrs hostDirNames (
|
nodes = lib.genAttrs hostDirNames (hostname: mkNode hostname (utils.hostMeta ../hosts/${hostname}));
|
||||||
hostname: mkNode hostname (utils.hostMeta ../hosts/${hostname}).deployment.tags
|
|
||||||
);
|
|
||||||
in
|
in
|
||||||
inputs.colmena.lib.makeHive (
|
inputs.colmena.lib.makeHive (
|
||||||
{
|
{
|
||||||
meta = {
|
meta = {
|
||||||
nixpkgs = import inputs.nixpkgs {
|
nixpkgs = import inputs.nixpkgs { localSystem = "x86_64-linux"; };
|
||||||
localSystem = "x86_64-linux";
|
specialArgs = {
|
||||||
|
inherit inputs;
|
||||||
|
outputs = self;
|
||||||
|
dotsPath = ../dots;
|
||||||
|
myUtils = utils;
|
||||||
};
|
};
|
||||||
|
|
||||||
nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) self.nixosConfigurations;
|
|
||||||
nodeSpecialArgs = builtins.mapAttrs (_: v: v._module.specialArgs or { }) self.nixosConfigurations;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// nodes
|
// nodes
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ alias ipa="ip -brief address"
|
|||||||
alias ipl="ip -brief link"
|
alias ipl="ip -brief link"
|
||||||
alias ipr="ip route"
|
alias ipr="ip route"
|
||||||
|
|
||||||
alias clip="xclip -sel clip"
|
|
||||||
|
|
||||||
alias df="df -kTh"
|
alias df="df -kTh"
|
||||||
alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S"
|
alias fzfpac="pacman -Slq | fzf -m --preview 'pacman -Si {1}' | xargs -ro sudo pacman -S"
|
||||||
alias path='echo -e ${PATH//:/\\n}' # Pretty print path variables
|
alias path='echo -e ${PATH//:/\\n}' # Pretty print path variables
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
cd "$ZK_PATH" || echo "No zettelkasten directory found"
|
|
||||||
git a . && git commit -m "Update" && git push
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [ ! -d ~/.zk ]; then
|
|
||||||
echo "[zk] Setting up zettelkasten"
|
|
||||||
gh repo clone zk ~/.zk
|
|
||||||
else
|
|
||||||
echo "[zk] Zettelkasten already set up."
|
|
||||||
fi
|
|
||||||
|
|
||||||
read -p "Would you like open your zettelkasten? [y/N] " -n 1 -r
|
|
||||||
echo
|
|
||||||
|
|
||||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|
||||||
if [ -x "$(command -v zk)" ]; then
|
|
||||||
zk
|
|
||||||
else
|
|
||||||
echo "Error: 'zk' command not found or not executable"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
35
dots/.config/nvim/after/plugin/hydra.lua
Normal file
35
dots/.config/nvim/after/plugin/hydra.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
local hydra_repl = "hydra-repl"
|
||||||
|
|
||||||
|
if not vim.fn.executable(hydra_repl) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local function send(lines)
|
||||||
|
vim.system({ hydra_repl, table.concat(lines, "\n") })
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_paragraph(buf)
|
||||||
|
local start_ = vim.fn.search("^$", "bnW")
|
||||||
|
local end_ = vim.fn.search("^$", "nW") - 1
|
||||||
|
if end_ < vim.api.nvim_win_get_cursor(0)[1] then
|
||||||
|
end_ = vim.api.nvim_buf_line_count(buf)
|
||||||
|
end
|
||||||
|
return vim.api.nvim_buf_get_lines(buf, start_, end_, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_selection(buf)
|
||||||
|
return vim.api.nvim_buf_get_lines(buf, vim.fn.line("'<") - 1, vim.fn.line("'>"), false)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "javascript",
|
||||||
|
callback = function(e)
|
||||||
|
if vim.fn.fnamemodify(vim.api.nvim_buf_get_name(e.buf), ":e") ~= "hydra" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local buf = e.buf
|
||||||
|
vim.keymap.set("n", "<CR>", function() send(get_paragraph(buf)) end, { buffer = buf, desc = "hydra: send block" })
|
||||||
|
vim.keymap.set("v", "<CR>", function() send(get_selection(buf)) end, { buffer = buf, desc = "hydra: send selection" })
|
||||||
|
end,
|
||||||
|
})
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
|
require("zk.utils")
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
" Change local buffer to directory of current file after the plugin has loaded
|
" Change local buffer to directory of current file after the plugin has loaded
|
||||||
autocmd VimEnter * lcd %:p:h
|
execute 'autocmd BufEnter' g:zk_path . '/*.md' 'silent lcd %:p:h'
|
||||||
|
|
||||||
" " Override wiki index mapping to also cd into the wiki
|
" " Override wiki index mapping to also cd into the wiki
|
||||||
nm <leader>ww <plug>(wiki-index)
|
nm <leader>ww <plug>(wiki-index)
|
||||||
@@ -11,11 +13,16 @@ nm <leader>ww <plug>(wiki-index)
|
|||||||
" nm <leader>s <plug>(wiki-link-follow-split)
|
" nm <leader>s <plug>(wiki-link-follow-split)
|
||||||
" nm <leader>v <plug>(wiki-link-follow-vsplit)
|
" nm <leader>v <plug>(wiki-link-follow-vsplit)
|
||||||
|
|
||||||
autocmd BufEnter *.md if expand('%:t') =~ '_' | echo 'hierarchical relation' | endif
|
function! ZKContextualEcho()
|
||||||
autocmd BufEnter *.md if expand('%:t') =~ '--' | echo 'relation' | endif
|
let l:name = expand('%:t')
|
||||||
autocmd BufEnter *.md if expand('%:t') =~ '<>' | echo 'dichotomy' | endif
|
if l:name =~ '_' | echo 'hierarchical relation'
|
||||||
autocmd BufEnter *.md if expand('%:t') =~ 'my-' | echo 'personal file' | endif
|
elseif l:name =~ '--' | echo 'relation'
|
||||||
autocmd BufEnter *.md if expand('%:t') =~ 'project_' | echo 'project file' | endif
|
elseif l:name =~ '<>' | echo 'dichotomy'
|
||||||
|
elseif l:name =~ 'my-' | echo 'personal file'
|
||||||
|
elseif l:name =~ 'project_' | echo 'project file'
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
execute 'autocmd BufEnter' g:zk_path . '/*.md' 'call ZKContextualEcho()'
|
||||||
|
|
||||||
" Only load wiki.vim for zk directory
|
" Only load wiki.vim for zk directory
|
||||||
let g:wiki_index_name='index'
|
let g:wiki_index_name='index'
|
||||||
@@ -76,7 +83,7 @@ let g:wiki_templates = [
|
|||||||
"
|
"
|
||||||
|
|
||||||
let g:wiki_filetypes=['md']
|
let g:wiki_filetypes=['md']
|
||||||
let g:wiki_root='~/.zk'
|
let g:wiki_root=g:zk_path
|
||||||
let g:wiki_global_load=0
|
let g:wiki_global_load=0
|
||||||
let g:wiki_link_creation = {
|
let g:wiki_link_creation = {
|
||||||
\ 'md': {
|
\ 'md': {
|
||||||
|
|||||||
12
dots/.config/nvim/flake.lock
generated
12
dots/.config/nvim/flake.lock
generated
@@ -42,11 +42,11 @@
|
|||||||
},
|
},
|
||||||
"nixCats": {
|
"nixCats": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774835836,
|
"lastModified": 1777273601,
|
||||||
"narHash": "sha256-6ok7iv/9R82vl6MYe3Lwyyb6S5bmW2PxEZtmjzlqyPs=",
|
"narHash": "sha256-xBUa8Tl9V7IXI+VmLEuDc81La/EhoSn1C3EVSnJ3cfU=",
|
||||||
"owner": "BirdeeHub",
|
"owner": "BirdeeHub",
|
||||||
"repo": "nixCats-nvim",
|
"repo": "nixCats-nvim",
|
||||||
"rev": "ebb9f279a55ca60ff4e37e4accf6518dc627aa8d",
|
"rev": "f69ea013e328841a7def7037ed59788a76be8816",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -73,11 +73,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775608838,
|
"lastModified": 1777270315,
|
||||||
"narHash": "sha256-2ySoGH+SAi34U0PeuQgABC0WiH9LQ3tkyHTiE93KUeg=",
|
"narHash": "sha256-yKB4G6cKsQsWN7M6rZGk6gkJPDNPIzT05y4qzRyCDlI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9a01fad67a57e44e1b3e1d905c6881bcfb209e8a",
|
"rev": "6368eda62c9775c38ef7f714b2555a741c20c72d",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -45,13 +45,38 @@
|
|||||||
inherit (nixCats) utils;
|
inherit (nixCats) utils;
|
||||||
luaPath = ./.;
|
luaPath = ./.;
|
||||||
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
|
forEachSystem = utils.eachSystem nixpkgs.lib.platforms.all;
|
||||||
extra_pkg_config = { };
|
extra_pkg_config = {
|
||||||
|
allowUnfreePredicate =
|
||||||
|
pkg:
|
||||||
|
builtins.elem (nixpkgs.lib.getName pkg) [
|
||||||
|
"vim-sandwich"
|
||||||
|
"jupytext.nvim"
|
||||||
|
"eyeliner.nvim"
|
||||||
|
"context_filetype.vim"
|
||||||
|
"editorconfig-vim"
|
||||||
|
"unicode.vim"
|
||||||
|
"quarto-nvim"
|
||||||
|
"vim-openscad"
|
||||||
|
"lsp_lines.nvim"
|
||||||
|
"nvim-highlight-colors"
|
||||||
|
"nvim-lint"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
mkDependencyOverlays = system: [
|
mkDependencyOverlays = system: [
|
||||||
(utils.standardPluginOverlay inputs)
|
(utils.standardPluginOverlay inputs)
|
||||||
(_final: _prev: {
|
(_final: _prev: {
|
||||||
mcp-hub = inputs.mcp-hub.packages.${system}.default;
|
mcp-hub = inputs.mcp-hub.packages.${system}.default;
|
||||||
})
|
})
|
||||||
|
(_: prev: {
|
||||||
|
luajitPackages = prev.luajitPackages.overrideScope (
|
||||||
|
_: lprev: {
|
||||||
|
neotest = lprev.neotest.overrideAttrs (_: {
|
||||||
|
doCheck = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
categoryDefinitions =
|
categoryDefinitions =
|
||||||
@@ -62,9 +87,11 @@
|
|||||||
{
|
{
|
||||||
lspsAndRuntimeDeps = with pkgs; {
|
lspsAndRuntimeDeps = with pkgs; {
|
||||||
general = [
|
general = [
|
||||||
|
nodejs_24
|
||||||
black
|
black
|
||||||
clang
|
clang
|
||||||
clang-tools
|
clang-tools
|
||||||
|
curl # → plenary-nvim, mcp-hub
|
||||||
delta
|
delta
|
||||||
emmet-language-server
|
emmet-language-server
|
||||||
eslint_d
|
eslint_d
|
||||||
@@ -78,6 +105,8 @@
|
|||||||
mcp-hub
|
mcp-hub
|
||||||
nixd
|
nixd
|
||||||
nixfmt
|
nixfmt
|
||||||
|
prettier
|
||||||
|
typescript-language-server
|
||||||
ormolu
|
ormolu
|
||||||
prettierd
|
prettierd
|
||||||
rust-analyzer
|
rust-analyzer
|
||||||
@@ -86,6 +115,7 @@
|
|||||||
stylelint
|
stylelint
|
||||||
stylua
|
stylua
|
||||||
tree-sitter
|
tree-sitter
|
||||||
|
tailwindcss-language-server
|
||||||
typescript-language-server
|
typescript-language-server
|
||||||
vscode-langservers-extracted
|
vscode-langservers-extracted
|
||||||
vtsls
|
vtsls
|
||||||
|
|||||||
@@ -9,5 +9,6 @@ vim.filetype.add({
|
|||||||
["%.env.*"] = "dotenv",
|
["%.env.*"] = "dotenv",
|
||||||
["%.pl$"] = "prolog",
|
["%.pl$"] = "prolog",
|
||||||
[".*.containerfile.*"] = "dockerfile",
|
[".*.containerfile.*"] = "dockerfile",
|
||||||
|
["%.hydra$"] = "javascript",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -13,13 +13,19 @@ local function get_markdown_files(base)
|
|||||||
return items
|
return items
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function source:get_keyword_pattern()
|
||||||
|
return "[%w%./%-]*"
|
||||||
|
end
|
||||||
|
|
||||||
function source:complete(params, callback)
|
function source:complete(params, callback)
|
||||||
local cursor_before_line = params.context.cursor_before_line
|
local cursor_before_line = params.context.cursor_before_line
|
||||||
local cursor_after_line = params.context.cursor_after_line or ""
|
local cursor_after_line = params.context.cursor_after_line or ""
|
||||||
|
|
||||||
local trigger = cursor_before_line:match("%[[^%]]*%]%(([^)]*)$")
|
if not cursor_before_line:match("%[[^%]]*%]%(") then
|
||||||
|
callback({})
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if trigger ~= nil then
|
|
||||||
local items = get_markdown_files(".")
|
local items = get_markdown_files(".")
|
||||||
local next_char = cursor_after_line:sub(1, 1)
|
local next_char = cursor_after_line:sub(1, 1)
|
||||||
|
|
||||||
@@ -32,9 +38,6 @@ function source:complete(params, callback)
|
|||||||
end
|
end
|
||||||
|
|
||||||
callback(items)
|
callback(items)
|
||||||
else
|
|
||||||
callback({})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function source:get_trigger_characters()
|
function source:get_trigger_characters()
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
require("zk.cmp")
|
require("zk.cmp")
|
||||||
|
require("zk.utils")
|
||||||
|
|
||||||
vim.cmd([[
|
vim.cmd([[
|
||||||
let s:zk_preview_enabled = 0
|
let s:zk_preview_enabled = 0
|
||||||
let s:live_server_job = -1
|
let s:live_server_job = -1
|
||||||
au BufEnter /home/h/.zk/*.md silent exe '!echo "%" > /home/h/.zk/current-zettel.txt'
|
execute 'au BufEnter' g:zk_path . '/*.md' 'silent exe "!echo %" ">" g:zk_path . "/current-zettel.txt"'
|
||||||
function! ToggleZKPreview()
|
function! ToggleZKPreview()
|
||||||
if s:zk_preview_enabled == 1
|
if s:zk_preview_enabled == 1
|
||||||
let s:zk_preview_enabled = 0
|
let s:zk_preview_enabled = 0
|
||||||
@@ -11,10 +12,10 @@ function! ToggleZKPreview()
|
|||||||
au! ZKPreview
|
au! ZKPreview
|
||||||
else
|
else
|
||||||
let s:zk_preview_enabled = 1
|
let s:zk_preview_enabled = 1
|
||||||
let s:live_server_job = jobstart('live-server --watch=/home/h/.zk/current-zettel-content.html --open=current-zettel-content.html --port=8080')
|
let s:live_server_job = jobstart('live-server --watch=' . g:zk_path . '/current-zettel-content.html --open=current-zettel-content.html --port=8080')
|
||||||
augroup ZKPreview
|
augroup ZKPreview
|
||||||
au BufEnter /home/h/.zk/*.md silent exe '!cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
execute 'au BufEnter' g:zk_path . '/*.md' 'silent exe "!cat %:r.html" ">" g:zk_path . "/current-zettel-content.html"'
|
||||||
au BufWritePost /home/h/.zk/*.md silent exe '!make && cat "%:r.html" > /home/h/.zk/current-zettel-content.html'
|
execute 'au BufWritePost' g:zk_path . '/*.md' 'silent exe "!make && cat %:r.html" ">" g:zk_path . "/current-zettel-content.html"'
|
||||||
augroup END
|
augroup END
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
2
dots/.config/nvim/lua/zk/utils.lua
Normal file
2
dots/.config/nvim/lua/zk/utils.lua
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
vim.g.zk_path = os.getenv("ZK_PATH") or (os.getenv("HOME") .. "/.zk")
|
||||||
|
return vim.g.zk_path
|
||||||
@@ -1 +0,0 @@
|
|||||||
set -g status-style bg=colour12,fg=colour0
|
|
||||||
@@ -70,8 +70,6 @@ set -g status-right '#(uptime | cut -f 4-5 -d " " | cut -f 1 -d ",") %a %l:%M:%S
|
|||||||
|
|
||||||
set -g default-terminal "tmux-256color"
|
set -g default-terminal "tmux-256color"
|
||||||
|
|
||||||
set-hook -g after-new-session 'if -F "#{==:#{session_name},ssh}" "source ${XDG_CONFIG_HOME}/tmux/hooks/tmux.ssh.conf" "source ${XDG_CONFIG_HOME}/tmux/hooks/tmux.regular.conf"'
|
|
||||||
|
|
||||||
# Vi copypaste mode
|
# Vi copypaste mode
|
||||||
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 4 \)'" 'bind-key -Tcopy-mode-vi v send -X begin-selection; bind-key -Tcopy-mode-vi y send -X copy-selection-and-cancel'
|
if-shell "test '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -ge 4 \)'" 'bind-key -Tcopy-mode-vi v send -X begin-selection; bind-key -Tcopy-mode-vi y send -X copy-selection-and-cancel'
|
||||||
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 4\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'bind-key -t vi-copy v begin-selection; bind-key -t vi-copy y copy-selection'
|
if-shell '\( #{$TMUX_VERSION_MAJOR} -eq 2 -a #{$TMUX_VERSION_MINOR} -lt 4\) -o #{$TMUX_VERSION_MAJOR} -le 1' 'bind-key -t vi-copy v begin-selection; bind-key -t vi-copy y copy-selection'
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
|
|
||||||
SLOTS_FILE = "/home/h/.local/share/task/add_slots"
|
|
||||||
|
|
||||||
def get_slots():
|
|
||||||
try:
|
|
||||||
with open(SLOTS_FILE, "r") as f:
|
|
||||||
return int(f.read().strip())
|
|
||||||
except:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
slots = get_slots()
|
|
||||||
|
|
||||||
if slots <= 0:
|
|
||||||
print(f"Cannot add task: No slots available (0/{slots}).")
|
|
||||||
print("Delete or complete a task first to earn an add slot.")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
with open(SLOTS_FILE, "w") as f:
|
|
||||||
f.write(str(slots - 1))
|
|
||||||
|
|
||||||
print(f"Task added. Slots remaining: {slots - 1}")
|
|
||||||
|
|
||||||
for line in sys.stdin:
|
|
||||||
task = json.loads(line)
|
|
||||||
print(json.dumps(task))
|
|
||||||
sys.exit(0)
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import sys
|
|
||||||
import json
|
|
||||||
|
|
||||||
SLOTS_FILE = "/home/h/.local/share/task/add_slots"
|
|
||||||
|
|
||||||
def get_slots():
|
|
||||||
try:
|
|
||||||
with open(SLOTS_FILE, "r") as f:
|
|
||||||
return int(f.read().strip())
|
|
||||||
except:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
data = sys.stdin.read().strip().split("\n")
|
|
||||||
if len(data) < 2:
|
|
||||||
for line in data:
|
|
||||||
if line:
|
|
||||||
print(line)
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
old_task = json.loads(data[0])
|
|
||||||
new_task = json.loads(data[1])
|
|
||||||
|
|
||||||
was_pending = old_task.get("status") == "pending"
|
|
||||||
is_not_pending = new_task.get("status") in ("completed", "deleted")
|
|
||||||
|
|
||||||
if was_pending and is_not_pending:
|
|
||||||
slots = get_slots() + 1
|
|
||||||
with open(SLOTS_FILE, "w") as f:
|
|
||||||
f.write(str(slots))
|
|
||||||
print(f"Slot earned! Total slots: {slots}")
|
|
||||||
|
|
||||||
print(json.dumps(new_task))
|
|
||||||
sys.exit(0)
|
|
||||||
128
flake.lock
generated
128
flake.lock
generated
@@ -38,11 +38,11 @@
|
|||||||
"base16-helix": {
|
"base16-helix": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1760703920,
|
"lastModified": 1776754714,
|
||||||
"narHash": "sha256-m82fGUYns4uHd+ZTdoLX2vlHikzwzdu2s2rYM2bNwzw=",
|
"narHash": "sha256-E3OAK27smtATTmX45uoTSRsVD+Y+ZiVVfgM/tjpbtYg=",
|
||||||
"owner": "tinted-theming",
|
"owner": "tinted-theming",
|
||||||
"repo": "base16-helix",
|
"repo": "base16-helix",
|
||||||
"rev": "d646af9b7d14bff08824538164af99d0c521b185",
|
"rev": "4d508123037e7851ad36ebf7d9c48b0e9e1eb581",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -121,11 +121,11 @@
|
|||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "pkgs/firefox-addons",
|
"dir": "pkgs/firefox-addons",
|
||||||
"lastModified": 1774843378,
|
"lastModified": 1778040175,
|
||||||
"narHash": "sha256-8QLbY8F7UdxeQaW0KUVgr1/YPIupe+1lGjS5joR+ZCw=",
|
"narHash": "sha256-SSXJp3BMjO2LrW/VLjNdGGcjd3RFEyV4FemYA6OGrYw=",
|
||||||
"owner": "rycee",
|
"owner": "rycee",
|
||||||
"repo": "nur-expressions",
|
"repo": "nur-expressions",
|
||||||
"rev": "0a31b668e3ebb599f95dc518076d709e8dddb57c",
|
"rev": "3bd76b0f41e65661866bddcac57ebe83aeadb581",
|
||||||
"type": "gitlab"
|
"type": "gitlab"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -138,11 +138,11 @@
|
|||||||
"firefox-gnome-theme": {
|
"firefox-gnome-theme": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1764873433,
|
"lastModified": 1776136500,
|
||||||
"narHash": "sha256-1XPewtGMi+9wN9Ispoluxunw/RwozuTRVuuQOmxzt+A=",
|
"narHash": "sha256-r0gN2brVWA351zwMV0Flmlcd6SGMvYqFbvC3DfKFM8Y=",
|
||||||
"owner": "rafaelmardojai",
|
"owner": "rafaelmardojai",
|
||||||
"repo": "firefox-gnome-theme",
|
"repo": "firefox-gnome-theme",
|
||||||
"rev": "f7ffd917ac0d253dbd6a3bf3da06888f57c69f92",
|
"rev": "0f8ba203d475587f477e7ae12661bd8459e225b7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -213,11 +213,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767609335,
|
"lastModified": 1775087534,
|
||||||
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
|
"narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
|
"rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -284,11 +284,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775036584,
|
"lastModified": 1776796298,
|
||||||
"narHash": "sha256-zW0lyy7ZNNT/x8JhzFHBsP2IPx7ATZIPai4FJj12BgU=",
|
"narHash": "sha256-PcRvlWayisPSjd0UcRQbhG8Oqw78AcPE6x872cPRHN8=",
|
||||||
"owner": "cachix",
|
"owner": "cachix",
|
||||||
"repo": "git-hooks.nix",
|
"repo": "git-hooks.nix",
|
||||||
"rev": "4e0eb042b67d863b1b34b3f64d52ceb9cd926735",
|
"rev": "3cfd774b0a530725a077e17354fbdb87ea1c4aad",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -321,20 +321,18 @@
|
|||||||
"gnome-shell": {
|
"gnome-shell": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"host": "gitlab.gnome.org",
|
|
||||||
"lastModified": 1767737596,
|
"lastModified": 1767737596,
|
||||||
"narHash": "sha256-eFujfIUQDgWnSJBablOuG+32hCai192yRdrNHTv0a+s=",
|
"narHash": "sha256-eFujfIUQDgWnSJBablOuG+32hCai192yRdrNHTv0a+s=",
|
||||||
"owner": "GNOME",
|
"owner": "GNOME",
|
||||||
"repo": "gnome-shell",
|
"repo": "gnome-shell",
|
||||||
"rev": "ef02db02bf0ff342734d525b5767814770d85b49",
|
"rev": "ef02db02bf0ff342734d525b5767814770d85b49",
|
||||||
"type": "gitlab"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"host": "gitlab.gnome.org",
|
|
||||||
"owner": "GNOME",
|
"owner": "GNOME",
|
||||||
"ref": "gnome-49",
|
|
||||||
"repo": "gnome-shell",
|
"repo": "gnome-shell",
|
||||||
"type": "gitlab"
|
"rev": "ef02db02bf0ff342734d525b5767814770d85b49",
|
||||||
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"home-manager": {
|
"home-manager": {
|
||||||
@@ -344,11 +342,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1775047159,
|
"lastModified": 1778009629,
|
||||||
"narHash": "sha256-UWM4VZvfKaPwA9FMu7iZha5YAE8vsEtUazk+rFxmbTY=",
|
"narHash": "sha256-nUoQtf4Zq7DRYJrfv904hjrxjAlWVP6a1pNNFKx3FCg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "1ce9e62690dfdd7e76bd266ccb9a887778410eb2",
|
"rev": "00ed86e58bb6979a7921859fd1615d19382eac5c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -400,10 +398,10 @@
|
|||||||
"nix-secrets": {
|
"nix-secrets": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1773999602,
|
"lastModified": 1776723456,
|
||||||
"narHash": "sha256-Th4RuCEPHC8y1w/wrW9OSv9nAJ3/NSZ3MJ4DHhCXCKE=",
|
"narHash": "sha256-GBbbm05oXYqSZ2EgxQPsNpTKl16wNhvrlUxdmv0FbSU=",
|
||||||
"ref": "main",
|
"ref": "main",
|
||||||
"rev": "6f4b099a0c5ad1cca97f4ba1a665faaaed367f13",
|
"rev": "135b681d24af6ee4508bbf7c657982d7be8743d4",
|
||||||
"shallow": true,
|
"shallow": true,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "ssh://git@github.com/hektor/nix-secrets"
|
"url": "ssh://git@github.com/hektor/nix-secrets"
|
||||||
@@ -417,11 +415,11 @@
|
|||||||
},
|
},
|
||||||
"nixCats": {
|
"nixCats": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1770584904,
|
"lastModified": 1777273601,
|
||||||
"narHash": "sha256-9Zaz8lbKF2W9pwXZEnbiGsicHdBoU+dHt3Wv3mCJoZ8=",
|
"narHash": "sha256-xBUa8Tl9V7IXI+VmLEuDc81La/EhoSn1C3EVSnJ3cfU=",
|
||||||
"owner": "BirdeeHub",
|
"owner": "BirdeeHub",
|
||||||
"repo": "nixCats-nvim",
|
"repo": "nixCats-nvim",
|
||||||
"rev": "538fdde784d2909700d97a8ef307783b33a86fb1",
|
"rev": "f69ea013e328841a7def7037ed59788a76be8816",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -453,11 +451,11 @@
|
|||||||
},
|
},
|
||||||
"nixos-hardware": {
|
"nixos-hardware": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774933469,
|
"lastModified": 1777917524,
|
||||||
"narHash": "sha256-OrnCQeUO2bqaWUl0lkDWyGWjKsOhtCyd7JSfTedQNUE=",
|
"narHash": "sha256-k+LVe9YaO2BEPB9AaCtTtOMCeGi4dxDo6gt4Un3qoPY=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixos-hardware",
|
"repo": "nixos-hardware",
|
||||||
"rev": "f4c4c2c0c923d7811ac2a63ccc154767e4195337",
|
"rev": "df7783100babf59001340a7a874ba3824e441ecb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -469,11 +467,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774709303,
|
"lastModified": 1777954456,
|
||||||
"narHash": "sha256-D3Q07BbIA2KnTcSXIqqu9P586uWxN74zNoCH3h2ESHg=",
|
"narHash": "sha256-hGdgeU2Nk87RAuZyYjyDjFL6LK7dAZN5RE9+hrDTkDU=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "8110df5ad7abf5d4c0f6fb0f8f978390e77f9685",
|
"rev": "549bd84d6279f9852cae6225e372cc67fb91a4c1",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -511,11 +509,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767810917,
|
"lastModified": 1777598946,
|
||||||
"narHash": "sha256-ZKqhk772+v/bujjhla9VABwcvz+hB2IaRyeLT6CFnT0=",
|
"narHash": "sha256-X239dAGaU1+gfDj8jKH8GzlqKMcxaVfXOio+uzBOkeE=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "dead29c804adc928d3a69dfe7f9f12d0eec1f1a4",
|
"rev": "5d55af01c0f86be583931fe99207fc56c14134b3",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -567,11 +565,11 @@
|
|||||||
"plugins-helm-ls-nvim": {
|
"plugins-helm-ls-nvim": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1768584652,
|
"lastModified": 1773934114,
|
||||||
"narHash": "sha256-jnMc87OjURNcqsva0npYgVyUrWc5C6L7yHpNvt9eSmg=",
|
"narHash": "sha256-8trqFsA7nTKSdtkiAL0Sa9bXjh5ONtAqN7XNE/B8ukM=",
|
||||||
"owner": "qvalentin",
|
"owner": "qvalentin",
|
||||||
"repo": "helm-ls.nvim",
|
"repo": "helm-ls.nvim",
|
||||||
"rev": "f0b9a1723890971a6d84890b50dbf5f40974ea1b",
|
"rev": "20df43509b02a3ce3c6b3eee254d6e2bffa9a370",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -667,11 +665,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774910634,
|
"lastModified": 1777944972,
|
||||||
"narHash": "sha256-B+rZDPyktGEjOMt8PcHKYmgmKoF+GaNAFJhguktXAo0=",
|
"narHash": "sha256-VfGRo1qTBKOe3s2gOv8LSoA6Fk19PvBlwQ1ECN0Evn8=",
|
||||||
"owner": "Mic92",
|
"owner": "Mic92",
|
||||||
"repo": "sops-nix",
|
"repo": "sops-nix",
|
||||||
"rev": "19bf3d8678fbbfbc173beaa0b5b37d37938db301",
|
"rev": "c591bf665727040c6cc5cb409079acb22dcce33c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -710,18 +708,17 @@
|
|||||||
],
|
],
|
||||||
"nur": "nur",
|
"nur": "nur",
|
||||||
"systems": "systems_2",
|
"systems": "systems_2",
|
||||||
"tinted-foot": "tinted-foot",
|
|
||||||
"tinted-kitty": "tinted-kitty",
|
"tinted-kitty": "tinted-kitty",
|
||||||
"tinted-schemes": "tinted-schemes",
|
"tinted-schemes": "tinted-schemes",
|
||||||
"tinted-tmux": "tinted-tmux",
|
"tinted-tmux": "tinted-tmux",
|
||||||
"tinted-zed": "tinted-zed"
|
"tinted-zed": "tinted-zed"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1774897726,
|
"lastModified": 1777835090,
|
||||||
"narHash": "sha256-k/H2/oyex6GEC6uYXYetrboFQeTmX1Ouwv/zaW7b/Z0=",
|
"narHash": "sha256-VLH8zPweblCOvpnQXp4fVs7f6Q79YhXF5XFKlOrvIFk=",
|
||||||
"owner": "danth",
|
"owner": "danth",
|
||||||
"repo": "stylix",
|
"repo": "stylix",
|
||||||
"rev": "9b4a5eb409ceac2dd6ad495c7988e189a418cd30",
|
"rev": "7989a1054b01153212dede6005abfd1576b8328c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -760,23 +757,6 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tinted-foot": {
|
|
||||||
"flake": false,
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1726913040,
|
|
||||||
"narHash": "sha256-+eDZPkw7efMNUf3/Pv0EmsidqdwNJ1TaOum6k7lngDQ=",
|
|
||||||
"owner": "tinted-theming",
|
|
||||||
"repo": "tinted-foot",
|
|
||||||
"rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "tinted-theming",
|
|
||||||
"repo": "tinted-foot",
|
|
||||||
"rev": "fd1b924b6c45c3e4465e8a849e67ea82933fcbe4",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"tinted-kitty": {
|
"tinted-kitty": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@@ -796,11 +776,11 @@
|
|||||||
"tinted-schemes": {
|
"tinted-schemes": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767710407,
|
"lastModified": 1777041405,
|
||||||
"narHash": "sha256-+W1EB79Jl0/gm4JqmO0Nuc5C7hRdp4vfsV/VdzI+des=",
|
"narHash": "sha256-BAGZ7ObFV/9Z61OJZun7ifPyhkuHqNuW1QIhQ8LuzCo=",
|
||||||
"owner": "tinted-theming",
|
"owner": "tinted-theming",
|
||||||
"repo": "schemes",
|
"repo": "schemes",
|
||||||
"rev": "2800e2b8ac90f678d7e4acebe4fa253f602e05b2",
|
"rev": "5f868b3a338b6904c47f3833b9c411be641983a8",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -812,11 +792,11 @@
|
|||||||
"tinted-tmux": {
|
"tinted-tmux": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767489635,
|
"lastModified": 1777169200,
|
||||||
"narHash": "sha256-e6nnFnWXKBCJjCv4QG4bbcouJ6y3yeT70V9MofL32lU=",
|
"narHash": "sha256-h7dDbIzP5hDr9v97w9PL6jdAgXawmj6krcH+959rqpU=",
|
||||||
"owner": "tinted-theming",
|
"owner": "tinted-theming",
|
||||||
"repo": "tinted-tmux",
|
"repo": "tinted-tmux",
|
||||||
"rev": "3c32729ccae99be44fe8a125d20be06f8d7d8184",
|
"rev": "f798c2dce44ef815bb6b8f05a82135c7942d35ac",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -828,11 +808,11 @@
|
|||||||
"tinted-zed": {
|
"tinted-zed": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1767488740,
|
"lastModified": 1777463218,
|
||||||
"narHash": "sha256-wVOj0qyil8m+ouSsVZcNjl5ZR+1GdOOAooAatQXHbuU=",
|
"narHash": "sha256-Bhkozqtq3BKLqWTlmKm8uAptfX4aRGI8QX3eEL54Vpc=",
|
||||||
"owner": "tinted-theming",
|
"owner": "tinted-theming",
|
||||||
"repo": "base16-zed",
|
"repo": "base16-zed",
|
||||||
"rev": "11abb0b282ad3786a2aae088d3a01c60916f2e40",
|
"rev": "5768d08ed2e7944a26a958868cdb073cb8856dae",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -76,7 +76,10 @@
|
|||||||
nixpkgs.lib.nixosSystem {
|
nixpkgs.lib.nixosSystem {
|
||||||
modules = [
|
modules = [
|
||||||
./hosts/${host}
|
./hosts/${host}
|
||||||
{ nixpkgs.hostPlatform = import ./hosts/${host}/system.nix; }
|
{
|
||||||
|
nixpkgs.hostPlatform = (myUtils.hostMeta ./hosts/${host}).system;
|
||||||
|
host.name = host;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit
|
inherit
|
||||||
|
|||||||
@@ -25,10 +25,12 @@
|
|||||||
../../modules/nvim
|
../../modules/nvim
|
||||||
../../modules/pandoc
|
../../modules/pandoc
|
||||||
../../modules/photography
|
../../modules/photography
|
||||||
|
../../modules/secrets
|
||||||
../../modules/shell
|
../../modules/shell
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/taskwarrior
|
../../modules/taskwarrior
|
||||||
../../modules/terminal
|
../../modules/terminal
|
||||||
|
../../modules/zk
|
||||||
../../modules/torrenting
|
../../modules/torrenting
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -45,7 +47,10 @@
|
|||||||
printing.enable = true;
|
printing.enable = true;
|
||||||
modeling.enable = true;
|
modeling.enable = true;
|
||||||
};
|
};
|
||||||
ai-tools.opencode.enable = true;
|
ai-tools = {
|
||||||
|
claude-code.enable = true;
|
||||||
|
opencode.enable = true;
|
||||||
|
};
|
||||||
browser.primary = "librewolf";
|
browser.primary = "librewolf";
|
||||||
cloud.hetzner.enable = true;
|
cloud.hetzner.enable = true;
|
||||||
comms.signal.enable = true;
|
comms.signal.enable = true;
|
||||||
@@ -53,6 +58,7 @@
|
|||||||
shell.bash.aliases.lang-js = true;
|
shell.bash.aliases.lang-js = true;
|
||||||
shell.bash.addBinToPath = true;
|
shell.bash.addBinToPath = true;
|
||||||
torrenting.enable = true;
|
torrenting.enable = true;
|
||||||
|
zk.enable = true;
|
||||||
|
|
||||||
programs = {
|
programs = {
|
||||||
home-manager.enable = true;
|
home-manager.enable = true;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
../../modules/cloud
|
../../modules/cloud
|
||||||
../../modules/comms
|
../../modules/comms
|
||||||
../../modules/desktop/niri
|
../../modules/desktop/niri
|
||||||
|
../../modules/devenv
|
||||||
../../modules/direnv
|
../../modules/direnv
|
||||||
../../modules/git
|
../../modules/git
|
||||||
../../modules/k8s/k9s.nix
|
../../modules/k8s/k9s.nix
|
||||||
@@ -23,6 +24,7 @@
|
|||||||
../../modules/nfc
|
../../modules/nfc
|
||||||
../../modules/nvim
|
../../modules/nvim
|
||||||
../../modules/pandoc
|
../../modules/pandoc
|
||||||
|
../../modules/secrets
|
||||||
../../modules/shell
|
../../modules/shell
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/taskwarrior
|
../../modules/taskwarrior
|
||||||
@@ -35,11 +37,16 @@
|
|||||||
homeDirectory = "/home/${config.host.username}";
|
homeDirectory = "/home/${config.host.username}";
|
||||||
};
|
};
|
||||||
|
|
||||||
xdg.userDirs.createDirectories = false;
|
xdg.userDirs = {
|
||||||
xdg.userDirs.download = "${config.home.homeDirectory}/dl";
|
enable = false;
|
||||||
|
createDirectories = false;
|
||||||
|
};
|
||||||
|
|
||||||
modules."3d".printing.enable = true;
|
modules."3d".printing.enable = true;
|
||||||
ai-tools.opencode.enable = true;
|
ai-tools = {
|
||||||
|
claude-code.enable = true;
|
||||||
|
opencode.enable = true;
|
||||||
|
};
|
||||||
browser.primary = "librewolf";
|
browser.primary = "librewolf";
|
||||||
cloud.hetzner.enable = true;
|
cloud.hetzner.enable = true;
|
||||||
comms.signal.enable = true;
|
comms.signal.enable = true;
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
username = "hektor";
|
|
||||||
in
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
inputs.sops-nix.homeManagerModules.sops
|
inputs.sops-nix.homeManagerModules.sops
|
||||||
@@ -21,6 +18,7 @@ in
|
|||||||
../../modules/database
|
../../modules/database
|
||||||
../../modules/dconf
|
../../modules/dconf
|
||||||
../../modules/desktop/niri
|
../../modules/desktop/niri
|
||||||
|
../../modules/devenv
|
||||||
../../modules/direnv
|
../../modules/direnv
|
||||||
../../modules/docker
|
../../modules/docker
|
||||||
../../modules/git
|
../../modules/git
|
||||||
@@ -46,12 +44,18 @@ in
|
|||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
xdg.systemDirs.config = [ "/etc/xdg" ];
|
xdg = {
|
||||||
|
systemDirs.config = [ "/etc/xdg" ];
|
||||||
|
userDirs = {
|
||||||
|
createDirectories = false;
|
||||||
|
download = "${config.home.homeDirectory}/dl";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
stateVersion = "25.05";
|
stateVersion = "25.05";
|
||||||
inherit username;
|
username = "hektor";
|
||||||
homeDirectory = "/home/${username}";
|
homeDirectory = "/home/${config.home.username}";
|
||||||
};
|
};
|
||||||
|
|
||||||
targets.genericLinux.nixGL = {
|
targets.genericLinux.nixGL = {
|
||||||
@@ -69,8 +73,11 @@ in
|
|||||||
tirith.enable = true;
|
tirith.enable = true;
|
||||||
opencode.enable = true;
|
opencode.enable = true;
|
||||||
};
|
};
|
||||||
database.mssql.enable = true;
|
database = {
|
||||||
database.postgresql.enable = true;
|
mssql.enable = true;
|
||||||
|
postgresql.enable = true;
|
||||||
|
redis.enable = true;
|
||||||
|
};
|
||||||
git.github.enable = true;
|
git.github.enable = true;
|
||||||
git.gitlab.enable = true;
|
git.gitlab.enable = true;
|
||||||
secrets.vault.enable = true;
|
secrets.vault.enable = true;
|
||||||
|
|||||||
60
home/modules/ai-tools/claude-code.nix
Normal file
60
home/modules/ai-tools/claude-code.nix
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.ai-tools.claude-code;
|
||||||
|
rtk-version = "0.18.1";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.ai-tools.claude-code.enable = lib.mkEnableOption "claude code with rtk and ccline";
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
programs.claude-code.enable = true;
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
(stdenv.mkDerivation {
|
||||||
|
name = "ccline";
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://github.com/Haleclipse/CCometixLine/releases/download/v1.0.8/ccline-linux-x64.tar.gz";
|
||||||
|
hash = "sha256-Joe3Dd6uSMGi66QT6xr2oY/Tz8rA5RuKa6ckBVJIzI0=";
|
||||||
|
};
|
||||||
|
unpackPhase = "tar xzf $src";
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp ccline $out/bin/
|
||||||
|
chmod +x $out/bin/ccline
|
||||||
|
'';
|
||||||
|
meta = {
|
||||||
|
description = "CCometixLine Linux x64 CLI (Claude Code statusline)";
|
||||||
|
homepage = "https://github.com/Haleclipse/CCometixLine";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(stdenv.mkDerivation {
|
||||||
|
name = "rtk-${rtk-version}";
|
||||||
|
version = rtk-version;
|
||||||
|
src = fetchurl {
|
||||||
|
url = "https://github.com/rtk-ai/rtk/releases/download/v${rtk-version}/rtk-x86_64-unknown-linux-gnu.tar.gz";
|
||||||
|
hash = "sha256-XoTia5K8b00OzcKYCufwx8ApkAS31DxUCpGSU0jFs2Q=";
|
||||||
|
};
|
||||||
|
unpackPhase = "tar xzf $src";
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp rtk $out/bin/
|
||||||
|
chmod +x $out/bin/rtk
|
||||||
|
'';
|
||||||
|
meta = {
|
||||||
|
description = "RTK - AI coding tool enhancer";
|
||||||
|
homepage = "https://www.rtk-ai.app";
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
};
|
||||||
|
})
|
||||||
|
mcp-nixos
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,116 +1,8 @@
|
|||||||
{
|
{
|
||||||
lib,
|
imports = [
|
||||||
config,
|
./claude-code.nix
|
||||||
pkgs,
|
./opencode.nix
|
||||||
...
|
./skills.nix
|
||||||
}:
|
./tirith.nix
|
||||||
let
|
|
||||||
cfg = config.ai-tools;
|
|
||||||
rtk-version = "0.18.1";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
options.ai-tools = {
|
|
||||||
claude-code.enable = lib.mkEnableOption "claude code with rtk and ccline";
|
|
||||||
tirith.enable = lib.mkEnableOption "tirith shell security guard";
|
|
||||||
opencode.enable = lib.mkEnableOption "opencode";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = lib.mkMerge [
|
|
||||||
(lib.mkIf cfg.claude-code.enable {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
claude-code
|
|
||||||
(pkgs.stdenv.mkDerivation {
|
|
||||||
name = "ccline";
|
|
||||||
src = pkgs.fetchurl {
|
|
||||||
url = "https://github.com/Haleclipse/CCometixLine/releases/download/v1.0.8/ccline-linux-x64.tar.gz";
|
|
||||||
hash = "sha256-Joe3Dd6uSMGi66QT6xr2oY/Tz8rA5RuKa6ckBVJIzI0=";
|
|
||||||
};
|
|
||||||
|
|
||||||
unpackPhase = ''
|
|
||||||
tar xzf $src
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp ccline $out/bin/
|
|
||||||
chmod +x $out/bin/ccline
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
description = "CCometixLine Linux x64 CLI (Claude Code statusline)";
|
|
||||||
homepage = "https://github.com/Haleclipse/CCometixLine";
|
|
||||||
license = licenses.mit;
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
(pkgs.stdenv.mkDerivation {
|
|
||||||
name = "rtk-${rtk-version}";
|
|
||||||
version = rtk-version;
|
|
||||||
src = pkgs.fetchurl {
|
|
||||||
url = "https://github.com/rtk-ai/rtk/releases/download/v${rtk-version}/rtk-x86_64-unknown-linux-gnu.tar.gz";
|
|
||||||
hash = "sha256-XoTia5K8b00OzcKYCufwx8ApkAS31DxUCpGSU0jFs2Q=";
|
|
||||||
};
|
|
||||||
|
|
||||||
unpackPhase = ''
|
|
||||||
tar xzf $src
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp rtk $out/bin/
|
|
||||||
chmod +x $out/bin/rtk
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
|
||||||
description = "RTK - AI coding tool enhancer";
|
|
||||||
homepage = "https://www.rtk-ai.app";
|
|
||||||
license = licenses.mit;
|
|
||||||
platforms = [ "x86_64-linux" ];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
mcp-nixos
|
|
||||||
];
|
|
||||||
})
|
|
||||||
(lib.mkIf cfg.tirith.enable {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
tirith
|
|
||||||
];
|
|
||||||
})
|
|
||||||
(lib.mkIf (cfg.tirith.enable && cfg.claude-code.enable) {
|
|
||||||
home.file.".claude/hooks/tirith-check.py" = {
|
|
||||||
source = ./tirith-check.py;
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
home.activation.tirith-claude-code = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
|
||||||
${pkgs.tirith}/bin/tirith setup claude-code --with-mcp --scope user --force 2>/dev/null || true
|
|
||||||
'';
|
|
||||||
})
|
|
||||||
(lib.mkIf cfg.opencode.enable {
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
opencode
|
|
||||||
];
|
|
||||||
home.file.".config/opencode/opencode.json".text = builtins.toJSON {
|
|
||||||
"$schema" = "https://opencode.ai/config.json";
|
|
||||||
permission = {
|
|
||||||
external_directory = {
|
|
||||||
"/run/secrets/" = "deny";
|
|
||||||
"~/.config/sops/age/keys.txt" = "deny";
|
|
||||||
"~/.ssh/id_rsa" = "deny";
|
|
||||||
"~/.ssh/id_ed25519" = "deny";
|
|
||||||
"~/.ssh/id_ecdsa" = "deny";
|
|
||||||
"~/.ssh/id_dsa" = "deny";
|
|
||||||
"/etc/ssh/ssh_host_rsa_key" = "deny";
|
|
||||||
"/etc/ssh/ssh_host_ed25519_key" = "deny";
|
|
||||||
"/etc/ssh/ssh_host_ecdsa_key" = "deny";
|
|
||||||
"/etc/ssh/ssh_host_dsa_key" = "deny";
|
|
||||||
};
|
|
||||||
command = {
|
|
||||||
sops = "deny";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
plugin = [ "@mohak34/opencode-notifier@latest" ];
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
40
home/modules/ai-tools/opencode.nix
Normal file
40
home/modules/ai-tools/opencode.nix
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.ai-tools.opencode;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.ai-tools.opencode = {
|
||||||
|
enable = lib.mkEnableOption "opencode";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ pkgs.opencode ];
|
||||||
|
|
||||||
|
home.file.".config/opencode/opencode.json".text = builtins.toJSON {
|
||||||
|
"$schema" = "https://opencode.ai/config.json";
|
||||||
|
permission = {
|
||||||
|
external_directory = {
|
||||||
|
"/run/secrets/" = "deny";
|
||||||
|
"~/.config/sops/age/keys.txt" = "deny";
|
||||||
|
"~/.ssh/id_rsa" = "deny";
|
||||||
|
"~/.ssh/id_ed25519" = "deny";
|
||||||
|
"~/.ssh/id_ecdsa" = "deny";
|
||||||
|
"~/.ssh/id_dsa" = "deny";
|
||||||
|
"/etc/ssh/ssh_host_rsa_key" = "deny";
|
||||||
|
"/etc/ssh/ssh_host_ed25519_key" = "deny";
|
||||||
|
"/etc/ssh/ssh_host_ecdsa_key" = "deny";
|
||||||
|
"/etc/ssh/ssh_host_dsa_key" = "deny";
|
||||||
|
};
|
||||||
|
command = {
|
||||||
|
sops = "deny";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
plugin = [ "@mohak34/opencode-notifier@latest" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
49
home/modules/ai-tools/skills.nix
Normal file
49
home/modules/ai-tools/skills.nix
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.ai-tools.claude-code;
|
||||||
|
|
||||||
|
skillType = lib.types.submodule {
|
||||||
|
options = {
|
||||||
|
owner = lib.mkOption { type = lib.types.str; };
|
||||||
|
repo = lib.mkOption { type = lib.types.str; };
|
||||||
|
rev = lib.mkOption { type = lib.types.str; };
|
||||||
|
hash = lib.mkOption { type = lib.types.str; };
|
||||||
|
skill = lib.mkOption { type = lib.types.str; };
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchSkill =
|
||||||
|
skill:
|
||||||
|
let
|
||||||
|
src = pkgs.fetchFromGitHub {
|
||||||
|
inherit (skill)
|
||||||
|
owner
|
||||||
|
repo
|
||||||
|
rev
|
||||||
|
hash
|
||||||
|
;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
name = ".claude/skills/${skill.skill}";
|
||||||
|
value = {
|
||||||
|
source = "${src}/${skill.skill}";
|
||||||
|
recursive = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.ai-tools.claude-code.skills = lib.mkOption {
|
||||||
|
type = lib.types.listOf skillType;
|
||||||
|
default = [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home.file = builtins.listToAttrs (map fetchSkill cfg.skills);
|
||||||
|
};
|
||||||
|
}
|
||||||
30
home/modules/ai-tools/tirith.nix
Normal file
30
home/modules/ai-tools/tirith.nix
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
cfg = config.ai-tools.tirith;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.ai-tools.tirith = {
|
||||||
|
enable = lib.mkEnableOption "tirith shell security guard";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkMerge [
|
||||||
|
(lib.mkIf cfg.enable {
|
||||||
|
home.packages = [ pkgs.tirith ];
|
||||||
|
})
|
||||||
|
(lib.mkIf (cfg.enable && config.ai-tools.claude-code.enable) {
|
||||||
|
home.file.".claude/hooks/tirith-check.py" = {
|
||||||
|
source = ./tirith-check.py;
|
||||||
|
executable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
home.activation.tirith-claude-code = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
|
||||||
|
${pkgs.tirith}/bin/tirith setup claude-code --with-mcp --scope user --force 2>/dev/null || true
|
||||||
|
'';
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -4,13 +4,23 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
myUtils,
|
myUtils,
|
||||||
osConfig ? null,
|
osConfig ? null,
|
||||||
|
inputs ? null,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
sops = myUtils.sopsAvailability config osConfig;
|
sops = myUtils.sopsAvailability config osConfig;
|
||||||
|
standalone = osConfig == null;
|
||||||
in
|
in
|
||||||
{
|
lib.optionalAttrs standalone {
|
||||||
|
sops.secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
|
||||||
|
anki = [
|
||||||
|
"sync-user"
|
||||||
|
"sync-key"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// {
|
||||||
warnings = lib.optional (
|
warnings = lib.optional (
|
||||||
!sops.available && config.programs.anki.enable
|
!sops.available && config.programs.anki.enable
|
||||||
) "anki is enabled but sops secrets are not available. anki sync will not be configured.";
|
) "anki is enabled but sops secrets are not available. anki sync will not be configured.";
|
||||||
@@ -24,8 +34,8 @@ in
|
|||||||
review-heatmap
|
review-heatmap
|
||||||
];
|
];
|
||||||
profiles."User 1".sync = lib.mkIf sops.available {
|
profiles."User 1".sync = lib.mkIf sops.available {
|
||||||
usernameFile = "${sops.secrets."anki-sync-user".path}";
|
usernameFile = "${sops.secrets."anki/sync-user".path}";
|
||||||
keyFile = "${sops.secrets."anki-sync-key".path}";
|
keyFile = "${sops.secrets."anki/sync-key".path}";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
{ lib, ... }:
|
{ config, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
options.browser = {
|
options.browser = {
|
||||||
@@ -23,6 +23,8 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config.home.sessionVariables.BROWSER = config.browser.primary;
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./firefox.nix
|
./firefox.nix
|
||||||
./librewolf.nix
|
./librewolf.nix
|
||||||
|
|||||||
7
home/modules/clipboard/default.nix
Normal file
7
home/modules/clipboard/default.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
wl-clipboard
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -9,14 +9,18 @@
|
|||||||
options.database = {
|
options.database = {
|
||||||
mssql.enable = lib.mkEnableOption "MSSQL";
|
mssql.enable = lib.mkEnableOption "MSSQL";
|
||||||
postgresql.enable = lib.mkEnableOption "PostgreSQL";
|
postgresql.enable = lib.mkEnableOption "PostgreSQL";
|
||||||
|
redis.enable = lib.mkEnableOption "Redis";
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf config.database.mssql.enable {
|
(lib.mkIf config.database.mssql.enable {
|
||||||
home.packages = [ (config.nixgl.wrap pkgs.dbeaver-bin) ];
|
home.packages = with pkgs; [ (config.nixgl.wrap dbeaver-bin) ];
|
||||||
})
|
})
|
||||||
(lib.mkIf config.database.postgresql.enable {
|
(lib.mkIf config.database.postgresql.enable {
|
||||||
home.packages = [ (config.nixgl.wrap pkgs.pgadmin4-desktopmode) ];
|
home.packages = with pkgs; [ (config.nixgl.wrap pgadmin4-desktopmode) ];
|
||||||
|
})
|
||||||
|
(lib.mkIf config.database.postgresql.enable {
|
||||||
|
home.packages = with pkgs; [ redis ];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
let
|
let
|
||||||
terminal = "kitty";
|
terminal = "kitty";
|
||||||
browser = config.browser.primary;
|
browser = config.browser.primary;
|
||||||
|
font = "${config.stylix.fonts.monospace.name} ${toString config.stylix.fonts.sizes.applications}";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
dconf.settings = {
|
dconf.settings = {
|
||||||
@@ -40,9 +41,9 @@ in
|
|||||||
clock-show-weekday = true;
|
clock-show-weekday = true;
|
||||||
color-scheme = "prefer-dark";
|
color-scheme = "prefer-dark";
|
||||||
enable-hot-corners = false;
|
enable-hot-corners = false;
|
||||||
font-name = "Iosevka Term SS08 12";
|
# font-name = font;
|
||||||
locate-pointer = true;
|
locate-pointer = true;
|
||||||
monospace-font-name = "Iosevka Term SS08 12";
|
monospace-font-name = font;
|
||||||
};
|
};
|
||||||
|
|
||||||
"org/gnome/desktop/wm/keybindings" = {
|
"org/gnome/desktop/wm/keybindings" = {
|
||||||
|
|||||||
@@ -6,13 +6,19 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
options.nixgl.wrap = lib.mkOption {
|
options = {
|
||||||
|
host.username = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = config.home.username;
|
||||||
|
};
|
||||||
|
|
||||||
|
nixgl.wrap = lib.mkOption {
|
||||||
type = lib.types.functionTo lib.types.package;
|
type = lib.types.functionTo lib.types.package;
|
||||||
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
|
default = if config.lib ? nixGL then config.lib.nixGL.wrap else lib.id;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
options.wrapApp = lib.mkOption {
|
wrapApp = lib.mkOption {
|
||||||
type = lib.types.raw;
|
type = lib.types.raw;
|
||||||
default =
|
default =
|
||||||
pkg: flags:
|
pkg: flags:
|
||||||
@@ -27,4 +33,5 @@
|
|||||||
pkg;
|
pkg;
|
||||||
readOnly = true;
|
readOnly = true;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
../../clipboard
|
||||||
../../fuzzel
|
../../fuzzel
|
||||||
../../mako
|
../../mako
|
||||||
../../shikane
|
../../shikane
|
||||||
@@ -12,7 +13,6 @@
|
|||||||
file.".config/niri/config.kdl".source = ./config.kdl;
|
file.".config/niri/config.kdl".source = ./config.kdl;
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
brightnessctl
|
brightnessctl
|
||||||
wl-clipboard
|
|
||||||
wlsunset
|
wlsunset
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -18,6 +18,10 @@
|
|||||||
enableAlias = true;
|
enableAlias = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
home.shellAliases = {
|
||||||
|
k = "kubectl";
|
||||||
|
};
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./helm.nix
|
./helm.nix
|
||||||
./k9s.nix
|
./k9s.nix
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
imports = [ ./vault.nix ];
|
imports = [ ./vault.nix ];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
sops
|
|
||||||
age
|
age
|
||||||
|
age-plugin-yubikey # TODO: only needed when using Yubikey
|
||||||
|
sops
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
{
|
{
|
||||||
outputs,
|
myUtils,
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
nixosConfigs = builtins.attrNames outputs.nixosConfigurations;
|
hostDir = ../../hosts;
|
||||||
homeConfigs = map (n: lib.last (lib.splitString "@" n)) (
|
hostNames = myUtils.dirNames hostDir;
|
||||||
builtins.attrNames outputs.homeConfigurations
|
|
||||||
);
|
|
||||||
allHosts = lib.unique (homeConfigs ++ nixosConfigs);
|
|
||||||
hostsWithKeys = lib.filter (
|
hostsWithKeys = lib.filter (
|
||||||
hostname: builtins.pathExists ../../hosts/${hostname}/ssh_host.pub
|
hostname: builtins.pathExists (hostDir + "/${hostname}/ssh_host.pub")
|
||||||
) allHosts;
|
) hostNames;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home.packages = with pkgs; [ sshfs ];
|
home.packages = with pkgs; [ sshfs ];
|
||||||
@@ -25,15 +22,14 @@ in
|
|||||||
lib.genAttrs hostsWithKeys (
|
lib.genAttrs hostsWithKeys (
|
||||||
hostname:
|
hostname:
|
||||||
let
|
let
|
||||||
hostConfig = outputs.nixosConfigurations.${hostname}.config;
|
meta = myUtils.hostMeta (hostDir + "/${hostname}");
|
||||||
inherit (hostConfig.ssh) publicHostname username;
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
host = hostname;
|
host = hostname;
|
||||||
user = username;
|
user = meta.deployment.targetUser;
|
||||||
}
|
}
|
||||||
// lib.optionalAttrs (publicHostname != "") {
|
// lib.optionalAttrs (meta.deployment.targetHost != "") {
|
||||||
hostname = publicHostname;
|
hostname = meta.deployment.targetHost;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
// {
|
// {
|
||||||
|
|||||||
@@ -25,21 +25,6 @@ in
|
|||||||
sansSerif = config.stylix.fonts.monospace;
|
sansSerif = config.stylix.fonts.monospace;
|
||||||
emoji = config.stylix.fonts.monospace;
|
emoji = config.stylix.fonts.monospace;
|
||||||
};
|
};
|
||||||
targets = {
|
targets = import ../../../modules/stylix/targets.nix;
|
||||||
firefox = {
|
|
||||||
profileNames = [ "default" ];
|
|
||||||
colorTheme.enable = true;
|
|
||||||
};
|
|
||||||
librewolf = {
|
|
||||||
profileNames = [ "default" ];
|
|
||||||
colorTheme.enable = true;
|
|
||||||
};
|
|
||||||
gnome.enable = false;
|
|
||||||
gtk.enable = false;
|
|
||||||
kitty = {
|
|
||||||
variant256Colors = true;
|
|
||||||
};
|
|
||||||
nixvim.enable = false;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,35 @@
|
|||||||
dotsPath,
|
dotsPath,
|
||||||
myUtils,
|
myUtils,
|
||||||
osConfig ? null,
|
osConfig ? null,
|
||||||
|
inputs ? null,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
sops = myUtils.sopsAvailability config osConfig;
|
sops = myUtils.sopsAvailability config osConfig;
|
||||||
|
standalone = osConfig == null;
|
||||||
in
|
in
|
||||||
{
|
lib.optionalAttrs standalone {
|
||||||
|
sops = {
|
||||||
|
secrets = myUtils.mkSopsSecrets "${toString inputs.nix-secrets}/secrets" null {
|
||||||
|
taskwarrior = [
|
||||||
|
"sync-server-url"
|
||||||
|
"sync-server-client-id"
|
||||||
|
"sync-encryption-secret"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
templates."taskrc.d/sync" = {
|
||||||
|
content = ''
|
||||||
|
sync.server.url=${config.sops.placeholder."taskwarrior/sync-server-url"}
|
||||||
|
sync.server.client_id=${config.sops.placeholder."taskwarrior/sync-server-client-id"}
|
||||||
|
sync.encryption_secret=${config.sops.placeholder."taskwarrior/sync-encryption-secret"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
// {
|
||||||
|
|
||||||
warnings =
|
warnings =
|
||||||
lib.optional (!sops.available && config.programs.taskwarrior.enable)
|
lib.optional (!sops.available && config.programs.taskwarrior.enable)
|
||||||
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
|
"taskwarrior is enabled, but sops templates are not available. taskwarrior sync will not be configured.";
|
||||||
@@ -36,14 +58,6 @@ in
|
|||||||
".local/share/task/hooks/on-exit.sync.py" = {
|
".local/share/task/hooks/on-exit.sync.py" = {
|
||||||
source = dotsPath + "/.local/share/task/hooks/on-exit.sync.py";
|
source = dotsPath + "/.local/share/task/hooks/on-exit.sync.py";
|
||||||
};
|
};
|
||||||
".local/share/task/hooks/on-add.limit.py" = {
|
|
||||||
source = dotsPath + "/.local/share/task/hooks/on-add.limit.py";
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
".local/share/task/hooks/on-modify.limit.py" = {
|
|
||||||
source = dotsPath + "/.local/share/task/hooks/on-modify.limit.py";
|
|
||||||
executable = true;
|
|
||||||
};
|
|
||||||
".local/share/task/scripts/sync-and-notify.sh" = {
|
".local/share/task/scripts/sync-and-notify.sh" = {
|
||||||
source = dotsPath + "/.local/share/task/scripts/sync-and-notify.sh";
|
source = dotsPath + "/.local/share/task/scripts/sync-and-notify.sh";
|
||||||
executable = true;
|
executable = true;
|
||||||
@@ -56,6 +70,7 @@ in
|
|||||||
colorTheme = "dark-256";
|
colorTheme = "dark-256";
|
||||||
config = {
|
config = {
|
||||||
recurrence = "off";
|
recurrence = "off";
|
||||||
|
reserved.lines = 3; # without this I would have to scroll up 3 lines
|
||||||
};
|
};
|
||||||
extraConfig = lib.optionalString sops.available ''
|
extraConfig = lib.optionalString sops.available ''
|
||||||
include ${sops.templates."taskrc.d/sync".path}
|
include ${sops.templates."taskrc.d/sync".path}
|
||||||
|
|||||||
@@ -11,9 +11,5 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
extraConfig = builtins.readFile (dotsPath + "/.config/tmux/tmux.conf");
|
extraConfig = builtins.readFile (dotsPath + "/.config/tmux/tmux.conf");
|
||||||
};
|
};
|
||||||
|
|
||||||
home.file = {
|
|
||||||
".config/tmux/hooks/tmux.ssh.conf".source = dotsPath + "/.config/tmux/hooks/tmux.ssh.conf";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
45
home/modules/zk/default.nix
Normal file
45
home/modules/zk/default.nix
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
cfg = config.zk;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.zk = {
|
||||||
|
enable = lib.mkEnableOption "zettelkasten";
|
||||||
|
path = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = config.home.homeDirectory + "/.zk";
|
||||||
|
description = "Path to the zettelkasten directory";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
home = {
|
||||||
|
sessionVariables.ZK_PATH = cfg.path;
|
||||||
|
packages = [
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "zk";
|
||||||
|
runtimeInputs = with pkgs; [ tmux ];
|
||||||
|
text = builtins.readFile ./scripts/zk.sh;
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "save-zk";
|
||||||
|
runtimeInputs = with pkgs; [ git ];
|
||||||
|
text = builtins.readFile ./scripts/save-zk.sh;
|
||||||
|
})
|
||||||
|
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = "setup-zk";
|
||||||
|
runtimeInputs = with pkgs; [ gh ];
|
||||||
|
text = builtins.readFile ./scripts/setup-zk.sh;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
2
home/modules/zk/scripts/save-zk.sh
Normal file
2
home/modules/zk/scripts/save-zk.sh
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
cd "$ZK_PATH" || { echo "No zettelkasten directory found"; exit 1; }
|
||||||
|
git add . && git commit -m "Update" && git push
|
||||||
13
home/modules/zk/scripts/setup-zk.sh
Normal file
13
home/modules/zk/scripts/setup-zk.sh
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
if [ ! -d "$ZK_PATH" ]; then
|
||||||
|
echo "[zk] Setting up zettelkasten"
|
||||||
|
gh repo clone zk "$ZK_PATH"
|
||||||
|
else
|
||||||
|
echo "[zk] Zettelkasten already set up."
|
||||||
|
fi
|
||||||
|
|
||||||
|
read -p "Would you like open your zettelkasten? [y/N] " -n 1 -r
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||||
|
$EDITOR "$ZK_PATH"
|
||||||
|
fi
|
||||||
14
dots/.bin/zk → home/modules/zk/scripts/zk.sh
Executable file → Normal file
14
dots/.bin/zk → home/modules/zk/scripts/zk.sh
Executable file → Normal file
@@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
current_zettel_path="$(cat "$ZK_PATH/current-zettel.txt")"
|
||||||
|
|
||||||
current_zettel_path="$ZK_PATH/$(cat "$ZK_PATH/current-zettel.txt")"
|
if [ -n "${TMUX:-}" ]; then
|
||||||
|
|
||||||
if [ "$TERM_PROGRAM" = tmux ]; then
|
|
||||||
cd "$ZK_PATH" && $EDITOR "$current_zettel_path"
|
cd "$ZK_PATH" && $EDITOR "$current_zettel_path"
|
||||||
else
|
else
|
||||||
echo 'Not in tmux'
|
echo 'Not in tmux'
|
||||||
@@ -12,13 +10,9 @@ else
|
|||||||
read -r -p 'Enter your choice: ' choice
|
read -r -p 'Enter your choice: ' choice
|
||||||
case $choice in
|
case $choice in
|
||||||
1)
|
1)
|
||||||
# Check if a tmux session is running with a window named zk
|
if tmux has-session -t zk 2>/dev/null; then
|
||||||
if tmux list-windows -F '#{window_name}' | grep -q zk; then
|
tmux attach -t zk
|
||||||
# Attach to the session containing the 'zk' window
|
|
||||||
session="$(tmux list-windows -F '#{window_name} #{session_name}' | grep zk | head -n 1 | awk '{ print $2 }')"
|
|
||||||
tmux attach -t "$session"
|
|
||||||
else
|
else
|
||||||
# Create session with a window named 'zk' and start nvim
|
|
||||||
tmux new-session -s zk -n zk -d
|
tmux new-session -s zk -n zk -d
|
||||||
tmux send-keys -t zk:zk "cd $ZK_PATH && $EDITOR $current_zettel_path" Enter
|
tmux send-keys -t zk:zk "cd $ZK_PATH && $EDITOR $current_zettel_path" Enter
|
||||||
tmux attach -t zk
|
tmux attach -t zk
|
||||||
@@ -23,6 +23,8 @@ in
|
|||||||
inherit lib config;
|
inherit lib config;
|
||||||
device = "/dev/nvme1n1";
|
device = "/dev/nvme1n1";
|
||||||
})
|
})
|
||||||
|
../../modules/ai-tools
|
||||||
|
../../modules/anki
|
||||||
../../modules/audio
|
../../modules/audio
|
||||||
../../modules/backups
|
../../modules/backups
|
||||||
../../modules/bluetooth
|
../../modules/bluetooth
|
||||||
@@ -31,47 +33,34 @@ in
|
|||||||
../../modules/firewall
|
../../modules/firewall
|
||||||
../../modules/fonts
|
../../modules/fonts
|
||||||
../../modules/gaming
|
../../modules/gaming
|
||||||
|
../../modules/git
|
||||||
../../modules/hcloud
|
../../modules/hcloud
|
||||||
../../modules/keyboard
|
../../modules/keyboard
|
||||||
../../modules/localization
|
../../modules/localization
|
||||||
../../modules/networking
|
../../modules/networking
|
||||||
../../modules/nvidia
|
../../modules/nvidia
|
||||||
(import ../../modules/secrets { inherit lib inputs config; })
|
../../modules/secrets
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/storage
|
../../modules/storage
|
||||||
../../modules/stylix
|
../../modules/stylix
|
||||||
../../modules/syncthing
|
../../modules/syncthing
|
||||||
../../modules/tailscale
|
../../modules/tailscale
|
||||||
|
../../modules/taskwarrior
|
||||||
../../modules/users
|
../../modules/users
|
||||||
../../modules/wol
|
../../modules/wol
|
||||||
../../modules/yubikey
|
../../modules/yubikey
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.users.${config.host.username} = import ../../home/hosts/andromache {
|
home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
|
||||||
inherit
|
|
||||||
inputs
|
|
||||||
config
|
|
||||||
pkgs
|
|
||||||
lib
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
ssh.username = config.host.username;
|
secrets.nixSigningKey.enable = true;
|
||||||
ssh.authorizedHosts = [ "astyanax" ];
|
|
||||||
|
|
||||||
secrets = {
|
|
||||||
inherit (config.host) username;
|
|
||||||
nixSigningKey.enable = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
restic-backup.enable = true;
|
||||||
tailscale.enable = true;
|
tailscale.enable = true;
|
||||||
|
|
||||||
docker.user = config.host.username;
|
docker.enable = true;
|
||||||
|
|
||||||
hcloud = {
|
hcloud.enable = true;
|
||||||
enable = true;
|
|
||||||
inherit (config.host) username;
|
|
||||||
};
|
|
||||||
|
|
||||||
disko.devices = {
|
disko.devices = {
|
||||||
disk.data = {
|
disk.data = {
|
||||||
@@ -103,7 +92,6 @@ in
|
|||||||
|
|
||||||
my.yubikey = {
|
my.yubikey = {
|
||||||
enable = false;
|
enable = false;
|
||||||
inherit (config.host) username;
|
|
||||||
keys = [
|
keys = [
|
||||||
{
|
{
|
||||||
handle = "<KeyHandle1>";
|
handle = "<KeyHandle1>";
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "h";
|
username = "h";
|
||||||
name = "andromache";
|
highRam = true;
|
||||||
|
admin = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "local" ];
|
system = "x86_64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "local" ];
|
||||||
|
targetHost = "";
|
||||||
|
targetUser = "h";
|
||||||
|
};
|
||||||
role = "desktop";
|
role = "desktop";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"x86_64-linux"
|
|
||||||
@@ -16,48 +16,45 @@ in
|
|||||||
inputs.nixos-hardware.nixosModules.common-pc
|
inputs.nixos-hardware.nixosModules.common-pc
|
||||||
inputs.nixos-hardware.nixosModules.common-pc-ssd
|
inputs.nixos-hardware.nixosModules.common-pc-ssd
|
||||||
# inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-intel-gen7 (not available yet?)
|
# inputs.nixos-hardware.nixosModules.lenovo-thinkpad-e14-intel-gen7 (not available yet?)
|
||||||
|
inputs.sops-nix.nixosModules.sops
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/boot/bootloader.nix
|
../../modules/boot/bootloader.nix
|
||||||
(import ../../modules/disko/zfs-encrypted-root.nix {
|
(import ../../modules/disko/zfs-encrypted-root.nix {
|
||||||
inherit lib config;
|
inherit lib config;
|
||||||
device = "/dev/nvme0n1";
|
device = "/dev/nvme0n1";
|
||||||
})
|
})
|
||||||
../../modules/desktops/niri
|
../../modules/ai-tools
|
||||||
|
../../modules/anki
|
||||||
../../modules/audio
|
../../modules/audio
|
||||||
../../modules/backups
|
../../modules/backups
|
||||||
../../modules/bluetooth
|
../../modules/bluetooth
|
||||||
../../modules/keyboard
|
../../modules/desktops/niri
|
||||||
../../modules/networking
|
../../modules/docker
|
||||||
../../modules/users
|
../../modules/firewall
|
||||||
../../modules/localization
|
|
||||||
../../modules/fonts
|
../../modules/fonts
|
||||||
|
../../modules/git
|
||||||
|
../../modules/keyboard
|
||||||
|
../../modules/localization
|
||||||
|
../../modules/networking
|
||||||
|
../../modules/nfc
|
||||||
|
../../modules/secrets
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/storage
|
../../modules/storage
|
||||||
../../modules/stylix
|
../../modules/stylix
|
||||||
(import ../../modules/secrets { inherit lib inputs config; })
|
../../modules/tailscale
|
||||||
../../modules/docker
|
../../modules/taskwarrior
|
||||||
../../modules/nfc
|
../../modules/users
|
||||||
../../modules/firewall
|
../../modules/yubikey
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.users.${config.host.username} = import ../../home/hosts/astyanax {
|
home-manager.users.${config.host.username} = import ../../home/hosts/${config.host.name};
|
||||||
inherit
|
|
||||||
inputs
|
|
||||||
config
|
|
||||||
pkgs
|
|
||||||
lib
|
|
||||||
;
|
|
||||||
};
|
|
||||||
|
|
||||||
ssh.username = config.host.username;
|
secrets.nixSigningKey.enable = true;
|
||||||
ssh.authorizedHosts = [ "andromache" ];
|
|
||||||
|
|
||||||
secrets = {
|
restic-backup.enable = true;
|
||||||
inherit (config.host) username;
|
tailscale.enable = true;
|
||||||
nixSigningKey.enable = true;
|
docker.enable = true;
|
||||||
};
|
nfc.enable = true;
|
||||||
docker.user = config.host.username;
|
|
||||||
nfc.user = config.host.username;
|
|
||||||
desktop.ly.enable = true;
|
desktop.ly.enable = true;
|
||||||
audio.automation.enable = true;
|
audio.automation.enable = true;
|
||||||
|
|
||||||
@@ -100,6 +97,25 @@ in
|
|||||||
|
|
||||||
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
boot.binfmt.emulatedSystems = [ "aarch64-linux" ];
|
||||||
|
|
||||||
|
my.yubikey = {
|
||||||
|
enable = true;
|
||||||
|
# inherit (config.host) username;
|
||||||
|
# keys = [
|
||||||
|
# {
|
||||||
|
# handle = "<KeyHandle1>";
|
||||||
|
# userKey = "<UserKey1>";
|
||||||
|
# coseType = "<CoseType1>";
|
||||||
|
# options = "<Options1>";
|
||||||
|
# }
|
||||||
|
# {
|
||||||
|
# handle = "<KeyHandle2>";
|
||||||
|
# userKey = "<UserKey2>";
|
||||||
|
# coseType = "<CoseType2>";
|
||||||
|
# options = "<Options2>";
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
};
|
||||||
|
|
||||||
services = {
|
services = {
|
||||||
fwupd.enable = true;
|
fwupd.enable = true;
|
||||||
locate = {
|
locate = {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "h";
|
username = "h";
|
||||||
name = "astyanax";
|
highRam = true;
|
||||||
|
admin = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "local" ];
|
system = "x86_64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "local" ];
|
||||||
|
targetHost = "";
|
||||||
|
targetUser = "h";
|
||||||
|
};
|
||||||
role = "laptop";
|
role = "laptop";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIPz79WrdgQKWFxMYEqtDaMW/PCZ8xP1U1KXEAxuPTiQyAAAABHNzaDo= h@astyanax
|
sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIJApgl/+QaAtrg0OK5ihXasdcnDwzFo6qtHbgnqGFl25AAAABHNzaDo= h@astyanax
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"x86_64-linux"
|
|
||||||
@@ -11,15 +11,6 @@
|
|||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
];
|
];
|
||||||
|
|
||||||
ssh = {
|
|
||||||
inherit (config.host) username;
|
|
||||||
publicHostname = config.host.name;
|
|
||||||
authorizedHosts = [
|
|
||||||
"andromache"
|
|
||||||
"astyanax"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot = {
|
boot = {
|
||||||
kernelParams = [
|
kernelParams = [
|
||||||
"console=ttyS1,115200n8"
|
"console=ttyS1,115200n8"
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "h";
|
username = "h";
|
||||||
name = "eetion-02";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "arm" ];
|
system = "aarch64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "arm" ];
|
||||||
|
targetHost = "eetion-02";
|
||||||
|
targetUser = "h";
|
||||||
|
};
|
||||||
role = "embedded";
|
role = "embedded";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"aarch64-linux"
|
|
||||||
@@ -9,17 +9,11 @@
|
|||||||
./host.nix
|
./host.nix
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
|
../../modules/tailscale
|
||||||
# ../../modules/uptime-kuma
|
# ../../modules/uptime-kuma
|
||||||
];
|
];
|
||||||
|
|
||||||
ssh = {
|
tailscale.enable = true;
|
||||||
inherit (config.host) username;
|
|
||||||
publicHostname = config.host.name;
|
|
||||||
authorizedHosts = [
|
|
||||||
"andromache"
|
|
||||||
"astyanax"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
boot.loader = {
|
boot.loader = {
|
||||||
grub.enable = false;
|
grub.enable = false;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "h";
|
username = "h";
|
||||||
name = "eetion";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "arm" ];
|
system = "aarch64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "arm" ];
|
||||||
|
targetHost = "eetion";
|
||||||
|
targetUser = "h";
|
||||||
|
};
|
||||||
role = "embedded";
|
role = "embedded";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"aarch64-linux"
|
|
||||||
@@ -18,16 +18,7 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
networking.hostName = config.host.name;
|
networking.hostName = config.host.name;
|
||||||
ssh = {
|
docker.enable = true;
|
||||||
inherit (config.host) username;
|
|
||||||
publicHostname = "server.hektormisplon.xyz";
|
|
||||||
authorizedHosts = [
|
|
||||||
"andromache"
|
|
||||||
"astyanax"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
docker.user = config.host.username;
|
|
||||||
|
|
||||||
fileSystems."/" = {
|
fileSystems."/" = {
|
||||||
device = "/dev/disk/by-label/nixos";
|
device = "/dev/disk/by-label/nixos";
|
||||||
@@ -67,6 +58,7 @@
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
vim
|
vim
|
||||||
git
|
git
|
||||||
|
kitty.terminfo
|
||||||
];
|
];
|
||||||
|
|
||||||
services.fail2ban = {
|
services.fail2ban = {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "username";
|
username = "username";
|
||||||
name = "hecuba";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "cloud" ];
|
system = "x86_64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "cloud" ];
|
||||||
|
targetHost = "server.hektormisplon.xyz";
|
||||||
|
targetUser = "username";
|
||||||
|
};
|
||||||
role = "server";
|
role = "server";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"x86_64-linux"
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
{
|
{
|
||||||
lib,
|
|
||||||
inputs,
|
inputs,
|
||||||
config,
|
config,
|
||||||
pkgs,
|
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
@@ -12,29 +10,25 @@
|
|||||||
./host.nix
|
./host.nix
|
||||||
./disk.nix
|
./disk.nix
|
||||||
../../modules/common
|
../../modules/common
|
||||||
../../modules/boot/bootloader.nix
|
../../modules/anki
|
||||||
../../modules/keyboard
|
|
||||||
../../modules/networking
|
|
||||||
../../modules/users
|
|
||||||
../../modules/audio
|
../../modules/audio
|
||||||
../../modules/localization
|
../../modules/boot/bootloader.nix
|
||||||
../../modules/x
|
|
||||||
../../modules/fonts
|
../../modules/fonts
|
||||||
|
../../modules/git
|
||||||
|
../../modules/keyboard
|
||||||
|
../../modules/localization
|
||||||
|
../../modules/networking
|
||||||
|
../../modules/ai-tools
|
||||||
../../modules/ssh
|
../../modules/ssh
|
||||||
../../modules/storage
|
../../modules/storage
|
||||||
../../modules/stylix
|
../../modules/stylix
|
||||||
(import ../../modules/secrets {
|
../../modules/secrets
|
||||||
inherit lib inputs config;
|
../../modules/taskwarrior
|
||||||
})
|
../../modules/users
|
||||||
|
../../modules/x
|
||||||
];
|
];
|
||||||
|
|
||||||
home-manager.users.${config.host.username} = import ../../home/hosts/vm {
|
home-manager.users.${config.host.username} = import ../../home/hosts/vm;
|
||||||
inherit inputs config pkgs;
|
|
||||||
};
|
|
||||||
|
|
||||||
ssh.username = config.host.username;
|
|
||||||
|
|
||||||
secrets.username = config.host.username;
|
|
||||||
|
|
||||||
disko = {
|
disko = {
|
||||||
devices.disk.main = {
|
devices.disk.main = {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
host = {
|
host = {
|
||||||
username = "h";
|
username = "h";
|
||||||
name = "vm";
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
deployment.tags = [ "local" ];
|
system = "x86_64-linux";
|
||||||
|
deployment = {
|
||||||
|
tags = [ "local" ];
|
||||||
|
targetHost = "";
|
||||||
|
targetUser = "h";
|
||||||
|
};
|
||||||
role = "vm";
|
role = "vm";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
"x86_64-linux"
|
|
||||||
@@ -12,14 +12,14 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
../modules/common/host.nix
|
||||||
../modules/ssh
|
../modules/ssh
|
||||||
];
|
];
|
||||||
|
|
||||||
ssh.username = username;
|
host = {
|
||||||
ssh.authorizedHosts = [
|
inherit username;
|
||||||
"andromache"
|
name = "orange-pi";
|
||||||
"astyanax"
|
};
|
||||||
];
|
|
||||||
|
|
||||||
nix.settings.experimental-features = [
|
nix.settings.experimental-features = [
|
||||||
"nix-command"
|
"nix-command"
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ let
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
|
../modules/common/host.nix
|
||||||
../modules/ssh
|
../modules/ssh
|
||||||
];
|
];
|
||||||
|
|
||||||
ssh.username = username;
|
host = {
|
||||||
ssh.authorizedHosts = [
|
inherit username;
|
||||||
"andromache"
|
name = "raspberry-pi";
|
||||||
"astyanax"
|
};
|
||||||
];
|
|
||||||
|
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"console=ttyS1,115200n8"
|
"console=ttyS1,115200n8"
|
||||||
|
|||||||
25
modules/ai-tools/default.nix
Normal file
25
modules/ai-tools/default.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.host) username;
|
||||||
|
inherit (config.secrets) owner;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
nixpkgs.allowedUnfree = [ "claude-code" ];
|
||||||
|
secrets.groups.opencode = [ "api-key" ];
|
||||||
|
|
||||||
|
sops.templates."opencode/auth.json" = {
|
||||||
|
inherit owner;
|
||||||
|
path = "/home/${username}/.local/share/opencode/auth.json";
|
||||||
|
content = ''
|
||||||
|
{
|
||||||
|
"zai-coding-plan": {
|
||||||
|
"type": "api",
|
||||||
|
"key": "${config.sops.placeholder."opencode/api-key"}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
6
modules/anki/default.nix
Normal file
6
modules/anki/default.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
config.secrets.groups.anki = [
|
||||||
|
"sync-user"
|
||||||
|
"sync-key"
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -6,19 +6,15 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.restic-backup;
|
cfg = config.restic-backup;
|
||||||
inherit (config.secrets) sopsDir;
|
host = config.networking.hostName;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options = {
|
options.restic-backup = {
|
||||||
restic-backup = {
|
enable = lib.mkEnableOption "restic backups";
|
||||||
repository = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "b2:${config.sops.placeholder.b2-bucket-name}:${config.networking.hostName}";
|
|
||||||
};
|
|
||||||
|
|
||||||
passwordFile = lib.mkOption {
|
passwordFile = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = config.sops.secrets.restic-password.path;
|
default = config.sops.secrets."restic/password".path;
|
||||||
};
|
};
|
||||||
|
|
||||||
paths = lib.mkOption {
|
paths = lib.mkOption {
|
||||||
@@ -26,41 +22,32 @@ in
|
|||||||
default = [ "/home" ];
|
default = [ "/home" ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
secrets.groups = {
|
||||||
|
restic = [ "password" ];
|
||||||
|
backblaze-b2 = [
|
||||||
|
"bucket-name"
|
||||||
|
"account-id"
|
||||||
|
"account-key"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
sops.templates = {
|
||||||
sops = {
|
"restic/repo-${host}" = {
|
||||||
secrets = {
|
content = "b2:${config.sops.placeholder."backblaze-b2/bucket-name"}:${host}";
|
||||||
restic-password = {
|
|
||||||
sopsFile = "${sopsDir}/restic-password";
|
|
||||||
};
|
};
|
||||||
b2-bucket-name = {
|
"restic/b2-env-${host}" = {
|
||||||
sopsFile = "${sopsDir}/b2-bucket-name";
|
|
||||||
};
|
|
||||||
b2-account-id = {
|
|
||||||
sopsFile = "${sopsDir}/b2-account-id";
|
|
||||||
};
|
|
||||||
b2-account-key = {
|
|
||||||
sopsFile = "${sopsDir}/b2-account-key";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
templates = {
|
|
||||||
"restic/repo-${config.networking.hostName}" = {
|
|
||||||
content = "b2:${config.sops.placeholder.b2-bucket-name}:${config.networking.hostName}";
|
|
||||||
};
|
|
||||||
"restic/b2-env-${config.networking.hostName}" = {
|
|
||||||
content = ''
|
content = ''
|
||||||
B2_ACCOUNT_ID=${config.sops.placeholder.b2-account-id}
|
B2_ACCOUNT_ID=${config.sops.placeholder."backblaze-b2/account-id"}
|
||||||
B2_ACCOUNT_KEY=${config.sops.placeholder.b2-account-key}
|
B2_ACCOUNT_KEY=${config.sops.placeholder."backblaze-b2/account-key"}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
services.restic.backups.home = {
|
services.restic.backups.home = {
|
||||||
repositoryFile = config.sops.templates."restic/repo-${config.networking.hostName}".path;
|
repositoryFile = config.sops.templates."restic/repo-${host}".path;
|
||||||
inherit (cfg) passwordFile;
|
inherit (cfg) passwordFile paths;
|
||||||
inherit (cfg) paths;
|
|
||||||
timerConfig = {
|
timerConfig = {
|
||||||
OnCalendar = "daily";
|
OnCalendar = "daily";
|
||||||
Persistent = true;
|
Persistent = true;
|
||||||
@@ -73,7 +60,7 @@ in
|
|||||||
"--keep-monthly 6"
|
"--keep-monthly 6"
|
||||||
"--keep-yearly 1"
|
"--keep-yearly 1"
|
||||||
];
|
];
|
||||||
environmentFile = config.sops.templates."restic/b2-env-${config.networking.hostName}".path;
|
environmentFile = config.sops.templates."restic/b2-env-${host}".path;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
boot.loader.systemd-boot.enable = true;
|
boot = {
|
||||||
boot.loader.efi.canTouchEfiVariables = true;
|
loader = {
|
||||||
|
systemd-boot.enable = true;
|
||||||
|
efi.canTouchEfiVariables = true;
|
||||||
|
};
|
||||||
|
tmp.useTmpfs = config.host.highRam;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ in
|
|||||||
"nix-command"
|
"nix-command"
|
||||||
"flakes"
|
"flakes"
|
||||||
];
|
];
|
||||||
|
settings.trusted-public-keys = [
|
||||||
|
"nix-signing-key:M6ouQRFl/bZ5QQrceQUyar6P7o8qg4wwVkxD1SSLL2k="
|
||||||
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
system.autoUpgrade = {
|
system.autoUpgrade = {
|
||||||
@@ -70,6 +73,11 @@ in
|
|||||||
myUtils
|
myUtils
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
sharedModules = [
|
||||||
|
{
|
||||||
|
host.username = lib.mkDefault config.host.username;
|
||||||
|
}
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,5 +19,15 @@
|
|||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "en_US.UTF-8";
|
default = "en_US.UTF-8";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
highRam = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
admin = lib.mkOption {
|
||||||
|
type = lib.types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
7
modules/desktops/logind.nix
Normal file
7
modules/desktops/logind.nix
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
services.logind.settings.Login = {
|
||||||
|
HandleLidSwitch = "suspend";
|
||||||
|
IdleAction = "suspend";
|
||||||
|
IdleActionSec = 1800;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ let
|
|||||||
cfg = config.desktop;
|
cfg = config.desktop;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [ ../logind.nix ];
|
||||||
|
|
||||||
options.desktop = {
|
options.desktop = {
|
||||||
ly = {
|
ly = {
|
||||||
enable = lib.mkOption {
|
enable = lib.mkOption {
|
||||||
@@ -19,7 +21,10 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
programs.niri.enable = true;
|
programs.niri = {
|
||||||
|
enable = true;
|
||||||
|
useNautilus = false;
|
||||||
|
};
|
||||||
|
|
||||||
xdg.portal = {
|
xdg.portal = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -32,14 +37,23 @@ in
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
services = {
|
# error:
|
||||||
dbus.enable = true;
|
# Failed assertions:
|
||||||
logind.settings.Login = {
|
# - h profile: xdg.portal: since you installed Home Manager via its NixOS module and
|
||||||
HandleLidSwitch = "suspend";
|
# 'home-manager.useUserPackages' is enabled, you need to add
|
||||||
IdleAction = "suspend";
|
#
|
||||||
IdleActionSec = 1800;
|
# environment.pathsToLink = [ `/share/applications` `/share/xdg-desktop-portal` ];
|
||||||
};
|
#
|
||||||
|
# to your NixOS configuration so that the portal definitions and DE
|
||||||
|
# provided configurations get linked.
|
||||||
|
environment.pathsToLink = [
|
||||||
|
"/share/applications"
|
||||||
|
"/share/xdg-desktop-portal"
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
gnome.gnome-keyring.enable = false;
|
||||||
|
dbus.enable = true;
|
||||||
displayManager.ly = lib.mkIf cfg.ly.enable {
|
displayManager.ly = lib.mkIf cfg.ly.enable {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,29 +2,17 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.docker;
|
cfg = config.docker;
|
||||||
|
inherit (config.host) username;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.docker = {
|
options.docker = {
|
||||||
|
enable = lib.mkEnableOption "docker";
|
||||||
rootless = lib.mkOption {
|
rootless = lib.mkOption {
|
||||||
type = lib.types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
};
|
};
|
||||||
user = lib.mkOption {
|
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
{
|
|
||||||
warnings = lib.flatten [
|
|
||||||
(lib.optional (
|
|
||||||
cfg.rootless && cfg.user != null
|
|
||||||
) "'virtualisation.docker.user' is ignored when rootless mode is enabled")
|
|
||||||
(lib.optional (
|
|
||||||
!cfg.rootless && cfg.user == null
|
|
||||||
) "'virtualisation.docker.user' is not set (no user is added to the docker group)")
|
|
||||||
];
|
|
||||||
}
|
|
||||||
(lib.mkIf cfg.rootless {
|
(lib.mkIf cfg.rootless {
|
||||||
virtualisation.docker = {
|
virtualisation.docker = {
|
||||||
enable = false;
|
enable = false;
|
||||||
@@ -34,11 +22,9 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(lib.mkIf (!cfg.rootless && cfg.user != null) {
|
(lib.mkIf (cfg.enable && !cfg.rootless) {
|
||||||
virtualisation.docker = {
|
virtualisation.docker.enable = true;
|
||||||
enable = true;
|
users.users.${username}.extraGroups = [ "docker" ];
|
||||||
};
|
|
||||||
users.users.${cfg.user}.extraGroups = [ "docker" ];
|
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
programs.gamemode.enable = true;
|
programs.gamemode.enable = true;
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
lutris
|
# lutris
|
||||||
mangohud
|
mangohud
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
29
modules/git/default.nix
Normal file
29
modules/git/default.nix
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.host) username;
|
||||||
|
owner = config.users.users.${username}.name;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config.sops.templates = {
|
||||||
|
".gitconfig.email" = {
|
||||||
|
inherit owner;
|
||||||
|
path = "/home/${username}/.gitconfig.email";
|
||||||
|
content = ''
|
||||||
|
[user]
|
||||||
|
email = ${config.sops.placeholder."email/personal"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
".gitconfig.work.email" = {
|
||||||
|
inherit owner;
|
||||||
|
path = "/home/${username}/.gitconfig.work.email";
|
||||||
|
content = ''
|
||||||
|
[user]
|
||||||
|
email = ${config.sops.placeholder."email/work"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -6,32 +6,26 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.hcloud;
|
cfg = config.hcloud;
|
||||||
inherit (config.secrets) sopsDir;
|
inherit (config.host) username;
|
||||||
|
inherit (config.secrets) owner;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.hcloud = {
|
options.hcloud = {
|
||||||
enable = lib.mkEnableOption "hcloud CLI configuration";
|
enable = lib.mkEnableOption "hcloud CLI configuration";
|
||||||
username = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
description = "Username for hcloud CLI configuration";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
sops.secrets.hcloud-token = {
|
secrets.groups.hcloud = [ "api-token" ];
|
||||||
sopsFile = "${sopsDir}/hcloud-token";
|
|
||||||
owner = config.users.users.${cfg.username}.name;
|
|
||||||
};
|
|
||||||
|
|
||||||
sops.templates."hcloud/cli.toml" = {
|
sops.templates."hcloud/cli.toml" = {
|
||||||
owner = config.users.users.${cfg.username}.name;
|
inherit owner;
|
||||||
path = "/home/${cfg.username}/.config/hcloud/cli.toml";
|
path = "/home/${username}/.config/hcloud/cli.toml";
|
||||||
content = ''
|
content = ''
|
||||||
active_context = "server"
|
active_context = "server"
|
||||||
|
|
||||||
[[contexts]]
|
[[contexts]]
|
||||||
name = "server"
|
name = "server"
|
||||||
token = "${config.sops.placeholder.hcloud-token}"
|
token = "${config.sops.placeholder."hcloud/api-token"}"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,15 +2,13 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.nfc;
|
cfg = config.nfc;
|
||||||
|
inherit (config.host) username;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.nfc = {
|
options.nfc = {
|
||||||
user = lib.mkOption {
|
enable = lib.mkEnableOption "NFC device access";
|
||||||
type = lib.types.nullOr lib.types.str;
|
|
||||||
default = null;
|
|
||||||
};
|
};
|
||||||
};
|
config = lib.mkIf cfg.enable {
|
||||||
config = lib.mkIf (cfg.user != null) {
|
users.users.${username}.extraGroups = [ "dialout" ];
|
||||||
users.users.${cfg.user}.extraGroups = [ "dialout" ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,106 +1,78 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
inputs,
|
inputs,
|
||||||
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
myUtils,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.secrets;
|
cfg = config.secrets;
|
||||||
|
inherit (config.host) username;
|
||||||
inherit (cfg) sopsDir;
|
inherit (cfg) sopsDir;
|
||||||
owner = config.users.users.${cfg.username}.name;
|
owner = config.users.users.${username}.name;
|
||||||
|
|
||||||
mkSecret = name: {
|
|
||||||
${name} = {
|
|
||||||
sopsFile = "${sopsDir}/${name}";
|
|
||||||
inherit owner;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ inputs.sops-nix.nixosModules.sops ];
|
imports = [ inputs.sops-nix.nixosModules.sops ];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
secrets = {
|
secrets = {
|
||||||
username = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
};
|
|
||||||
|
|
||||||
sopsDir = lib.mkOption {
|
sopsDir = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "${toString inputs.nix-secrets}/secrets";
|
default = "${toString inputs.nix-secrets}/secrets";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
groups = lib.mkOption {
|
||||||
|
type = lib.types.attrsOf (lib.types.listOf lib.types.str);
|
||||||
|
default = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
owner = lib.mkOption {
|
||||||
|
type = lib.types.unspecified;
|
||||||
|
};
|
||||||
|
|
||||||
nixSigningKey = {
|
nixSigningKey = {
|
||||||
enable = lib.mkEnableOption "nix signing key configuration";
|
enable = lib.mkEnableOption "nix signing key configuration";
|
||||||
name = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "${config.host.name}-nix-signing-key";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
yubikey = {
|
||||||
|
enable = lib.mkEnableOption "set up Yubikey";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
sops = {
|
secrets = {
|
||||||
age.keyFile = "/home/${cfg.username}/.config/sops/age/keys.txt";
|
inherit owner;
|
||||||
|
groups = {
|
||||||
secrets = lib.mkMerge [
|
email = [
|
||||||
(mkSecret "taskwarrior-sync-server-url")
|
"personal"
|
||||||
(mkSecret "taskwarrior-sync-server-client-id")
|
"work"
|
||||||
(mkSecret "taskwarrior-sync-encryption-secret")
|
|
||||||
(mkSecret "anki-sync-user")
|
|
||||||
(mkSecret "anki-sync-key")
|
|
||||||
(mkSecret "email-personal")
|
|
||||||
(mkSecret "email-work")
|
|
||||||
(mkSecret "opencode-api-key")
|
|
||||||
(lib.mkIf cfg.nixSigningKey.enable (mkSecret cfg.nixSigningKey.name))
|
|
||||||
];
|
];
|
||||||
|
nix = lib.optional cfg.nixSigningKey.enable "signing-key";
|
||||||
templates = {
|
};
|
||||||
"taskrc.d/sync" = {
|
|
||||||
inherit owner;
|
|
||||||
content = ''
|
|
||||||
sync.server.url=${config.sops.placeholder.taskwarrior-sync-server-url}
|
|
||||||
sync.server.client_id=${config.sops.placeholder.taskwarrior-sync-server-client-id}
|
|
||||||
sync.encryption_secret=${config.sops.placeholder.taskwarrior-sync-encryption-secret}
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
".gitconfig.email" = {
|
sops = {
|
||||||
inherit owner;
|
# for yubikey, generate as follows:
|
||||||
path = "/home/${cfg.username}/.gitconfig.email";
|
# ```
|
||||||
content = ''
|
# age-plugin-yubikey --identity > <keyfile-path>
|
||||||
[user]
|
# ```
|
||||||
email = ${config.sops.placeholder.email-personal}
|
age.keyFile = "/home/${username}/.config/sops/age/keys.txt";
|
||||||
'';
|
secrets = myUtils.mkSopsSecrets sopsDir owner cfg.groups;
|
||||||
};
|
|
||||||
".gitconfig.work.email" = {
|
|
||||||
inherit owner;
|
|
||||||
path = "/home/${cfg.username}/.gitconfig.work.email";
|
|
||||||
content = ''
|
|
||||||
[user]
|
|
||||||
email = ${config.sops.placeholder.email-work}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
"opencode/auth.json" = {
|
|
||||||
inherit owner;
|
|
||||||
path = "/home/${cfg.username}/.local/share/opencode/auth.json";
|
|
||||||
content = ''
|
|
||||||
{
|
|
||||||
"zai-coding-plan": {
|
|
||||||
"type": "api",
|
|
||||||
"key": "${config.sops.placeholder.opencode-api-key}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nix.settings.secret-key-files = lib.mkIf cfg.nixSigningKey.enable [
|
nix.settings.secret-key-files = lib.mkIf cfg.nixSigningKey.enable [
|
||||||
config.sops.secrets.${cfg.nixSigningKey.name}.path
|
config.sops.secrets."nix/signing-key".path
|
||||||
|
];
|
||||||
|
|
||||||
|
services = {
|
||||||
|
pcscd.enable = true; # needed for age-plugin-yubikey?
|
||||||
|
udev.packages = lib.mkIf cfg.yubikey.enable [
|
||||||
|
pkgs.yubikey-personalization
|
||||||
|
pkgs.libfido2
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,29 @@
|
|||||||
{ lib, config, ... }:
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.host) username;
|
||||||
|
adminHosts = (import ../../utils { inherit lib; }).adminHosts ../../hosts;
|
||||||
|
in
|
||||||
{
|
{
|
||||||
options.ssh = {
|
options.ssh = {
|
||||||
authorizedHosts = lib.mkOption {
|
authorizedHosts = lib.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
username = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "h";
|
|
||||||
};
|
|
||||||
publicHostname = lib.mkOption {
|
|
||||||
type = lib.types.str;
|
|
||||||
default = "";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# auto generate authorized_keys from `authorizedHosts`
|
# auto generate authorized_keys from `authorizedHosts`
|
||||||
config.users.users.${config.ssh.username}.openssh.authorizedKeys.keys = lib.flatten (
|
config.users.users.${username}.openssh.authorizedKeys.keys = lib.flatten (
|
||||||
map (
|
map (
|
||||||
hostname:
|
hostname:
|
||||||
let
|
let
|
||||||
keyFile = ../../hosts/${hostname}/ssh_user.pub;
|
keyFile = ../../hosts/${hostname}/ssh_user.pub;
|
||||||
in
|
in
|
||||||
lib.optionals (builtins.pathExists keyFile) (lib.splitString "\n" (builtins.readFile keyFile))
|
lib.optionals (builtins.pathExists keyFile) (lib.splitString "\n" (builtins.readFile keyFile))
|
||||||
) config.ssh.authorizedHosts
|
) ((builtins.filter (h: h != config.host.name) adminHosts) ++ config.ssh.authorizedHosts)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{ lib, config, ... }:
|
{ lib, config, ... }:
|
||||||
let
|
let
|
||||||
inherit (config.ssh) username;
|
inherit (config.host) username;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
# auto extract SSH keys
|
# auto extract SSH keys
|
||||||
|
|||||||
@@ -30,20 +30,7 @@ in
|
|||||||
|
|
||||||
home-manager.sharedModules = [
|
home-manager.sharedModules = [
|
||||||
{
|
{
|
||||||
stylix.targets = {
|
stylix.targets = import ./targets.nix;
|
||||||
firefox = {
|
|
||||||
profileNames = [ "default" ];
|
|
||||||
colorTheme.enable = true;
|
|
||||||
};
|
|
||||||
librewolf = {
|
|
||||||
profileNames = [ "default" ];
|
|
||||||
colorTheme.enable = true;
|
|
||||||
};
|
|
||||||
kitty.variant256Colors = true;
|
|
||||||
gnome.enable = false;
|
|
||||||
gtk.enable = false;
|
|
||||||
nixvim.enable = false;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
14
modules/stylix/targets.nix
Normal file
14
modules/stylix/targets.nix
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
firefox = {
|
||||||
|
profileNames = [ "default" ];
|
||||||
|
colorTheme.enable = true;
|
||||||
|
};
|
||||||
|
librewolf = {
|
||||||
|
profileNames = [ "default" ];
|
||||||
|
colorTheme.enable = true;
|
||||||
|
};
|
||||||
|
kitty.variant256Colors = true;
|
||||||
|
gnome.enable = false;
|
||||||
|
gtk.enable = false;
|
||||||
|
nixvim.enable = false;
|
||||||
|
}
|
||||||
@@ -7,23 +7,18 @@
|
|||||||
with lib;
|
with lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.my.syncthing;
|
inherit (config.host) username;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.syncthing.username = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "h";
|
|
||||||
};
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
users.groups.${cfg.username} = { };
|
users.groups.${username} = { };
|
||||||
users.users.${cfg.username}.extraGroups = [ cfg.username ];
|
users.users.${username}.extraGroups = [ username ];
|
||||||
|
|
||||||
services.syncthing = {
|
services.syncthing = {
|
||||||
enable = true;
|
enable = true;
|
||||||
user = cfg.username;
|
user = username;
|
||||||
group = cfg.username;
|
group = username;
|
||||||
configDir = "/home/${cfg.username}/.local/state/syncthing";
|
configDir = "/home/${username}/.local/state/syncthing";
|
||||||
openDefaultPorts = true;
|
openDefaultPorts = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
config = lib.mkIf config.tailscale.enable {
|
config = lib.mkIf config.tailscale.enable {
|
||||||
services.tailscale = {
|
services.tailscale = {
|
||||||
enable = true;
|
enable = true;
|
||||||
openFirewall = true;
|
extraSetFlags = [ "--netfilter-mode=nodivert" ];
|
||||||
|
extraDaemonFlags = [ "--no-logs-no-support" ];
|
||||||
|
openFirewall = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
23
modules/taskwarrior/default.nix
Normal file
23
modules/taskwarrior/default.nix
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{ config, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
inherit (config.secrets) owner;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
config = {
|
||||||
|
secrets.groups.taskwarrior = [
|
||||||
|
"sync-server-url"
|
||||||
|
"sync-server-client-id"
|
||||||
|
"sync-encryption-secret"
|
||||||
|
];
|
||||||
|
|
||||||
|
sops.templates."taskrc.d/sync" = {
|
||||||
|
inherit owner;
|
||||||
|
content = ''
|
||||||
|
sync.server.url=${config.sops.placeholder."taskwarrior/sync-server-url"}
|
||||||
|
sync.server.client_id=${config.sops.placeholder."taskwarrior/sync-server-client-id"}
|
||||||
|
sync.encryption_secret=${config.sops.placeholder."taskwarrior/sync-encryption-secret"}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -9,18 +9,14 @@ with lib;
|
|||||||
|
|
||||||
let
|
let
|
||||||
cfg = config.my.yubikey;
|
cfg = config.my.yubikey;
|
||||||
|
inherit (config.host) username;
|
||||||
formatKey = key: ":${key.handle},${key.userKey},${key.coseType},${key.options}";
|
formatKey = key: ":${key.handle},${key.userKey},${key.coseType},${key.options}";
|
||||||
authfileContent = username: keys: username + lib.concatMapStrings formatKey keys;
|
authfileContent = u: keys: u + lib.concatMapStrings formatKey keys;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
options.my.yubikey = {
|
options.my.yubikey = {
|
||||||
enable = mkEnableOption "yubiKey U2F authentication";
|
enable = mkEnableOption "yubiKey U2F authentication";
|
||||||
|
|
||||||
username = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "h";
|
|
||||||
};
|
|
||||||
|
|
||||||
origin = mkOption {
|
origin = mkOption {
|
||||||
type = types.str;
|
type = types.str;
|
||||||
default = "pam://yubi";
|
default = "pam://yubi";
|
||||||
@@ -61,7 +57,7 @@ in
|
|||||||
interactive = true;
|
interactive = true;
|
||||||
cue = true;
|
cue = true;
|
||||||
inherit (cfg) origin;
|
inherit (cfg) origin;
|
||||||
authfile = pkgs.writeText "u2f-mappings" (authfileContent cfg.username cfg.keys);
|
authfile = pkgs.writeText "u2f-mappings" (authfileContent username cfg.keys);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
services = {
|
services = {
|
||||||
@@ -70,6 +66,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.udev.packages = [ pkgs.yubikey-personalization ];
|
services.udev.packages = with pkgs; [ yubikey-personalization ];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,8 @@
|
|||||||
{ lib }:
|
{ lib }:
|
||||||
|
|
||||||
{
|
let
|
||||||
dirNames =
|
fs = import ./fs.nix { inherit lib; };
|
||||||
path: builtins.attrNames (lib.filterAttrs (_: type: type == "directory") (builtins.readDir path));
|
hosts = import ./hosts.nix { inherit lib; };
|
||||||
|
secrets = import ./secrets.nix { inherit lib; };
|
||||||
hostMeta =
|
in
|
||||||
hostDir:
|
fs // hosts // secrets
|
||||||
if builtins.pathExists (hostDir + "/meta.nix") then
|
|
||||||
import (hostDir + "/meta.nix")
|
|
||||||
else
|
|
||||||
throw "meta.nix required in ${hostDir}";
|
|
||||||
|
|
||||||
sopsAvailability =
|
|
||||||
config: osConfig:
|
|
||||||
let
|
|
||||||
hmSopsAvailable = config ? sops && config.sops ? secrets;
|
|
||||||
osSopsAvailable = osConfig != null && osConfig ? sops && osConfig.sops ? secrets;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
available = hmSopsAvailable || osSopsAvailable;
|
|
||||||
secrets = if hmSopsAvailable then config.sops.secrets else osConfig.sops.secrets;
|
|
||||||
templates = if hmSopsAvailable then config.sops.templates else osConfig.sops.templates;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
6
utils/fs.nix
Normal file
6
utils/fs.nix
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{ lib }:
|
||||||
|
|
||||||
|
{
|
||||||
|
dirNames =
|
||||||
|
path: builtins.attrNames (lib.filterAttrs (_: t: t == "directory") (builtins.readDir path));
|
||||||
|
}
|
||||||
19
utils/hosts.nix
Normal file
19
utils/hosts.nix
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
{ lib }:
|
||||||
|
|
||||||
|
let
|
||||||
|
fs = import ./fs.nix { inherit lib; };
|
||||||
|
in
|
||||||
|
{
|
||||||
|
hostMeta =
|
||||||
|
hostDir:
|
||||||
|
if builtins.pathExists (hostDir + "/meta.nix") then
|
||||||
|
import (hostDir + "/meta.nix")
|
||||||
|
else
|
||||||
|
throw "meta.nix required in ${hostDir}";
|
||||||
|
|
||||||
|
adminHosts =
|
||||||
|
hostsPath:
|
||||||
|
builtins.filter (host: ((import (hostsPath + "/${host}/host.nix")).host.admin or false)) (
|
||||||
|
fs.dirNames hostsPath
|
||||||
|
);
|
||||||
|
}
|
||||||
37
utils/secrets.nix
Normal file
37
utils/secrets.nix
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
{ lib }:
|
||||||
|
|
||||||
|
{
|
||||||
|
mkSopsSecrets =
|
||||||
|
sopsDir: owner: groups:
|
||||||
|
let
|
||||||
|
opts = lib.optionalAttrs (owner != null) { inherit owner; };
|
||||||
|
mkGroup =
|
||||||
|
group: names:
|
||||||
|
let
|
||||||
|
file = "${group}.yaml";
|
||||||
|
in
|
||||||
|
lib.foldl' lib.mergeAttrs { } (
|
||||||
|
map (name: {
|
||||||
|
"${group}/${name}" = {
|
||||||
|
sopsFile = "${sopsDir}/${file}";
|
||||||
|
key = name;
|
||||||
|
}
|
||||||
|
// opts;
|
||||||
|
}) names
|
||||||
|
);
|
||||||
|
in
|
||||||
|
lib.foldl' lib.mergeAttrs { } (lib.mapAttrsToList mkGroup groups);
|
||||||
|
|
||||||
|
sopsAvailability =
|
||||||
|
config: osConfig:
|
||||||
|
let
|
||||||
|
osSopsAvailable = osConfig != null && osConfig ? sops && osConfig.sops ? secrets;
|
||||||
|
hmSopsAvailable = config ? sops && config.sops ? secrets;
|
||||||
|
preferOs = osSopsAvailable;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
available = osSopsAvailable || hmSopsAvailable;
|
||||||
|
secrets = if preferOs then osConfig.sops.secrets else config.sops.secrets;
|
||||||
|
templates = if preferOs then osConfig.sops.templates else config.sops.templates;
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user