From 9dffcd14b748e9fcebb5ac82ed6dbc14e1ee1f22 Mon Sep 17 00:00:00 2001 From: Lukas Wurzinger Date: Fri, 8 Mar 2024 22:46:46 +0100 Subject: [PATCH] improvements --- README.md | 4 +- class/desktop/clipboard.nix | 3 + class/desktop/default.nix | 5 +- class/desktop/fish.nix | 4 - class/desktop/fonts.nix | 22 +- class/desktop/neovide.nix | 5 + class/desktop/plasma.nix | 39 +-- class/desktop/users.nix | 11 + class/desktop/vscode.nix | 3 - common/atuin.nix | 14 +- common/bash.nix | 18 ++ common/bottom.nix | 3 + common/cli.nix | 59 ---- common/default.nix | 6 +- common/direnv.nix | 11 + common/git.nix | 6 + common/myvim.nix | 18 ++ common/nix.nix | 1 + common/starship.nix | 4 +- common/users.nix | 3 + common/zellij.nix | 3 + flake.lock | 414 ++++++++++++++++++++++++++- flake.nix | 95 +++--- home/bash/bashrc | 42 --- home/fish/config.fish | 147 ---------- home/helix/config.toml | 24 -- home/helix/themes/logarithmancy.toml | 5 - hosts/abacus/atuin.nix | 33 +++ hosts/abacus/default.nix | 1 + hosts/glacier/default.nix | 1 - hosts/vessel/backup.nix | 52 ++-- scripts/home.sh | 207 -------------- 32 files changed, 640 insertions(+), 623 deletions(-) create mode 100644 class/desktop/clipboard.nix delete mode 100644 class/desktop/fish.nix create mode 100644 class/desktop/neovide.nix create mode 100644 class/desktop/users.nix delete mode 100644 class/desktop/vscode.nix create mode 100644 common/bash.nix create mode 100644 common/bottom.nix delete mode 100644 common/cli.nix create mode 100644 common/direnv.nix create mode 100644 common/git.nix create mode 100644 common/myvim.nix create mode 100644 common/zellij.nix delete mode 100644 home/bash/bashrc delete mode 100644 home/fish/config.fish delete mode 100644 home/helix/config.toml delete mode 100644 home/helix/themes/logarithmancy.toml create mode 100644 hosts/abacus/atuin.nix delete mode 100644 scripts/home.sh diff --git a/README.md b/README.md index e2a2cde..f411e07 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# ✨ puter ✨ +# ❄️ puter -This is my NixOS configuration. There are many like it, but this one is mine. +This is my NixOS configuration. There are many like it, but this one is mine. Copy at your own risk. ## Partitioning diff --git a/class/desktop/clipboard.nix b/class/desktop/clipboard.nix new file mode 100644 index 0000000..cab0c1c --- /dev/null +++ b/class/desktop/clipboard.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + environment.systemPackages = [pkgs.wl-clipboard]; +} diff --git a/class/desktop/default.nix b/class/desktop/default.nix index 1b09e22..58d8aca 100644 --- a/class/desktop/default.nix +++ b/class/desktop/default.nix @@ -1,8 +1,8 @@ { imports = [ + ./clipboard.nix ./compatibility.nix ./docker.nix - ./fish.nix ./flatpak.nix ./fonts.nix ./fs.nix @@ -11,11 +11,12 @@ ./hardware.nix ./location.nix ./mullvad.nix + ./neovide.nix ./networking.nix ./pipewire.nix ./plasma.nix ./printing.nix ./syncthing.nix - ./vscode.nix + ./users.nix ]; } diff --git a/class/desktop/fish.nix b/class/desktop/fish.nix deleted file mode 100644 index 8f3a7c9..0000000 --- a/class/desktop/fish.nix +++ /dev/null @@ -1,4 +0,0 @@ -{pkgs, ...}: { - programs.fish.enable = true; - users.defaultUserShell = pkgs.fish; -} diff --git a/class/desktop/fonts.nix b/class/desktop/fonts.nix index 4bb7d0f..e782eda 100644 --- a/class/desktop/fonts.nix +++ b/class/desktop/fonts.nix @@ -1,25 +1,27 @@ {pkgs, ...}: { fonts = { enableDefaultPackages = true; - - packages = with pkgs; [ - noto-fonts - noto-fonts-extra - noto-fonts-cjk-sans - noto-fonts-cjk-serif - noto-fonts-emoji - (nerdfonts.override {fonts = ["Noto" "Iosevka"];}) + packages = [ + pkgs.noto-fonts + pkgs.noto-fonts-extra + pkgs.noto-fonts-cjk-sans + pkgs.noto-fonts-cjk-serif + pkgs.noto-fonts-monochrome-emoji + pkgs.noto-fonts-color-emoji + (pkgs.nerdfonts.override {fonts = ["Noto"];}) ]; fontconfig = { enable = true; defaultFonts = { - monospace = ["NotoSansMono Nerd Font"]; + monospace = ["NotoSansM Nerd Font"]; sansSerif = ["Noto Sans"]; serif = ["Noto Serif"]; - emoji = ["Noto Color Emoji"]; + emoji = ["Noto Color Emoji" "Noto Emoji"]; }; }; + + fontDir.enable = true; }; } diff --git a/class/desktop/neovide.nix b/class/desktop/neovide.nix new file mode 100644 index 0000000..6821dbf --- /dev/null +++ b/class/desktop/neovide.nix @@ -0,0 +1,5 @@ +{pkgs, ...}: let + package = pkgs.neovide; +in { + environment.systemPackages = [package]; +} diff --git a/class/desktop/plasma.nix b/class/desktop/plasma.nix index fe3c47a..2a35374 100644 --- a/class/desktop/plasma.nix +++ b/class/desktop/plasma.nix @@ -1,27 +1,16 @@ {pkgs, ...}: { - # TODO - # displayManager = { - # defaultSession = "plasmawayland"; - # sddm = { - # enable = true; - # autoNumlock = true; - # settings = { - # Theme = { - # CursorTheme = "breeze_cursors"; - # }; - # }; - # }; - # }; - - services = { - xserver = { - enable = true; - desktopManager.plasma6.enable = true; - displayManager.sddm.enable = true; - excludePackages = with pkgs; [ - xterm - ]; + services.xserver = { + enable = true; + desktopManager.plasma6.enable = true; + displayManager = { + defaultSession = "plasma"; + sddm = { + enable = true; + wayland.enable = true; + settings.Theme.CursorTheme = "breeze_cursors"; + }; }; + excludePackages = [pkgs.xterm]; }; environment = { @@ -31,11 +20,11 @@ pkgs.sddm-kcm ]; sessionVariables = { - "SUDO_ASKPASS" = pkgs.writeShellScript "kdialogaskpass" '' + SUDO_ASKPASS = pkgs.writeShellScript "kdialogaskpass" '' exec ${pkgs.kdialog} --password Askpass ''; - "MOZ_USE_XINPUT2" = "1"; - "GDK_SCALE" = "1"; + MOZ_USE_XINPUT2 = "1"; + GDK_SCALE = "1"; }; }; diff --git a/class/desktop/users.nix b/class/desktop/users.nix new file mode 100644 index 0000000..0dd12db --- /dev/null +++ b/class/desktop/users.nix @@ -0,0 +1,11 @@ +{ + users = { + groups.guest = {}; + + users.guest = { + isNormalUser = true; + password = "guest"; + extraGroups = ["wheel" "networkmanager" "gamemode"]; + }; + }; +} diff --git a/class/desktop/vscode.nix b/class/desktop/vscode.nix deleted file mode 100644 index 582e92d..0000000 --- a/class/desktop/vscode.nix +++ /dev/null @@ -1,3 +0,0 @@ -{pkgs, ...}: { - environment.systemPackages = [pkgs.vscode-fhs]; -} diff --git a/common/atuin.nix b/common/atuin.nix index a276d7f..c02c96a 100644 --- a/common/atuin.nix +++ b/common/atuin.nix @@ -1,5 +1,13 @@ { - services.atuin = { - enable = true; - }; + lib, + pkgs, + ... +}: let + package = pkgs.atuin; +in { + environment.systemPackages = [package]; + + programs.bash.interactiveShellInit = '' + eval "$(${lib.getExe package} init bash)" + ''; } diff --git a/common/bash.nix b/common/bash.nix new file mode 100644 index 0000000..4bcd147 --- /dev/null +++ b/common/bash.nix @@ -0,0 +1,18 @@ +{ + programs = { + command-not-found.enable = false; + + bash = { + blesh.enable = true; + + interactiveShellInit = '' + shopt -s globstar + shopt -s nullglob + shopt -s extglob + shopt -s checkwinsize + + bind 'set show-mode-in-prompt off' + ''; + }; + }; +} diff --git a/common/bottom.nix b/common/bottom.nix new file mode 100644 index 0000000..fcb62d0 --- /dev/null +++ b/common/bottom.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + environment.systemPackages = [pkgs.bottom]; +} diff --git a/common/cli.nix b/common/cli.nix deleted file mode 100644 index b2d9800..0000000 --- a/common/cli.nix +++ /dev/null @@ -1,59 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: { - programs = { - command-not-found.enable = false; - - git = { - enable = true; - lfs.enable = true; - }; - - nix-index = { - enable = true; - enableBashIntegration = true; - }; - - direnv.enable = true; - - bash = { - promptInit = '' - if [[ -v SSH_CLIENT && -v SSH_CONNECTION && -v SSH_TTY ]]; then - PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' - else - PS1='\[\033[01;34m\]\w\[\033[00m\]\$ ' - fi - ''; - interactiveShellInit = '' - shopt -s histappend - HISTCONTROL='ignoredups:ignorespace' - HISTSIZE=1000 - HISTFILESIZE=10000 - - shopt -s globstar - shopt -s nullglob - shopt -s extglob - - shopt -s checkwinsize - - eval "$(${lib.getExe config.programs.direnv.package} hook bash)" - ''; - }; - }; - - environment = { - systemPackages = [ - pkgs.bottom - pkgs.comma - pkgs.helix - ]; - - variables = { - EDITOR = lib.getExe pkgs.helix; - VISUAL = lib.getExe pkgs.helix; - }; - }; -} diff --git a/common/default.nix b/common/default.nix index 363ad2a..9d1bb71 100644 --- a/common/default.nix +++ b/common/default.nix @@ -2,11 +2,15 @@ imports = [ ./atuin.nix ./avahi.nix + ./bash.nix ./boot.nix - ./cli.nix + ./bottom.nix ./dbus.nix + ./direnv.nix ./fs.nix ./fwupd.nix + ./git.nix + ./myvim.nix ./nix.nix ./opengl.nix ./readline.nix diff --git a/common/direnv.nix b/common/direnv.nix new file mode 100644 index 0000000..fd8cafb --- /dev/null +++ b/common/direnv.nix @@ -0,0 +1,11 @@ +{ + config, + lib, + ... +}: { + programs.direnv.enable = true; + + programs.bash.interactiveShellInit = '' + eval "$(${lib.getExe config.programs.direnv.package} hook bash)" + ''; +} diff --git a/common/git.nix b/common/git.nix new file mode 100644 index 0000000..d8ac829 --- /dev/null +++ b/common/git.nix @@ -0,0 +1,6 @@ +{ + programs.git = { + enable = true; + lfs.enable = true; + }; +} diff --git a/common/myvim.nix b/common/myvim.nix new file mode 100644 index 0000000..b9a3ed1 --- /dev/null +++ b/common/myvim.nix @@ -0,0 +1,18 @@ +{ + lib, + inputs, + pkgs, + ... +}: { + environment = let + package = inputs.myvim.packages.${pkgs.system}.default; + in { + systemPackages = [package]; + variables = let + name = builtins.baseNameOf (lib.getExe package); + in { + EDITOR = name; + VISUAL = name; + }; + }; +} diff --git a/common/nix.nix b/common/nix.nix index 0dc6309..75c911c 100644 --- a/common/nix.nix +++ b/common/nix.nix @@ -10,6 +10,7 @@ nixPath = lib.mapAttrsToList (key: _: "${key}=flake:${key}") config.nix.registry; settings = { + trusted-users = ["@wheel"]; experimental-features = "nix-command flakes"; auto-optimise-store = true; }; diff --git a/common/starship.nix b/common/starship.nix index 900e789..491995c 100644 --- a/common/starship.nix +++ b/common/starship.nix @@ -2,8 +2,6 @@ programs.starship = { enable = true; interactiveOnly = true; - settings = { - format = "$all"; - }; + settings.format = "$all"; }; } diff --git a/common/users.nix b/common/users.nix index f43acfa..a1cad7d 100644 --- a/common/users.nix +++ b/common/users.nix @@ -3,6 +3,9 @@ users = { mutableUsers = false; + + groups.lukas = {}; + users = { root.hashedPassword = "!"; lukas = { diff --git a/common/zellij.nix b/common/zellij.nix new file mode 100644 index 0000000..62d8011 --- /dev/null +++ b/common/zellij.nix @@ -0,0 +1,3 @@ +{pkgs, ...}: { + environment.systemPackages = [pkgs.zellij]; +} diff --git a/flake.lock b/flake.lock index 4c73cbb..4d785c5 100644 --- a/flake.lock +++ b/flake.lock @@ -59,6 +59,29 @@ "type": "github" } }, + "devshell": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "myvim", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708939976, + "narHash": "sha256-O5+nFozxz2Vubpdl1YZtPrilcIXPcRAjqNdNE8oCRoA=", + "owner": "numtide", + "repo": "devshell", + "rev": "5ddecd67edbd568ebe0a55905273e56cc82aabe3", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "flake-compat": { "flake": false, "locked": { @@ -75,13 +98,160 @@ "type": "github" } }, + "flake-compat_2": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "myvim", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "myvim", + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "hardware": { "locked": { - "lastModified": 1708594753, - "narHash": "sha256-c/gH7iXS/IYH9NrFOT+aJqTq+iEBkvAkpWuUHGU3+f0=", + "lastModified": 1709410583, + "narHash": "sha256-esOSUoQ7mblwcsSea0K17McZuwAIjoS6dq/4b83+lvw=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "3f7d0bca003eac1a1a7f4659bbab9c8f8c2a0958", + "rev": "59e37017b9ed31dee303dbbd4531c594df95cfbc", "type": "github" }, "original": { @@ -111,6 +281,28 @@ "type": "github" } }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "myvim", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709578243, + "narHash": "sha256-hF96D+c2PBmAFhymMw3z8hou++lqKtZ7IzpFbYeL1/Y=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "23ff9821bcaec12981e32049e8687f25f11e5ef3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1708968331, @@ -136,11 +328,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1706742486, - "narHash": "sha256-sv/MISTeD0rqeVivpZJpynboMWJp6i62OmrZX1rGl38=", + "lastModified": 1709905972, + "narHash": "sha256-18OF2/ypr0n4Lp6Fk5SLHPu12ok6jM+Hv3sC0PCim0Q=", "owner": "simple-nixos-mailserver", "repo": "nixos-mailserver", - "rev": "9e36323ae3dde787f761420465c3ae560f3dbf29", + "rev": "572c1b4d69deea1093ac231c37927cfa8ccad477", "type": "gitlab" }, "original": { @@ -149,6 +341,48 @@ "type": "gitlab" } }, + "myvim": { + "inputs": { + "flake-parts": "flake-parts_2", + "nixpkgs": "nixpkgs_3", + "nixvim": "nixvim" + }, + "locked": { + "lastModified": 1709934012, + "narHash": "sha256-BLyDTCDzqsKQchfpsMiYn37LIxGSuO0Xt20pNByfQpo=", + "owner": "lukaswrz", + "repo": "myvim", + "rev": "badba27c9f9052e73074801af36e099462c38da9", + "type": "github" + }, + "original": { + "owner": "lukaswrz", + "repo": "myvim", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "myvim", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709554374, + "narHash": "sha256-1yYgwxBzia+QrOaQaZ6YKqGFfiQcSBwYLzd9XRsRLQY=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "daa03606dfb5296a22e842acb02b46c1c4e9f5e7", + "type": "github" + }, + "original": { + "owner": "lnl7", + "repo": "nix-darwin", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1703013332, @@ -195,6 +429,42 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1709237383, + "narHash": "sha256-cy6ArO4k5qTx+l5o+0mL9f5fa86tYUX3ozE1S+Txlds=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1536926ef5621b09bba54035ae2bb6d806d72ac8", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1705856552, @@ -212,27 +482,115 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1709018681, - "narHash": "sha256-nJXhGOM5Sk1TjtGQjP1qfrq/dNyCakAjHINUF76VBhA=", - "owner": "K900", + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "d4a80ff23f9a4465a01a1aab462338e6837ea9be", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", "type": "github" }, "original": { - "owner": "K900", - "ref": "plasma-6", + "owner": "NixOS", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs_4": { + "locked": { + "lastModified": 1709479366, + "narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b8697e57f10292a6165a20f03d2f42920dfaf973", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixvim": { + "inputs": { + "devshell": "devshell", + "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts_3", + "home-manager": "home-manager_2", + "nix-darwin": "nix-darwin", + "nixpkgs": "nixpkgs_4", + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1709928810, + "narHash": "sha256-K9TwzOtmOTC0a1FNRfph2WLlMlEx5O38Rg5kXJ5hNxg=", + "owner": "nix-community", + "repo": "nixvim", + "rev": "f6e79601adab90a922fd60009af9670ef1f035fa", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixvim", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "myvim", + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": [ + "myvim", + "nixvim", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", + "flake-parts": "flake-parts", "hardware": "hardware", "impermanence": "impermanence", "mailserver": "mailserver", - "nixpkgs": "nixpkgs_3" + "myvim": "myvim", + "nixpkgs": "nixpkgs_5" } }, "systems": { @@ -250,6 +608,36 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1605370193, diff --git a/flake.nix b/flake.nix index 46c96ed..aa0aabd 100644 --- a/flake.nix +++ b/flake.nix @@ -2,65 +2,62 @@ description = "My NixOS configuration"; inputs = { - nixpkgs.url = "github:K900/nixpkgs/plasma-6"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; hardware.url = "github:NixOS/nixos-hardware"; impermanence.url = "github:nix-community/impermanence"; agenix.url = "github:ryantm/agenix"; mailserver.url = "gitlab:simple-nixos-mailserver/nixos-mailserver"; + myvim.url = "github:lukaswrz/myvim"; }; - outputs = {nixpkgs, ...} @ inputs: let - supportedSystems = ["x86_64-linux" "aarch64-linux"]; + outputs = { + nixpkgs, + flake-parts, + ... + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux" "aarch64-linux"]; - forEachSystem = f: - nixpkgs.lib.genAttrs supportedSystems (system: f (import nixpkgs {inherit system;})); + flake = let + commonNixosSystem = name: class: + nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs; + attrName = name; + }; + modules = [ + inputs.impermanence.nixosModules.impermanence + inputs.agenix.nixosModules.default + inputs.mailserver.nixosModule - mkSystem = name: class: - nixpkgs.lib.nixosSystem { - specialArgs = { - inherit inputs; - attrName = name; - }; - modules = [ - inputs.impermanence.nixosModules.impermanence - inputs.agenix.nixosModules.default - inputs.mailserver.nixosModule + ./common + ./class/${class} + ./hosts/${name} - ./common - (./class + "/${class}") - (./hosts + "/${name}") - - ({lib, ...}: {networking.hostName = lib.mkDefault name;}) - ]; - }; - - hosts = { - glacier = "desktop"; - flamingo = "desktop"; - scenery = "desktop"; - abacus = "server"; - vessel = "server"; - }; - in { - nixosConfigurations = builtins.mapAttrs mkSystem hosts; - - devShells = forEachSystem (pkgs: { - default = pkgs.mkShellNoCC { - packages = [ - pkgs.nil - inputs.agenix.packages.${pkgs.system}.agenix - (pkgs.writeShellApplication { - name = "home"; - runtimeInputs = [ - pkgs.git - pkgs.flatpak + ({lib, ...}: {networking.hostName = lib.mkDefault name;}) ]; - text = builtins.readFile ./scripts/home.sh; - }) - ]; + }; + in { + nixosConfigurations = builtins.mapAttrs commonNixosSystem { + glacier = "desktop"; + flamingo = "desktop"; + scenery = "desktop"; + abacus = "server"; + vessel = "server"; + }; }; - }); - formatter = forEachSystem (pkgs: pkgs.alejandra); - }; + perSystem = { + inputs', + pkgs, + ... + }: { + devShells.default = pkgs.mkShellNoCC { + packages = [inputs'.agenix.packages.agenix]; + }; + + formatter = pkgs.alejandra; + }; + }; } diff --git a/home/bash/bashrc b/home/bash/bashrc deleted file mode 100644 index cc5b48e..0000000 --- a/home/bash/bashrc +++ /dev/null @@ -1,42 +0,0 @@ -source /etc/bashrc - -if [[ $- != *i* ]]; then - return -fi - -alias cpr='cp --recursive' - -alias df='df --human-readable' - -alias du='du --human-readable' - -alias gia='git add' -alias gic='git commit' -alias gico='git checkout' -alias gid='git diff' -alias gidh='git diff HEAD' -alias gi='git' -alias gin='grep --ignore-case --line-number' -alias gis='git status' - -alias g='grep' -alias gn='grep --line-number' -alias grep='grep --color' -alias grin='grep --recursive --ignore-case --line-number' - -alias la='ls --all' -alias lla='ls -l --all' -alias ll='ls -l' -alias l='ls' -alias lsa='ls --all' -alias lsla='ls -l --all' -alias lsl='ls -l' -alias ls='ls --color --classify' - -alias rmr='rm --recursive' -alias rr='rm --recursive' - -alias s='sudo' - -alias ffmpeg='ffmpeg -hide_banner' -alias ffprobe='ffprobe -hide_banner' diff --git a/home/fish/config.fish b/home/fish/config.fish deleted file mode 100644 index e4572a6..0000000 --- a/home/fish/config.fish +++ /dev/null @@ -1,147 +0,0 @@ -if status is-interactive - stty -ixon - set fish_greeting - - fish_vi_key_bindings - - bind \ee edit_command_buffer - - set fish_cursor_default block blink - set fish_cursor_insert line blink - set fish_cursor_replace_one underscore blink - set fish_cursor_visual block - - abbr --add --global l ls - abbr --add --global lsa ls -a - abbr --add --global la ls -a - abbr --add --global lsl ls -l - abbr --add --global ll ls -l - abbr --add --global lsla ls -la - abbr --add --global lla ls -la - abbr --add --global cp cp -n - abbr --add --global cpr cp -rn - abbr --add --global mv mv -n - abbr --add --global rm rm -i - abbr --add --global rmr rm -ri - abbr --add --global rr rm -ri - abbr --add --global v hx - abbr --add --global g git - abbr --add --global gc git commit - abbr --add --global gco git checkout - abbr --add --global gs git status - abbr --add --global gd git diff - abbr --add --global gdh git diff HEAD - abbr --add --global ga git add - abbr --add --global s sudo - abbr --add --global g grep - abbr --add --global gn grep -n - abbr --add --global gin grep -in - abbr --add --global grin grep -rin - abbr --add --global df df -h - abbr --add --global du du -h - abbr --add --global c cd - abbr --add --global cd. cd . - abbr --add --global cd.. cd .. - - function ls; command ls --classify=auto --color=auto $argv; end - function ffmpeg; command ffmpeg -hide_banner $argv; end - function ffprobe; command ffprobe -hide_banner $argv; end - function ffplay; command ffplay -hide_banner $argv; end - - function fish_prompt - if test $CMD_DURATION -gt 10000 - echo -ne '\a' - end - - set -l __last_command_exit_status $status - - if not set -q -g __fish_arrow_functions_defined - set -g __fish_arrow_functions_defined - function _git_branch_name - set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null) - if set -q branch[1] - echo (string replace -r '^refs/heads/' '' $branch) - else - echo (git rev-parse --short HEAD 2>/dev/null) - end - end - - function _is_git_dirty - not command git diff-index --cached --quiet HEAD -- &>/dev/null - or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null - end - - function _is_git_repo - type -q git - or return 1 - git rev-parse --git-dir >/dev/null 2>&1 - end - - function _hg_branch_name - echo (hg branch 2>/dev/null) - end - - function _is_hg_dirty - set -l stat (hg status -mard 2>/dev/null) - test -n "$stat" - end - - function _is_hg_repo - fish_print_hg_root >/dev/null - end - - function _repo_branch_name - _$argv[1]_branch_name - end - - function _is_repo_dirty - _is_$argv[1]_dirty - end - - function _repo_type - if _is_hg_repo - echo hg - return 0 - else if _is_git_repo - echo git - return 0 - end - return 1 - end - end - - set -l cyan (set_color -o cyan) - set -l yellow (set_color -o yellow) - set -l red (set_color -o red) - set -l green (set_color -o green) - set -l blue (set_color -o blue) - set -l normal (set_color normal) - - set -l prompt_color "$green" - if test $__last_command_exit_status != 0 - set prompt_color "$red" - end - - set -l prompt "$prompt_color\$" - if fish_is_root_user - set prompt "$prompt_color#" - end - - set -l cwd $cyan(basename -- (prompt_pwd)) - - set -l repo_info - if set -l repo_type (_repo_type) - set -l repo_branch $red(_repo_branch_name $repo_type) - set repo_info "$blue $repo_type:($repo_branch$blue)" - - if _is_repo_dirty $repo_type - set -l dirty "$yellow ✗" - set repo_info "$repo_info$dirty" - end - end - - echo -n -s -- $cwd $repo_info ' ' $prompt ' '$normal - end - - direnv hook fish | source -end diff --git a/home/helix/config.toml b/home/helix/config.toml deleted file mode 100644 index 7b4e7bd..0000000 --- a/home/helix/config.toml +++ /dev/null @@ -1,24 +0,0 @@ -theme = "logarithmancy" -[editor] -auto-save = true -bufferline = "multiple" -cursorline = true -line-number = "relative" -rulers = [80] - -[editor.cursor-shape] -insert = "bar" -normal = "block" -select = "underline" - -[editor.file-picker] -hidden = false - -[editor.indent-guides] -render = true - -[editor.lsp] -display-messages = true - -[keys.normal] -esc = ["collapse_selection", "keep_primary_selection"] diff --git a/home/helix/themes/logarithmancy.toml b/home/helix/themes/logarithmancy.toml deleted file mode 100644 index 26c3b97..0000000 --- a/home/helix/themes/logarithmancy.toml +++ /dev/null @@ -1,5 +0,0 @@ -inherits = "github_dark_high_contrast" -"ui.background" = "none" - -["ui.virtual.indent-guide"] -fg = "#2d3640" diff --git a/hosts/abacus/atuin.nix b/hosts/abacus/atuin.nix new file mode 100644 index 0000000..85cc3ce --- /dev/null +++ b/hosts/abacus/atuin.nix @@ -0,0 +1,33 @@ +{ + config, + lib, + ... +}: { + services = { + postgresql = { + enable = lib.mkDefault true; + + ensureDatabases = ["atuin"]; + ensureUsers = [ + { + name = "atuin"; + ensureDBOwnership = true; + } + ]; + }; + + atuin = { + enable = true; + openRegistration = false; + database.uri = "postgresql:///atuin?host=/run/postgresql&user=atuin"; + }; + + nginx.virtualHosts."atuin.${config.networking.domain}" = { + enableACME = true; + forceSSL = true; + quic = true; + + locations."/".proxyPass = "http://${config.services.atuin.host}:${builtins.toString config.services.atuin.port}"; + }; + }; +} diff --git a/hosts/abacus/default.nix b/hosts/abacus/default.nix index 0d36b8a..ba7893c 100644 --- a/hosts/abacus/default.nix +++ b/hosts/abacus/default.nix @@ -2,6 +2,7 @@ imports = [ (modulesPath + "/profiles/qemu-guest.nix") + ./atuin.nix ./conduit.nix ./forgejo.nix ./mailserver.nix diff --git a/hosts/glacier/default.nix b/hosts/glacier/default.nix index 2bd6dc8..adeb5d3 100644 --- a/hosts/glacier/default.nix +++ b/hosts/glacier/default.nix @@ -1,5 +1,4 @@ { - attrName, inputs, modulesPath, ... diff --git a/hosts/vessel/backup.nix b/hosts/vessel/backup.nix index 8f30d03..a0e66f8 100644 --- a/hosts/vessel/backup.nix +++ b/hosts/vessel/backup.nix @@ -7,23 +7,33 @@ }: let safePath = "/srv/storage/safe"; in { - systemd.timers.local-backup = { - description = "Local rsync Backup"; - wantedBy = ["timers.target"]; - timerConfig = { - OnCalendar = "*-*-* 00:00:00"; - Persistent = true; - Unit = "local-backup.service"; + systemd = { + timers.local-backup = { + description = "Local rsync Backup"; + wantedBy = ["timers.target"]; + timerConfig = { + OnCalendar = "*-*-* 03:00:00"; + Persistent = true; + Unit = "local-backup.service"; + }; }; - }; - systemd.services.local-backup = { - description = "Local rsync Backup"; - serviceConfig = { - Type = "oneshot"; - ExecStart = "${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete /srv/storage/ /srv/backup/"; - User = "root"; - Group = "root"; + services.local-backup = { + description = "Local rsync Backup"; + serviceConfig = { + Type = "oneshot"; + ExecStart = "${lib.getExe pkgs.rsync} --verbose --verbose --archive --update --delete /srv/storage/ /srv/backup/"; + User = "root"; + Group = "root"; + }; + }; + + tmpfiles.settings = { + "10-storage-safe".${safePath}.d = { + user = "root"; + group = "root"; + mode = "0755"; + }; }; }; @@ -41,14 +51,10 @@ in { paths = [safePath]; passwordFile = config.age.secrets."restic-${attrName}".path; pruneOpts = ["--keep-daily 7" "--keep-weekly 5" "--keep-monthly 12"]; - extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key'"]; - }; - - systemd.tmpfiles.settings = { - "10-storage-safe".${safePath}.d = { - user = "root"; - group = "root"; - mode = "0755"; + timerConfig = { + OnCalendar = "*-*-* 03:00:00"; + Persistent = true; }; + extraOptions = ["sftp.args='-i /etc/ssh/ssh_host_ed25519_key -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"]; }; } diff --git a/scripts/home.sh b/scripts/home.sh deleted file mode 100644 index 0e03343..0000000 --- a/scripts/home.sh +++ /dev/null @@ -1,207 +0,0 @@ -shopt -s nullglob - -opts=$(getopt --options n:e: --longoptions=name:,email: --name "$0" -- "$@") - -eval set -- "$opts" - -name= -email= -while true; do - case "$1" in - -n | --name) - name=$2 - shift 2 - ;; - -e | --email) - email=$2 - shift 2 - ;; - --) - shift - break - ;; - esac -done - -choices=("$@") -shift "$#" - -function chose() { - if [[ ${#choices[@]} == 0 ]]; then - return 0 - fi - local arg - for arg in "$@"; do - local choice - for choice in "${choices[@]}"; do - if [[ "$arg" == "$choice" ]]; then - return 0 - fi - done - done - return 1 -} - -if chose git; then - gitconfig=${XDG_CONFIG_HOME:-$HOME/.config}/git/config - - if [[ -n $name ]]; then - GIT_CONFIG_GLOBAL=$gitconfig git config --global -- user.name "$name" - fi - if [[ -n $email ]]; then - GIT_CONFIG_GLOBAL=$gitconfig git config --global -- user.email "$email" - fi - - gitignore=$(GIT_CONFIG_GLOBAL=$gitconfig git config --global --get core.excludesFile 2>/dev/null || printf '%s\n' "${XDG_CONFIG_HOME:-$HOME/.config}/git/ignore") - mkdir --parents -- "$(dirname -- "$gitignore")" - cat <"$gitignore" -.idea/ -.vscode/ -.iml -*.sublime-workspace - -node_modules/ -vendor/ - -log/ -*.log - -__pycache__/ -zig-cache/ - -*.com -*.class -*.dll -*.exe -*.o -*.so -*.pyc -*.pyo - -*.7z -*.dmg -*.gz -*.iso -*.jar -*.rar -*.tar -*.zip -*.msi - -*.sqlite -*.sqlite3 -*.db -*.db3 -*.s3db -*.sl3 -*.rdb - -*.bak -*.swp -*.swo -*~ -*# - -zig-out/ - -.direnv/ -EOF - GIT_CONFIG_GLOBAL=$gitconfig git config --global -- core.excludesFile "$gitignore" -fi - -if chose mpv; then - if flatpak info io.mpv.Mpv >/dev/null 2>&1; then -mpvconf=$HOME/.var/app/io.mpv.Mpv/config/mpv/mpv.conf -mkdir --parents -- "$(dirname -- "$mpvconf")" -cat <"$mpvconf" -force-window=immediate -keep-open=yes -save-position-on-quit=yes - -screenshot-template="%f_%wH%wM%wS.%wT" - -scale=ewa_lanczossharp -cscale=ewa_lanczossharp -tscale=oversample - -interpolation=yes -video-sync=display-resample -vo=gpu -profile=gpu-hq -EOF - fi -fi - -if chose firefox; then - if flatpak info org.mozilla.firefox >/dev/null 2>&1; then - ffparent=$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox - for profile in "$ffparent"/*.default "$ffparent"/*.default-release; do - userjs=$profile/user.js - cat <"$userjs" -// Forms -user_pref('signon.prefillForms', false); -user_pref('signon.rememberSignons', false); -user_pref('signon.autofillForms', false); -user_pref('signon.formlessCapture.enabled', false); -user_pref('browser.formfill.enable', false); - -// Pocket -user_pref('extensions.pocket.enabled', false); - -// Sponsorships -user_pref('browser.newtabpage.activity-stream.showSponsored', false); -user_pref('browser.newtabpage.activity-stream.showSponsoredTopSites', false); -user_pref('browser.newtabpage.activity-stream.feeds.section.topstories', false); -user_pref('browser.newtabpage.activity-stream.feeds.topsites', false); -user_pref('browser.newtabpage.activity-stream.section.highlights.includeBookmarks', false); -user_pref('browser.newtabpage.activity-stream.section.highlights.includeDownloads', false); -user_pref('browser.newtabpage.activity-stream.section.highlights.includeVisited', false); - -// VA-API (https://bugzilla.mozilla.org/show_bug.cgi?id=1610199) -user_pref('media.ffmpeg.vaapi.enabled', true); - -// Telemetry -user_pref('toolkit.telemetry.unified', false); -user_pref('toolkit.telemetry.enabled', false); -user_pref('toolkit.telemetry.server', 'data:,'); -user_pref('toolkit.telemetry.archive.enabled', false); -user_pref('toolkit.telemetry.newProfilePing.enabled', false); -user_pref('toolkit.telemetry.shutdownPingSender.enabled', false); -user_pref('toolkit.telemetry.updatePing.enabled', false); -user_pref('toolkit.telemetry.bhrPing.enabled', false); -user_pref('toolkit.telemetry.firstShutdownPing.enabled', false); -user_pref('toolkit.telemetry.coverage.opt-out', true); -user_pref('toolkit.coverage.opt-out', true); -user_pref('toolkit.coverage.endpoint.base', ''); -user_pref('browser.ping-centre.telemetry', false); -user_pref('app.shield.optoutstudies.enabled', false); -user_pref('app.normandy.enabled', false); -user_pref('app.normandy.api_url', ''); -user_pref('breakpad.reportURL', ''); -user_pref('browser.tabs.crashReporting.sendReport', false); -user_pref('browser.crashReports.unsubmittedCheck.autoSubmit2', false); - -// Referer -user_pref("network.http.referer.XOriginPolicy", 1); -user_pref("network.http.referer.XOriginTrimmingPolicy", 0); -EOF - done - fi -fi - -if chose bash; then - bashrc=$HOME/.bashrc - ln --force --symbolic -- "$PWD/home/bash/bashrc" "$bashrc" -fi - -if chose fish; then - fishconfig=${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish - mkdir --parents -- "$(dirname -- "$fishconfig")" - ln --force --symbolic -- "$PWD/home/fish/config.fish" "$fishconfig" -fi - -if chose helix; then - helixdir=${XDG_CONFIG_HOME:-$HOME/.config}/helix - rm --recursive --force -- "$helixdir" - ln --force --symbolic -- "$PWD/home/helix" "$helixdir" -fi