diff options
-rw-r--r-- | .ecrc | 2 | ||||
-rw-r--r-- | .typos.toml | 6 | ||||
-rw-r--r-- | flake.lock | 72 | ||||
-rw-r--r-- | modules/common/common/shell/functions.bash | 56 | ||||
-rw-r--r-- | modules/common/editorconfig.nix | 10 | ||||
-rw-r--r-- | modules/common/emacs/default.nix | 10 | ||||
-rw-r--r-- | modules/common/emacs/doom/config.el | 32 | ||||
-rw-r--r-- | modules/nixos/default.nix | 2 | ||||
-rw-r--r-- | modules/nixos/incus.nix | 62 | ||||
-rw-r--r-- | modules/nixos/lxc.nix | 18 | ||||
-rw-r--r-- | modules/nixos/matrix/default.nix | 1 | ||||
-rw-r--r-- | modules/nixos/matrix/synapse.nix | 92 | ||||
-rw-r--r-- | modules/nixos/podman.nix | 26 | ||||
-rw-r--r-- | nixosConfigurations/eonwe/default.nix | 1 |
14 files changed, 149 insertions, 241 deletions
diff --git a/.ecrc b/.ecrc index 2242b35..523e44c 100644 --- a/.ecrc +++ b/.ecrc @@ -1,5 +1,5 @@ { - "Exclude": ["\\.el", "\\.json$", "^LICENSE$", "^flake.lock$", "^secrets/"], + "Exclude": ["\\.el$", "\\.json$", "^LICENSE$", "^flake.lock$", "^secrets/"], "Disable": { "MaxLineLength": true } diff --git a/.typos.toml b/.typos.toml index 2df5a55..d82a6e2 100644 --- a/.typos.toml +++ b/.typos.toml @@ -4,8 +4,4 @@ iterm2 = "iterm2" openpgp4fpr= "openpgp4fpr" [files] -extend-exclude = [ - "**/*.el", - "**/hidden.nix", - "secrets/*", -] +extend-exclude = ["**/hidden.nix", "secrets/*"] diff --git a/flake.lock b/flake.lock index 812a8e1..18da9ed 100644 --- a/flake.lock +++ b/flake.lock @@ -16,11 +16,11 @@ ] }, "locked": { - "lastModified": 1703433843, - "narHash": "sha256-nmtA4KqFboWxxoOAA6Y1okHbZh+HsXaMPFkYHsoDRDw=", + "lastModified": 1707830867, + "narHash": "sha256-PAdwm5QqdlwIqGrfzzvzZubM+FXtilekQ/FA0cI49/o=", "owner": "ryantm", "repo": "agenix", - "rev": "417caa847f9383e111d1397039c9d4337d024bf0", + "rev": "8cb01a0e717311680e0cbca06a76cbceba6f3ed6", "type": "github" }, "original": { @@ -71,11 +71,11 @@ ] }, "locked": { - "lastModified": 1701036929, - "narHash": "sha256-5TkAr5a3EoY9/oeO53SU+FRNfOUTpChj7mEW/Ax3T1w=", + "lastModified": 1708283120, + "narHash": "sha256-IgJe5xhssW199zGQq4Q81stGdVDJH7nFHm3yu62I75E=", "owner": "dwarfmaster", "repo": "arkenfox-nixos", - "rev": "1c9d061a4ef7bf3ce8a5260eaee4acdb3ee097f9", + "rev": "05e7e0996493f47bbc15228895c4e31ce24616f0", "type": "github" }, "original": { @@ -124,11 +124,11 @@ ] }, "locked": { - "lastModified": 1706833576, - "narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=", + "lastModified": 1708231718, + "narHash": "sha256-IZdieFWvhBkxoOFMDejqLUYqD94WN6k0YSpw0DFy+4g=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7", + "rev": "0e6857fa1d632637488666c08e7b02c08e3178f8", "type": "github" }, "original": { @@ -240,11 +240,11 @@ ] }, "locked": { - "lastModified": 1707175763, - "narHash": "sha256-0MKHC6tQ4KEuM5rui6DjKZ/VNiSANB4E+DJ/+wPS1PU=", + "lastModified": 1708294481, + "narHash": "sha256-DZtxmeb4OR7iCaKUUuq05ADV2rX8WReZEF7Tq//W0+Y=", "owner": "nix-community", "repo": "home-manager", - "rev": "f99eace7c167b8a6a0871849493b1c613d0f1b80", + "rev": "a54e05bc12d88ff2df941d0dc1183cb5235fa438", "type": "github" }, "original": { @@ -314,11 +314,11 @@ ] }, "locked": { - "lastModified": 1707441239, - "narHash": "sha256-5l4rk/1Q9DbzFbRGvGM3pAtdZMRhiqkOpBHaGLTvvsw=", + "lastModified": 1708305364, + "narHash": "sha256-6m58olvOak9+2UgWfkV4ZWJRs+93eTepQd/cINtRSWE=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "e32bf2c7fb97e06c9d7febc31c946eb3be42c2ab", + "rev": "1a5a7a0b0aaada25c21481d63d75acd7ed52d904", "type": "github" }, "original": { @@ -334,11 +334,11 @@ ] }, "locked": { - "lastModified": 1707016097, - "narHash": "sha256-V4lHr6hFQ3rK650dh64Xffxsf4kse9vUYWsM+ldjkco=", + "lastModified": 1708225687, + "narHash": "sha256-NJBDfvknI26beOFmjO2coeJMTTUCCtw2Iu+rvJ1Zb9k=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "3e3dad2808379c522138e2e8b0eb73500721a237", + "rev": "17352eb241a8d158c4ac523b19d8d2a6c8efe127", "type": "github" }, "original": { @@ -349,11 +349,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1707211557, - "narHash": "sha256-LTKTzZ6fM5j8XWXf51IMBzDaOaJg9kYWLUZxoIhzRN8=", + "lastModified": 1708091350, + "narHash": "sha256-o28BJYi68qqvHipT7V2jkWxDiMS1LF9nxUsou+eFUPQ=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "6e5cc385fc8cf5ca6495d70243074ccdea9f64c7", + "rev": "106d3fec43bcea19cb2e061ca02531d54b542ce3", "type": "github" }, "original": { @@ -364,11 +364,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1707423438, - "narHash": "sha256-6URYQs2deyXOa6q9SuV2OgKtjx1q7Jnr0mgmO3DFqfw=", + "lastModified": 1708341091, + "narHash": "sha256-3R7doGV1AoB5VKFifEd5elj8t4cld6VpJRpn9NaYr1Y=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a1eec211fcb06ae6eb9a46b399878cb1cc1717c0", + "rev": "86ef6bd96b6279e1a4a53236d341f5df1ede3803", "type": "github" }, "original": { @@ -380,11 +380,11 @@ }, "nixpkgs-master": { "locked": { - "lastModified": 1707466695, - "narHash": "sha256-CeTuYGD6QvkCuVIoGlLvYF3ew57gDG9lJVjjkr/hRWA=", + "lastModified": 1708366181, + "narHash": "sha256-YnsUXXxfZWQwpxlWuswDJnK8sLYY2I+qsro5f1qe9Uw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "17048c39cbbecb8399243fc7800be007369c803c", + "rev": "abf7f7afff7d7835e8d8e334219d9cdfab533214", "type": "github" }, "original": { @@ -396,11 +396,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1707442183, - "narHash": "sha256-e4mBVnw9lsd+ZHaU5JAaydh6Rk/W97YHTkqVvspW3kk=", + "lastModified": 1708353490, + "narHash": "sha256-PAZZCyg5VK+PD4cpG2ueSLAjGTjUJiMMSUrRctM7CiY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9d7a44754fae79c6b0821cbb0407418f79d24cc0", + "rev": "f74663f3fbba3fc2134233b18d30e09038c76fa2", "type": "github" }, "original": { @@ -461,11 +461,11 @@ ] }, "locked": { - "lastModified": 1707297608, - "narHash": "sha256-ADjo/5VySGlvtCW3qR+vdFF4xM9kJFlRDqcC9ZGI8EA=", + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "0db2e67ee49910adfa13010e7f012149660af7f0", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", "type": "github" }, "original": { @@ -531,11 +531,11 @@ ] }, "locked": { - "lastModified": 1707441271, - "narHash": "sha256-VbhPwJ6JDLklCClM1T14pzKrgsnIvWOg/2YUmYBmLFk=", + "lastModified": 1708305444, + "narHash": "sha256-hCDR72rsHC3z2YvDywRgXLiPK8emn+jtl5fdoH30aeY=", "owner": "nix-community", "repo": "nix-vscode-extensions", - "rev": "a008981410d7da870988b5415ebd33165d98084d", + "rev": "35e0cabb16c66709d6c91eda8067d740492172d5", "type": "github" }, "original": { diff --git a/modules/common/common/shell/functions.bash b/modules/common/common/shell/functions.bash index d947d0f..f354adb 100644 --- a/modules/common/common/shell/functions.bash +++ b/modules/common/common/shell/functions.bash @@ -1,59 +1,59 @@ function where() { - local s - s="$(type -P "$1")" - realpath "$s" + local s + s="$(type -P "$1")" + realpath "$s" } complete -F _command where function what() { - local s - s="$(where "$1")" - printf "%s\n" "${s%/*/*}" + local s + s="$(where "$1")" + printf "%s\n" "${s%/*/*}" } complete -F _command what function cat() { - if (($# == 1)) && [[ -d $1 ]]; then - ll "$1" - else - command cat "$@" - fi + if (($# == 1)) && [[ -d $1 ]]; then + ll "$1" + else + command cat "$@" + fi } function cd() { - builtin cd "$@" && - if ((${#FUNCNAME[@]} == 1)); then - ls - fi + builtin cd "$@" && + if ((${#FUNCNAME[@]} == 1)); then + ls + fi } function mkcd() { - mkdir -p "$1" && builtin cd "$1" + mkdir -p "$1" && builtin cd "$1" } function mvcd() { - mv -i -- "$PWD" "$1" && builtin cd . + mv -i -- "$PWD" "$1" && builtin cd . } function bak() { - local f - for f; do - cp -ai -- "$f" "$f.bak" - done + local f + for f; do + cp -ai -- "$f" "$f.bak" + done } function ubak() { - local f - for f; do - [[ $f == *.bak ]] || f="$f.bak" - mv -i -- "$f" "${f%.bak}" - done + local f + for f; do + [[ $f == *.bak ]] || f="$f.bak" + mv -i -- "$f" "${f%.bak}" + done } function dec2hex() { - printf "0x%X\n" "$1" + printf "0x%X\n" "$1" } function hex2dec() { - printf "%d\n" "0x$1" + printf "%d\n" "0x$1" } diff --git a/modules/common/editorconfig.nix b/modules/common/editorconfig.nix index 822acf6..537912f 100644 --- a/modules/common/editorconfig.nix +++ b/modules/common/editorconfig.nix @@ -29,7 +29,7 @@ in { }; # https://go.dev/doc/effective_go#formatting - "*.go" = { + "{*.go,go.mod}" = { indent_size = 2; indent_style = "tab"; }; @@ -66,7 +66,7 @@ in { indent_style = "space"; }; - "*.{asm,s}" = { + "*.{asm,s,S}" = { indent_size = 4; indent_style = "spaces"; }; @@ -90,6 +90,12 @@ in { indent_style = "space"; }; + # https://nickel-lang.org/user-manual/syntax + "*.ncl" = { + indent_size = 2; + indent_style = "space"; + }; + # https://developer.hashicorp.com/terraform/language/syntax/style "*.{tf,hcl}" = { indent_size = 2; diff --git a/modules/common/emacs/default.nix b/modules/common/emacs/default.nix index 082b3c3..439a6bc 100644 --- a/modules/common/emacs/default.nix +++ b/modules/common/emacs/default.nix @@ -71,6 +71,7 @@ in { cmigemo # :lang japanese config.hm.programs.emacs.package # !doom config.nix.package # !doom + delve # :lang go :tools debugger dockerfile-language-server-nodejs # :tools (docker +lsp) dockfmt # :tools docker :editor format editorconfig-core-c # :tools editorconfig @@ -198,7 +199,6 @@ in { org-plantuml-jar-path plantuml-jar-path org-plantuml-executable-path plantuml-executable-path) - ;; :app irc (setq circe-default-nick "${my.username}" circe-default-realname "${my.email}" @@ -248,14 +248,6 @@ in { # https://github.com/akermu/emacs-libvterm if [[ "$INSIDE_EMACS" = vterm ]] && [[ -n "$EMACS_VTERM_PATH" ]] && [[ -f "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh" ]]; then source "$EMACS_VTERM_PATH/etc/emacs-vterm-bash.sh" - - message() { - vterm_cmd message "%s" "$*" - } - - find-file() { - vterm_cmd find-file "$(realpath "''${@:-.}")" - } fi # Not sourced from inside Emacs for some reason. Maybe it's not diff --git a/modules/common/emacs/doom/config.el b/modules/common/emacs/doom/config.el index 13eb5ba..70116f8 100644 --- a/modules/common/emacs/doom/config.el +++ b/modules/common/emacs/doom/config.el @@ -64,41 +64,15 @@ ("HOLD" . +org-todo-onhold) ("PROJ" . +org-todo-project) ("KILL" . +org-todo-cancel)) - org-capture-templates '(("t" "Personal todo" entry + org-capture-templates '(("t" "Todo" entry (file+headline +org-capture-todo-file "Inbox") "* TODO %?\n%i\n%a" :prepend t) - ("n" "Personal notes" entry + ("n" "Note" entry (file+headline +org-capture-notes-file "Inbox") "* %u %?\n%i\n%a" :prepend t) ("j" "Journal" entry (file+olp+datetree +org-capture-journal-file) - "* %U %?\n%i\n%a" :prepend t) - ("p" "Templates for projects") - ("pt" "Project-local todo" entry - (file+headline +org-capture-project-todo-file "Inbox") - "* TODO %?\n%i\n%a" :prepend t) - ("pn" "Project-local notes" entry - (file+headline +org-capture-project-notes-file "Inbox") - "* %U %?\n%i\n%a" :prepend t) - ("pc" "Project-local changelog" entry - (file+headline +org-capture-project-changelog-file "Unreleased") - "* %U %?\n%i\n%a" :prepend t) - ("o" "Centralized templates for projects") - ("ot" "Project todo" entry - (function +org-capture-central-project-todo-file) - "* TODO %?\n %i\n %a" - :heading "Tasks" - :prepend nil) - ("on" "Project notes" entry - (function +org-capture-central-project-notes-file) - "* %U %?\n %i\n %a" - :heading "Notes" - :prepend t) - ("oc" "Project changelog" entry - (function +org-capture-central-project-changelog-file) - "* %U %?\n %i\n %a" - :heading "Changelog" - :prepend t)))) + "* %U %?\n%i\n%a" :prepend t)))) (add-hook! 'org-mode-hook 'auto-fill-mode) diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index ee63ba1..93f0974 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -29,7 +29,7 @@ _: { ./libvirtd.nix ./lidarr.nix ./loki.nix - ./lxc.nix + ./incus.nix ./matrix ./monitoring ./mpd.nix diff --git a/modules/nixos/incus.nix b/modules/nixos/incus.nix new file mode 100644 index 0000000..ada113f --- /dev/null +++ b/modules/nixos/incus.nix @@ -0,0 +1,62 @@ +{ + config, + lib, + ... +}: +with lib; let + cfg = config.nixfiles.modules.incus; +in { + options.nixfiles.modules.incus.enable = mkEnableOption "Incus"; + + config = mkIf cfg.enable { + ark.directories = ["/var/lib/incus"]; + + virtualisation.incus = { + enable = true; + + preseed = mkDefault { + networks = [ + { + name = "incusbr0"; + type = "bridge"; + config = { + "ipv4.address" = "10.0.30.1/24"; + "ipv4.nat" = true; + "ipv6.address" = "fc30::1/64"; + "ipv6.nat" = true; + }; + } + ]; + storage_pools = [ + { + name = "default"; + driver = "dir"; + config.source = "/var/lib/incus/storage-pools/default"; + } + ]; + profiles = [ + { + name = "default"; + devices = { + eth0 = { + type = "nic"; + name = "eth0"; + network = "incusbr0"; + }; + root = { + type = "disk"; + pool = "default"; + size = "15GiB"; + path = "/"; + }; + }; + } + ]; + }; + }; + + networking.firewall.trustedInterfaces = ["incusbr0"]; + + my.extraGroups = ["incus-admin"]; + }; +} diff --git a/modules/nixos/lxc.nix b/modules/nixos/lxc.nix deleted file mode 100644 index 1306497..0000000 --- a/modules/nixos/lxc.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.nixfiles.modules.lxc; -in { - options.nixfiles.modules.lxc.enable = mkEnableOption "LXC/Incus"; - - config = mkIf cfg.enable { - ark.directories = ["/var/lib/incus"]; - - virtualisation.incus.enable = true; - - my.extraGroups = ["incus-admin"]; - }; -} diff --git a/modules/nixos/matrix/default.nix b/modules/nixos/matrix/default.nix index 879243e..e7d5a02 100644 --- a/modules/nixos/matrix/default.nix +++ b/modules/nixos/matrix/default.nix @@ -2,6 +2,5 @@ _: { imports = [ ./dendrite.nix ./element.nix - ./synapse.nix ]; } diff --git a/modules/nixos/matrix/synapse.nix b/modules/nixos/matrix/synapse.nix deleted file mode 100644 index 02592de..0000000 --- a/modules/nixos/matrix/synapse.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ - config, - lib, - ... -}: -with lib; let - cfg = config.nixfiles.modules.matrix.synapse; -in { - options.nixfiles.modules.matrix.synapse = { - enable = mkEnableOption "Synapse Matrix server"; - - domain = mkOption { - description = "Domain name sans protocol scheme."; - type = with types; str; - default = config.networking.domain; - }; - }; - - config = let - bind_address = "127.0.0.1"; - port = 8448; - in - mkIf cfg.enable { - ark.directories = ["/var/lib/matrix-synapse"]; - - nixfiles.modules = { - nginx = { - enable = true; - upstreams.synapse.servers."${bind_address}:${toString port}" = {}; - virtualHosts.${cfg.domain}.locations = { - "~ ^(/_matrix|/_synapse/client)".proxyPass = "http://synapse"; - "= /.well-known/matrix/server" = { - extraConfig = '' - add_header Content-Type application/json; - ''; - return = "200 '${generators.toJSON {} { - "m.server" = "${cfg.domain}:443"; - }}'"; - }; - "= /.well-known/matrix/client" = { - extraConfig = '' - add_header Content-Type application/json; - add_header Access-Control-Allow-Origin *; - ''; - return = "200 '${generators.toJSON {} { - "m.homeserver".base_url = "https://${cfg.domain}"; - }}'"; - }; - }; - }; - postgresql.enable = true; - }; - - services = let - db = "synapse"; - in { - matrix-synapse = { - enable = true; - server_name = config.networking.domain; - - database_type = "psycopg2"; - database_name = db; - database_user = db; - - listeners = [ - { - inherit bind_address port; - type = "http"; - tls = false; - x_forwarded = true; - resources = [ - { - names = ["client" "federation"]; - compress = false; - } - ]; - } - ]; - }; - - postgresql = { - ensureDatabases = [db]; - ensureUsers = [ - { - name = db; - ensureDBOwnership = true; - } - ]; - }; - }; - }; -} diff --git a/modules/nixos/podman.nix b/modules/nixos/podman.nix index f6ee6bf..60f208e 100644 --- a/modules/nixos/podman.nix +++ b/modules/nixos/podman.nix @@ -34,25 +34,13 @@ in { my.extraGroups = ["podman"]; hm.xdg.configFile = { - # This removes a really annoying registry search. 100% of the time I - # would need to look up stuff from the Docker and not Quay! - "containers/registries.conf".text = '' - [registries.search] - registries = ["docker.io"] - ''; - - # As for plain OverlayFS in Podman over ZFS[1]... I guess we are waiting - # for Podman to catch up now. - # - # [1]: https://github.com/openzfs/zfs/pull/14070#issuecomment-1309116666 - "containers/storage.conf".text = optionalString config.boot.zfs.enabled '' - [storage] - driver = "overlay" - - [storage.options] - mount_program = "${getExe' pkgs.fuse-overlayfs "fuse-overlayfs"}" - mountopt = "noatime,nodev,nosuid" - ''; + "containers/registries.conf".source = pkgs.writers.writeTOML "containers-registries.toml" { + registries.search.registries = ["docker.io"]; + }; + + "containers/storage.conf".source = pkgs.writers.writeTOML "containers-storage.toml" { + storage.driver = "overlay"; + }; }; }; } diff --git a/nixosConfigurations/eonwe/default.nix b/nixosConfigurations/eonwe/default.nix index 9afaf2c..e0ae7d6 100644 --- a/nixosConfigurations/eonwe/default.nix +++ b/nixosConfigurations/eonwe/default.nix @@ -24,6 +24,7 @@ with lib; { steam-run.quirks.blackIsleStudios = true; }; libvirtd.enable = true; + incus.enable = true; mpd.enable = true; qutebrowser.enable = true; }; |