diff --git a/.github/workflows/build-iso.yml b/.github/workflows/build-iso.yml index f783050..26cbf4a 100644 --- a/.github/workflows/build-iso.yml +++ b/.github/workflows/build-iso.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v6 + - uses: DeterminateSystems/nix-installer-action@v9 - uses: DeterminateSystems/magic-nix-cache-action@v2 - name: Build Console ISO run: | @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v6 + - uses: DeterminateSystems/nix-installer-action@v9 - uses: DeterminateSystems/magic-nix-cache-action@v2 - name: Build Desktop ISO run: | diff --git a/.github/workflows/deadnix.yml b/.github/workflows/deadnix.yml index 175ff34..7fca03a 100644 --- a/.github/workflows/deadnix.yml +++ b/.github/workflows/deadnix.yml @@ -11,6 +11,6 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - uses: DeterminateSystems/nix-installer-action@v6 + - uses: DeterminateSystems/nix-installer-action@v9 - uses: DeterminateSystems/magic-nix-cache-action@v2 - uses: astro/deadnix-action@v1 diff --git a/.github/workflows/flake-checker.yml b/.github/workflows/flake-checker.yml index 959af29..fab546e 100644 --- a/.github/workflows/flake-checker.yml +++ b/.github/workflows/flake-checker.yml @@ -17,6 +17,6 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: DeterminateSystems/nix-installer-action@v6 + - uses: DeterminateSystems/nix-installer-action@v9 - uses: DeterminateSystems/magic-nix-cache-action@v2 - uses: DeterminateSystems/flake-checker-action@v5 diff --git a/.github/workflows/lock-updater.yml b/.github/workflows/lock-updater.yml index 636ad78..a74e55c 100644 --- a/.github/workflows/lock-updater.yml +++ b/.github/workflows/lock-updater.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: DeterminateSystems/nix-installer-action@v6 + - uses: DeterminateSystems/nix-installer-action@v9 - uses: DeterminateSystems/magic-nix-cache-action@v2 - uses: DeterminateSystems/update-flake-lock@v20 with: diff --git a/.hydra.json b/.hydra.json deleted file mode 100644 index 7d047a4..0000000 --- a/.hydra.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "main": { - "enabled": 1, - "type": 1, - "hidden": false, - "description": "Build main branch", - "flake": "github:gburd/nix-config/main", - "checkinterval": 60, - "schedulingshares": 10, - "enableemail": false, - "emailoverride": "", - "keepnr": 2 - }, - "next": { - "enabled": 1, - "type": 1, - "hidden": false, - "description": "Build next branch", - "flake": "github:gburd/nix-config/next", - "checkinterval": 60, - "schedulingshares": 5, - "enableemail": false, - "emailoverride": "", - "keepnr": 1 - } -} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2997cfd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git-blame.gitWebUrl": "" +} \ No newline at end of file diff --git a/LICENSE b/LICENSE index f322081..5e47d89 100644 --- a/LICENSE +++ b/LICENSE @@ -1,8 +1,23 @@ +MIT License + Copyright (c) 2021 Gabriel Fontes Copyright (c) 2023 Greg Burd +Copyright (c) 2023 Tom Carrio -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/NOTES b/NOTES index 73815c6..cbc81c0 100644 --- a/NOTES +++ b/NOTES @@ -1,3 +1,8 @@ +# Major differences: + * sops/age for secrets + * persistence/impermanence + + * Yubikeys are great, if you use them correctly https://www.procustodibus.com/blog/2023/04/how-to-set-up-a-yubikey/ * generate age public key from host's existing SSH keypair diff --git a/README.md b/README.md index b92ecfc..b044b89 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,12 @@ -[![built with nix](https://img.shields.io/static/v1?logo=nixos&logoColor=white&label=&message=Built%20with%20Nix&color=41439a)](https://builtwithnix.org) - # My NixOS configurations -Here's my NixOS/home-manager config files. Requires [Nix flakes](https://nixos.wiki/wiki/Flakes). - -## Structure - -- `flake.nix`: Entrypoint for hosts and home configurations. Also exposes a - devshell for boostrapping (`nix develop` or `nix-shell`). -- `lib`: A few lib functions for making my flake cleaner -- `hosts`: NixOS Configurations, accessible via `nixos-rebuild --flake`. - - `common`: Shared configurations consumed by the machine-specific ones. - - `global`: Configurations that are globally applied to all my machines. - - `optional`: Opt-in configurations my machines can use. - - `floki`: Lenovo ThinkPad X1 Carbon Extreme Gen 5 -- `home`: My Home-manager configuration, acessible via `home-manager --flake` - - Each directory here is a "feature" each hm configuration can toggle, thus - customizing my setup for each machine (be it a server, desktop, laptop, - anything really). -- `modules`: A few actual modules (with options) I haven't upstreamed yet. -- `overlay`: Patches and version overrides for some packages. Accessible via - `nix build`. -- `pkgs`: My custom packages. Also accessible via `nix build`. You can compose - these into your own configuration by using my flake's overlay, or consume them through NUR. -- `templates`: A couple project templates for different languages. Accessible - via `nix init`. - - -## About the installation - -Home-manager is used in a standalone way, and because of opt-in persistence is -activated on every boot with `loginShellInit`. +Here's my NixOS/home-manager config files. Requires [Nix +flakes](https://nixos.wiki/wiki/Flakes). +This work is really a 90% copy/paste from [Tom +Carrio(https://github.com/tcarrio/nix-config) so you'd be much better off +looking at his work than mine while I'm off studying [Nix +Pills](https://nixos.org/guides/nix-pills/) and trying to keep up. ## How to bootstrap @@ -64,49 +39,12 @@ EDITOR=vi sops --config .sops.yaml nixos/_mixins/secrets.yaml ## Secrets For deployment secrets (such as user passwords and server service secrets), I'm -using the awesome [`sops-nix`](https://github.com/Mic92/sops-nix). All secrets -are encrypted with my personal PGP key (stored on a YubiKey), as well as the -relevant systems's SSH host keys. +using the awesome [`sops-nix`](https://github.com/Mic92/sops-nix). This keeps +all secrets encrypted with my personal PGP key (stored *only* within a YubiKey I +keep in my safe at home), as well as the relevant systems's SSH host keys and +any other sensitive materials. -On my desktop and laptop, I use `pass` for managing passwords, which are -encrypted using (you bet) my PGP key. This same key is also used for mail -signing, as well as for SSH'ing around. - -## Tooling and applications I use - -Most relevant user apps daily drivers: - -- emacs -- fish -- kitty -- qutebrowser -- neomutt + mbsync -- khal + khard + todoman + vdirsyncer -- gpg + pass -- tailscale -- podman -- zathura -- wofi -- bat + fd + rg -- kdeconnect -- sublime-music - -Some of the services I host: - -- hydra -- navidrome -- deluge -- prometheus -- websites (such as https://burd.me ...) -- headscale - -Nixy stuff: - -- nix-colors -- sops-nix -- impermanence -- home-manager -- deploy-rs -- and NixOS and nix itself, of course :) - -Let me know if you have any questions about them :) +On my desktop and laptop, I use `pass` for managing passwords, also encrypted +using (you bet) my PGP key. This same key is also used for mail signing, as well +as for SSH'ing around. You can find my pub key on +[Keybase.io](https://keybase.io/gregburd) or other information on [my site](https://greg.burd.me). diff --git a/android/_mixins/nixos b/android/_mixins/nixos new file mode 120000 index 0000000..5f93a77 --- /dev/null +++ b/android/_mixins/nixos @@ -0,0 +1 @@ +../../nixos/_mixins/ \ No newline at end of file diff --git a/android/_mixins/users/gburd/default.nix b/android/_mixins/users/gburd/default.nix new file mode 100644 index 0000000..5a14ae2 --- /dev/null +++ b/android/_mixins/users/gburd/default.nix @@ -0,0 +1,35 @@ +{ config, desktop, lib, pkgs, ... }: +let + ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; +in +{ + # Only include desktop components if one is supplied. + imports = lib.optional (builtins.isString desktop) ./desktop.nix; + + environment.systemPackages = [ + pkgs.yadm # Terminal dot file manager + ]; + + users.users.gburd = { + description = "Greg Burd"; + extraGroups = [ + "audio" + "input" + "networkmanager" + "users" + "video" + "wheel" + ] + ++ ifExists [ + "docker" + "podman" + ]; + # mkpasswd -m sha-512 + hashedPassword = "$6$1.WkO0Vt/wcBd4uy$X/3Uan97cxd7atvi1XN1.CL8E01eWpWiFp9O4Od6W5kKTx1m22RUv/MXaX3EvISKEdBd4mvVXMSgTVgQzA3Vl/"; + homeMode = "0755"; + isNormalUser = true; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + packages = [ pkgs.home-manager ]; + shell = pkgs.bash; + }; +} diff --git a/android/_mixins/users/gburd/desktop.nix b/android/_mixins/users/gburd/desktop.nix new file mode 100644 index 0000000..d1e0fd8 --- /dev/null +++ b/android/_mixins/users/gburd/desktop.nix @@ -0,0 +1,42 @@ +{ desktop, pkgs, lib, ... }: { + imports = [ + ../../desktop/chromium.nix + ../../desktop/discord.nix + ../../desktop/element.nix + ../../desktop/firefox.nix + #../../desktop/evolution.nix + ../../desktop/google-chrome.nix + ../../desktop/lutris.nix + ../../desktop/obs-studio.nix + ../../desktop/spotify.nix + ../../desktop/tilix.nix + ../../desktop/vscode.nix + ] ++ lib.optional (builtins.pathExists (../.. + "/desktop/${desktop}-apps.nix")) ../../desktop/${desktop}-apps.nix; + + environment.systemPackages = with pkgs; [ + audio-recorder + gimp-with-plugins + gnome.gnome-clocks + gnome.dconf-editor + gnome.gnome-sound-recorder + inkscape + libreoffice + meld + netflix + pick-colour-picker + slack + ]; + + # programs = { + # chromium = { + # extensions = [ + # "kbfnbcaeplbcioakkpcpgfkobkghlhen" # Grammarly + # "cjpalhdlnbpafiamejdnhcphjbkeiagm" # uBlock Origin + # "mdjildafknihdffpkfmmpnpoiajfjnjd" # Consent-O-Matic + # "mnjggcdmjocbbbhaepdhchncahnbgone" # SponsorBlock for YouTube + # "gebbhagfogifgggkldgodflihgfeippi" # Return YouTube Dislike + # "edlifbnjlicfpckhgjhflgkeeibhhcii" # Screenshot Tool + # ]; + # }; + # }; +} diff --git a/android/_mixins/users/nixos/default.nix b/android/_mixins/users/nixos/default.nix new file mode 100644 index 0000000..0e22478 --- /dev/null +++ b/android/_mixins/users/nixos/default.nix @@ -0,0 +1,123 @@ +{ config, desktop, lib, pkgs, username, ... }: +let + ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; + install-system = pkgs.writeScriptBin "install-system" '' + #!${pkgs.stdenv.shell} + + #set -euo pipefail + + TARGET_HOST="''${1:-}" + TARGET_USER="''${2:-gburd}" + TARGET_TYPE="''${3:-}" + + if [ "$(id -u)" -eq 0 ]; then + echo "ERROR! $(basename "$0") should be run as a regular user" + exit 1 + fi + + if [ ! -d "$HOME/ws/nix-config/.git" ]; then + git clone https://github.com/gburd/nix-config.git "$HOME/ws/nix-config" + fi + + pushd "$HOME/ws/nix-config" + + if [[ -z "$TARGET_HOST" ]]; then + echo "ERROR! $(basename "$0") requires a hostname as the first argument" + echo " The following hosts are available" + ls -1 nixos/*/default.nix | cut -d'/' -f2 | grep -v iso + exit 1 + fi + + if [[ -z "$TARGET_USER" ]]; then + echo "ERROR! $(basename "$0") requires a username as the second argument" + echo " The following users are available" + ls -1 nixos/_mixins/users/ | grep -v -E "nixos|root" + exit 1 + fi + + if [[ -z "$TARGET_TYPE" ]]; then + echo "ERROR! $(basename "$0") requires a type as the third argument" + echo " The following types are available" + ls -1 nixos/ | grep -v -E "nixos|root|_mixins" + exit 1 + fi + + TARGET_HOST_ROOT="nixos/$TARGET_TYPE/$TARGET_HOST" + + if [ ! -e "$TARGET_HOST_ROOT/disks.nix" ]; then + echo "ERROR! $(basename "$0") could not find the required $TARGET_HOST_ROOT/disks.nix" + exit 1 + fi + + # Check if the machine we're provisioning expects a keyfile to unlock a disk. + # If it does, generate a new key, and write to a known location. + if grep -q "data.keyfile" "$TARGET_HOST_ROOT/disks.nix"; then + echo -n "$(head -c32 /dev/random | base64)" > /tmp/data.keyfile + fi + + echo "WARNING! The disks in $TARGET_HOST are about to get wiped" + echo " NixOS will be re-installed" + echo " This is a destructive operation" + echo + read -p "Are you sure? [y/N]" -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + sudo true + + sudo nix run github:nix-community/disko \ + --extra-experimental-features "nix-command flakes" \ + --no-write-lock-file \ + -- \ + --mode zap_create_mount \ + "$TARGET_HOST_ROOT/disks.nix" + + sudo nixos-install --no-root-password --flake ".#$TARGET_HOST" + + if [[ "$TARGET_USER" == "root" ]]; then + TARGET_USER_HOME="/mnt/root" + else + TARGET_USER_HOME="/mnt/home/$TARGET_USER" + fi + + # Rsync nix-config to the target install and set the remote origin to SSH. + rsync -a --delete "$HOME/ws/" "$TARGET_USER_HOME/ws/" + pushd "$TARGET_USER_HOME/ws/nix-config" + git remote set-url origin git@github.com:gburd/nix-config.git + popd + + # If there is a keyfile for a data disk, put copy it to the root partition and + # ensure the permissions are set appropriately. + if [[ -f "/tmp/data.keyfile" ]]; then + sudo cp /tmp/data.keyfile /mnt/etc/data.keyfile + sudo chmod 0400 /mnt/etc/data.keyfile + fi + fi + ''; +in +{ + # Only include desktop components if one is supplied. + imports = lib.optional (builtins.isString desktop) ./desktop.nix; + + config.users.users.nixos = { + description = "NixOS"; + extraGroups = [ + "audio" + "networkmanager" + "users" + "video" + "wheel" + ] + ++ ifExists [ + "docker" + "podman" + ]; + homeMode = "0755"; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + packages = [ pkgs.home-manager ]; + shell = pkgs.fish; + }; + + config.system.stateVersion = lib.mkForce lib.trivial.release; + config.environment.systemPackages = [ install-system ]; + config.services.kmscon.autologinUser = "${username}"; +} diff --git a/android/_mixins/users/nixos/desktop.nix b/android/_mixins/users/nixos/desktop.nix new file mode 100644 index 0000000..0d965c0 --- /dev/null +++ b/android/_mixins/users/nixos/desktop.nix @@ -0,0 +1,14 @@ +{ config, desktop, lib, pkgs, username, ... }: { + config.environment.systemPackages = with pkgs; [ + gparted + ]; + config.systemd.tmpfiles.rules = [ + "d /home/${username}/Desktop 0755 ${username} users" + "L+ /home/${username}/Desktop/gparted.desktop - - - - ${pkgs.gparted}/share/applications/gparted.desktop" + "L+ /home/${username}/Desktop/io.elementary.terminal.desktop - - - - ${pkgs.pantheon.elementary-terminal}/share/applications/io.elementary.terminal.desktop" + "L+ /home/${username}/Desktop/io.calamares.calamares.desktop - - - - ${pkgs.calamares-nixos}/share/applications/io.calamares.calamares.desktop" + ]; + config.isoImage.edition = lib.mkForce "${desktop}"; + config.services.xserver.displayManager.autoLogin.user = "${username}"; + config.services.kmscon.autologinUser = lib.mkForce null; +} diff --git a/android/_mixins/users/root/default.nix b/android/_mixins/users/root/default.nix new file mode 100644 index 0000000..f232f7e --- /dev/null +++ b/android/_mixins/users/root/default.nix @@ -0,0 +1,7 @@ +_: +{ + users.users.root = { + hashedPassword = null; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + }; +} diff --git a/android/default.nix b/android/default.nix new file mode 100644 index 0000000..3820b1e --- /dev/null +++ b/android/default.nix @@ -0,0 +1,102 @@ +{ self, pkgs, hostname, username, platform, stateVersion, ... /* outputs, lib, config */ }: { + imports = [ + ./${hostname} + ./_mixins/users/${username} + ]; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + # SYSTEM packages, for all users + direnv + htop + home-manager + ]; + + # fonts = { + # fontDir.enable = true; + # fonts = with pkgs; [ + # font-awesome + # (nerdfonts.override { + # fonts = [ + # "FiraCode" + # ]; + # }) + # ]; + # }; + + + # Auto upgrade nix package and the daemon service. + # services.nix-daemon.enable = true; + nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = false; # default shell on catalina + + programs = { + fish = { + enable = true; + interactiveShellInit = '' + set fish_cursor_default block blink + set fish_cursor_insert line blink + set fish_cursor_replace_one underscore blink + set fish_cursor_visual block + set -U fish_color_autosuggestion brblack + set -U fish_color_cancel -r + set -U fish_color_command green + set -U fish_color_comment brblack + set -U fish_color_cwd brgreen + set -U fish_color_cwd_root brred + set -U fish_color_end brmagenta + set -U fish_color_error red + set -U fish_color_escape brcyan + set -U fish_color_history_current --bold + set -U fish_color_host normal + set -U fish_color_match --background=brblue + set -U fish_color_normal normal + set -U fish_color_operator cyan + set -U fish_color_param blue + set -U fish_color_quote yellow + set -U fish_color_redirection magenta + set -U fish_color_search_match bryellow '--background=brblack' + set -U fish_color_selection white --bold '--background=brblack' + set -U fish_color_status red + set -U fish_color_user brwhite + set -U fish_color_valid_path --underline + set -U fish_pager_color_completion normal + set -U fish_pager_color_description yellow + set -U fish_pager_color_prefix white --bold --underline + set -U fish_pager_color_progress brwhite '--background=cyan' + ''; + shellAliases = { + nix-gc = "sudo nix-collect-garbage --delete-older-than 14d"; + rebuild-all = "sudo nix-collect-garbage --delete-older-than 14d && darwin-rebuild switch --flake $HOME/ws/nix-config && home-manager switch -b backup --flake $HOME/ws/nix-config"; + rebuild-home = "home-manager switch -b backup --flake $HOME/ws/nix-config"; + rebuild-host = "nix-on-droid switch --flake $HOME/ws/nix-config"; + rebuild-lock = "pushd $HOME/ws/nix-config && nix flake lock --recreate-lock-file && popd"; + # TODO: Support secrets management on macOS + # modify-secret = "agenix -i ~/.ssh/id_rsa -e"; # the path relative to /secrets must be passed + + moon = "curl -s wttr.in/Moon"; + nano = "vim"; + pubip = "curl -s ifconfig.me/ip"; + #pubip = "curl -s https://api.ipify.org"; + wttr = "curl -s wttr.in && curl -s v2.wttr.in"; + wttr-bas = "curl -s wttr.in/detroit && curl -s v2.wttr.in/detroit"; + }; + }; + }; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = stateVersion; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = platform; +} diff --git a/android/pixel6a/README.md b/android/pixel6a/README.md new file mode 100644 index 0000000..b5aa69e --- /dev/null +++ b/android/pixel6a/README.md @@ -0,0 +1,12 @@ +> ⚠️ The Android support for Nix-on-Droid in this repository is still experimental + +# android + +Or rather, [nix-on-droid], which assists in managing a Nix terminal environment on Android devices. + +The devices in the tree relate are Android devices with [the Nix-on-Droid app from F-Droid][nix-on-fdroid]. + + + +[nix-on-droid]: https://github.com/nix-community/nix-on-droid +[nix-on-fdroid]: https://f-droid.org/packages/com.termux.nix/ diff --git a/android/pixel6a/default.nix b/android/pixel6a/default.nix new file mode 100644 index 0000000..5e128b8 --- /dev/null +++ b/android/pixel6a/default.nix @@ -0,0 +1,60 @@ +{ pkgs, ... }: + +{ + # Simply install just the packages + environment.packages = with pkgs; [ + # User-facing stuff that you really really want to have + vim # or some other editor, e.g. nano or neovim + + # Some common stuff that people expect to have + curl + diffutils + findutils + utillinux + tzdata + hostname + man + git + gnugrep + gnupg + gnused + gnutar + bzip2 + gzip + openssh + xz + zip + unzip + ]; + + # Backup etc files instead of failing to activate generation if a file already exists in /etc + environment.etcBackupExtension = ".bak"; + + # Read the changelog before changing this value + system.stateVersion = "23.05"; + + # Set up nix for flakes + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + # Set your time zone + time.timeZone = "America/Detroit"; + + # After installing home-manager channel like + # nix-channel --add https://github.com/rycee/home-manager/archive/release-23.11.tar.gz home-manager + # nix-channel --update + # you can configure home-manager in here like + #home-manager = { + # useGlobalPkgs = true; + # + # config = + # { config, lib, pkgs, ... }: + # { + # # Read the changelog before changing this value + # home.stateVersion = "23.11"; + # + # # insert home-manager config + # }; + #}; +} + +# vim: ft=nix diff --git a/darwin/_mixins/console/homebrew.nix b/darwin/_mixins/console/homebrew.nix new file mode 100644 index 0000000..a5f55a2 --- /dev/null +++ b/darwin/_mixins/console/homebrew.nix @@ -0,0 +1,13 @@ +_: { + homebrew = { + enable = true; + + taps = [ ]; + + # the following sets up Homebrew to NEVER update implicitly + # to update brew itself, use `brew upgrade` + # to update brew packages, use `brew update` + global.autoUpdate = false; + onActivation.autoUpdate = false; + }; +} diff --git a/darwin/_mixins/desktop/skhd.nix b/darwin/_mixins/desktop/skhd.nix new file mode 100644 index 0000000..e63ad2e --- /dev/null +++ b/darwin/_mixins/desktop/skhd.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + skhd + ]; +} diff --git a/darwin/_mixins/nixos b/darwin/_mixins/nixos new file mode 120000 index 0000000..5f93a77 --- /dev/null +++ b/darwin/_mixins/nixos @@ -0,0 +1 @@ +../../nixos/_mixins/ \ No newline at end of file diff --git a/darwin/_mixins/users/gburd/default.nix b/darwin/_mixins/users/gburd/default.nix new file mode 100644 index 0000000..4f3e8f8 --- /dev/null +++ b/darwin/_mixins/users/gburd/default.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: { + imports = [ + ../../nixos/console/auth0.nix + ../../nixos/console/direnv.nix + ../../nixos/console/kubectl.nix + ../../nixos/desktop/spotify.nix + ]; + + environment.systemPackages = with pkgs; [ + bazelisk + direnv + dive + fish + fishPlugins.foreign-env + guile + jdk11 + lazydocker + lazygit + mysql + neofetch + neovim + tmux + tokei + tree + ]; +} diff --git a/darwin/default.nix b/darwin/default.nix new file mode 100644 index 0000000..1a4c8e7 --- /dev/null +++ b/darwin/default.nix @@ -0,0 +1,113 @@ +{ self, pkgs, hostname, username, platform, stateVersion, outputs, ... /* lib, config */ }: { + imports = [ + ./${hostname} + ./_mixins/users/${username} + ]; + + # List packages installed in system profile. To search by name, run: + # $ nix-env -qaP | grep wget + environment.systemPackages = with pkgs; [ + # SYSTEM packages, for all users + direnv + glances + home-manager + ]; + + fonts = { + fontDir.enable = true; + fonts = with pkgs; [ + iosevka + font-awesome + (nerdfonts.override { + fonts = [ + "FiraCode" + ]; + }) + ]; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + nix.package = pkgs.nix; + + # Necessary for using flakes on this system. + nix.settings.experimental-features = "nix-command flakes"; + + nixpkgs = { + # You can add overlays here + overlays = [ + # Add overlays your own flake exports (from overlays and pkgs dir): + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + outputs.overlays.trunk-packages + ]; + }; + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = false; # default shell on catalina + + programs = { + fish = { + enable = true; + interactiveShellInit = '' + set fish_cursor_default block blink + set fish_cursor_insert line blink + set fish_cursor_replace_one underscore blink + set fish_cursor_visual block + set -U fish_color_autosuggestion brblack + set -U fish_color_cancel -r + set -U fish_color_command green + set -U fish_color_comment brblack + set -U fish_color_cwd brgreen + set -U fish_color_cwd_root brred + set -U fish_color_end brmagenta + set -U fish_color_error red + set -U fish_color_escape brcyan + set -U fish_color_history_current --bold + set -U fish_color_host normal + set -U fish_color_match --background=brblue + set -U fish_color_normal normal + set -U fish_color_operator cyan + set -U fish_color_param blue + set -U fish_color_quote yellow + set -U fish_color_redirection magenta + set -U fish_color_search_match bryellow '--background=brblack' + set -U fish_color_selection white --bold '--background=brblack' + set -U fish_color_status red + set -U fish_color_user brwhite + set -U fish_color_valid_path --underline + set -U fish_pager_color_completion normal + set -U fish_pager_color_description yellow + set -U fish_pager_color_prefix white --bold --underline + set -U fish_pager_color_progress brwhite '--background=cyan' + ''; + shellAliases = { + nix-gc = "sudo nix-collect-garbage --delete-older-than 14d"; + rebuild-all = "sudo nix-collect-garbage --delete-older-than 14d && darwin-rebuild switch --flake $HOME/ws/nix-config && home-manager switch -b backup --flake $HOME/ws/nix-config"; + rebuild-home = "home-manager switch -b backup --flake $HOME/ws/nix-config"; + rebuild-host = "darwin-rebuild switch --flake $HOME/ws/nix-config"; + rebuild-lock = "pushd $HOME/ws/nix-config && nix flake lock --recreate-lock-file && popd"; + # TODO: Support secrets management on macOS + # modify-secret = "agenix -i ~/.ssh/id_rsa -e"; # the path relative to /secrets must be passed + + moon = "curl -s wttr.in/Moon"; + nano = "vim"; + pubip = "curl -s ifconfig.me/ip"; + #pubip = "curl -s https://api.ipify.org"; + wttr = "curl -s wttr.in && curl -s v2.wttr.in"; + wttr-bas = "curl -s wttr.in/detroit && curl -s v2.wttr.in/detroit"; + }; + }; + }; + + # Set Git commit hash for darwin-version. + system.configurationRevision = self.rev or self.dirtyRev or null; + + # Used for backwards compatibility, please read the changelog before changing. + # $ darwin-rebuild changelog + system.stateVersion = stateVersion; + + # The platform the configuration will be used on. + nixpkgs.hostPlatform = platform; +} diff --git a/darwin/sktc0/brews.nix b/darwin/sktc0/brews.nix new file mode 100644 index 0000000..38b7d26 --- /dev/null +++ b/darwin/sktc0/brews.nix @@ -0,0 +1,135 @@ +_: { + homebrew = { + taps = [ + "auth0/auth0-cli" + "ankitpokhrel/jira-cli" + "codefresh-io/cli" + "oven-sh/bun" + ]; + + brews = [ + "ansible" + "asdf" + "auth0" + "autoconf" + "automake" + "bash" + "bats-core" + "bison" + "bpython" + "brotli" + "bun" + "c-ares" + "ca-certificates" + "circleci" + "cloudflared" + "cmake" + "codefresh" + "conftest" + "coreutils" + "curl" + "dbus" + "deno" + "dive" + "docker-compose" + "editorconfig" + "flarectl" + "freetype" + "fswatch" + "gd" + "gettext" + "ghostscript" + "git-crypt" + "git" + "glib" + "gnu-getopt" + "gnupg" + "gnutls" + "go-task" + "go" + "gotop" + "gpatch" + "graphite2" + "graphviz" + "hadolint" + "htop" + "icu4c" + "imagemagick" + "jira-cli" + "jq" + "k6" + "k9s" + "krb5" + "kubernetes-cli" + "libedit" + "libiconv" + "libjpeg" + "libpng" + "libsodium" + "libtool" + "libxml2" + "libxslt" + "libyaml" + "libzip" + "m4" + "mkcert" + "mysql-client" + "mysql" + "ncdu" + "ninja" + "node" + "openssl@1.1" + "openssl" + "pandoc" + "pango" + "pcre" + "percona-toolkit" + "pkg-config" + "podman" + "portaudio" + "postgresql" + "postgresql@14" + "protobuf" + "protobuf@21" + "pyenv" + "python@3.10" + "python@3.11" + "python@3.12" + "python@3.9" + "pyyaml" + "qemu" + "r" + "re2c" + "readline" + "redis" + "ripgrep" + "rustup-init" + "shellcheck" + "shfmt" + "six" + "sops" + "spotifyd" + "sqlite" + "stern" + "telnet" + "terraform" + "terragrunt" + "unixodbc" + "unzip" + "wget" + "xz" + "yarn" + "zlib" + ]; + + casks = [ + "amethyst" + "docker" + "emacs" + "rstudio" + "secretive" + "sequel-ace" + "talon" + ]; + }; +} diff --git a/darwin/sktc0/default.nix b/darwin/sktc0/default.nix new file mode 100644 index 0000000..cf7e970 --- /dev/null +++ b/darwin/sktc0/default.nix @@ -0,0 +1,29 @@ +# Device: Apple M1 Pro +# CPU: Apple M1 Pro +# RAM: 16GB DDR4 +# SATA: 500GB SSD + +_: { + imports = [ + ../_mixins/console/homebrew.nix + ./brews.nix + ]; + + networking.hostName = "sktc0"; + + system = { + defaults = { + dock = { + autohide = true; + orientation = "bottom"; + tilesize = 80; + }; + finder = { }; + trackpad = { + Clicking = true; + TrackpadRightClick = true; + }; + }; + keyboard = { enableKeyMapping = true; }; + }; +} diff --git a/docs/multi-network-topology.md b/docs/multi-network-topology.md new file mode 100644 index 0000000..d18da80 --- /dev/null +++ b/docs/multi-network-topology.md @@ -0,0 +1,23 @@ +# Multi-Network Topology + +My devices are spread across multiple locations + +- Home +- Office suite +- Cloud? + +I prefer these to be as interoperable as possible + +## Home + +CIDR range: 192.168.40.0/24 + +## Office suite + +CIDR range: 172.16.100.0/24 + +## Cloud + +Additional cloud private networks can be added and included here. + +These will likely fall under 10.x.0.0/8 ranges. \ No newline at end of file diff --git a/examples/dns-rpi.nix b/examples/dns-rpi.nix new file mode 100644 index 0000000..e33e601 --- /dev/null +++ b/examples/dns-rpi.nix @@ -0,0 +1,231 @@ +{ pkgs, ... }: + +{ + + imports = + [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + + # --- NETWORK --- # + networking.hostName = "dns"; # Define your hostname. + networking.useDHCP = false; + services.resolved.enable = false; + + systemd.network.enable = true; + systemd.network = { + netdevs = { + "20-vlan10" = { + netdevConfig = { + Kind = "vlan"; + Name = "vlan10"; + }; + vlanConfig.Id = 10; + }; + "20-vlan20" = { + netdevConfig = { + Kind = "vlan"; + Name = "vlan20"; + }; + vlanConfig.Id = 20; + }; + "20-vlan30" = { + netdevConfig = { + Kind = "vlan"; + Name = "vlan30"; + }; + vlanConfig.Id = 30; + }; + "20-vlan40" = { + netdevConfig = { + Kind = "vlan"; + Name = "vlan40"; + }; + vlanConfig.Id = 40; + }; + }; + networks = { + "30-enu1u1" = { + matchConfig.Name = "enu1u1"; + vlan = [ + "vlan10" + "vlan20" + "vlan30" + "vlan40" + ]; + }; + + # VLANs + "50-vlan10" = { + matchConfig.Name = "vlan10"; + address = [ + "10.50.10.2/24" + ]; + routes = [ + { routeConfig.Gateway = "10.50.10.1"; } + ]; + linkConfig.RequiredForOnline = "routable"; + }; + "50-vlan20" = { + matchConfig.Name = "vlan20"; + address = [ + "10.50.20.2/24" + ]; + routes = [ + { routeConfig.Gateway = "10.50.20.1"; } + ]; + linkConfig.RequiredForOnline = "routable"; + }; + "50-vlan30" = { + matchConfig.Name = "vlan30"; + address = [ + "10.50.30.2/24" + ]; + routes = [ + { routeConfig.Gateway = "10.50.30.1"; } + ]; + linkConfig.RequiredForOnline = "routable"; + }; + "50-vlan40" = { + matchConfig.Name = "vlan40"; + address = [ + "10.50.40.2/24" + ]; + routes = [ + { routeConfig.Gateway = "10.50.40.1"; } + ]; + linkConfig.RequiredForOnline = "routable"; + }; + }; + }; + + # Set your time zone. + time.timeZone = "Europe/London"; + + # Configure console keymap + console = { + font = "Lat2-Terminus16"; + keyMap = "uk"; + }; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.alex = { + isNormalUser = true; + home = "/home/alex"; + extraGroups = [ "wheel" "libvirtd" "docker" ]; # Enable ‘sudo’ for the user. + openssh.authorizedKeys.keys = [ "INSERT SSH KEY HERE" ]; + hashedPassword = "INSERT HASHED PASSWORD HERE"; + }; + + environment.systemPackages = with pkgs; [ + wget + parted + ]; + + + networking.extraHosts = + '' + 10.50.10.2 dns dns.int.example.uk + 10.50.20.2 dns dns.int.example.uk + 10.50.30.2 dns dns.int.example.uk + 10.50.40.2 dns dns.int.example.uk + ''; + + services.dnsmasq = { + enable = true; + settings = { + server = [ + "1.1.1.1" + "8.8.8.8" + ]; + dhcp-authoritative = true; + domain-needed = true; + domain = "int.example.com"; + local = "/int.example.com"; + bogus-priv = true; + rebind-domain-ok = "/plex.direct/"; + + # DHCP OPTIONS (SUCH AS PXE, DNS SERVER, GATEWAY, ETC) + dhcp-option = [ + "enu1u1.10,3,10.50.10.1" + "enu1u1.10,6,10.50.10.2" + "enu1u1.20,3,10.50.20.1" + "enu1u1.20,6,10.50.20.2" + "enu1u1.30,3,10.50.30.1" + "enu1u1.30,6,10.50.30.2" + "enu1u1.40,3,10.50.40.1" + "enu1u1.40,6,10.50.40.2" + ]; + + # DHCP RANGES + dhcp-range = [ + "enu1u1.10,10.50.10.200,10.50.10.254,255.255.255.0,8h" + "enu1u1.20,10.50.20.10,10.50.20.254,255.255.255.0,8h" + "enu1u1.30,10.50.30.10,10.50.30.254,255.255.255.0,8h" + "enu1u1.40,10.50.40.200,10.50.40.254,255.255.255.0,8h" + ]; + + # STATIC HOST MAPPINGS ("MAC_ADDRESS,IP_ADDRESS,HOSTNAME") + dhcp-host = [ + "xx:xx:xx:xx:xx:xx,10.50.10.3,switch" + "xx:xx:xx:xx:xx:xx,10.50.10.4,ap" + "xx:xx:xx:xx:xx:xx,10.50.10.10,bedrock" + "xx:xx:xx:xx:xx:xx,10.50.10.11,hass" + "xx:xx:xx:xx:xx:xx,10.50.10.12,mainsail" + + "xx:xx:xx:xx:xx:xx,10.50.40.10,hass-iot" + "xx:xx:xx:xx:xx:xx,10.50.40.11,glow-ihd" + "xx:xx:xx:xx:xx:xx,10.50.40.12,printer" + "xx:xx:xx:xx:xx:xx,10.50.40.13,cctv-iot" + "xx:xx:xx:xx:xx:xx,10.50.40.14,cctv-front" + "xx:xx:xx:xx:xx:xx,10.50.40.15,cctv-side" + "xx:xx:xx:xx:xx:xx,10.50.40.16,cctv-rear" + "xx:xx:xx:xx:xx:xx,10.50.40.17,doorbell" + "xx:xx:xx:xx:xx:xx,10.50.40.18,cctv-downstairs" + ]; + + # DNS OVERRIDES + address = [ + "/cloud.example.com/10.50.10.10" + "/photos.example.com/10.50.10.10" + "/id.example.com/10.50.10.10" + "/vault.example.com/10.50.10.10" + "/overseerr.example.com/10.50.10.10" + "/media.int.example.com/10.50.10.10" + "/example.com/10.50.10.10" + "/matrix.example.com/10.50.10.10" + "/syncv3.example.com/10.50.10.10" + "/cctv.int.example.com/10.50.10.10" + "/archive.int.example.com/10.50.10.10" + ]; + }; + }; + + # Enable the OpenSSH daemon. + services.openssh.enable = true; + + services.netdata.enable = true; + + # Open ports in the firewall. + #networking.firewall.allowedTCPPorts = [ + # 22 + # 80 + # 443 + # 19999 + #]; + #networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/examples/nextcloud.nix b/examples/nextcloud.nix new file mode 100644 index 0000000..c8b8e55 --- /dev/null +++ b/examples/nextcloud.nix @@ -0,0 +1,66 @@ +# Reference: https://carjorvaz.com/posts/the-holy-grail-nextcloud-setup-made-easy-by-nixos/ + +{ config, pkgs, ... }: + +{ + services = { + nginx.virtualHosts = { + "cloud.example.com" = { + forceSSL = true; + enableACME = true; + }; + + "onlyoffice.example.com" = { + forceSSL = true; + enableACME = true; + }; + }; + + nextcloud = { + enable = true; + hostName = "cloud.example.com"; + + # Need to manually increment with every major upgrade. + package = pkgs.nextcloud27; + + # Let NixOS install and configure the database automatically. + database.createLocally = true; + + # Let NixOS install and configure Redis caching automatically. + configureRedis = true; + + # Increase the maximum file upload size to avoid problems uploading videos. + maxUploadSize = "16G"; + https = true; + enableBrokenCiphersForSSE = false; + + autoUpdateApps.enable = true; + extraAppsEnable = true; + extraApps = with config.services.nextcloud.package.packages.apps; { + # List of apps we want to install and are already packaged in + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/nextcloud/packages/nextcloud-apps.json + inherit calendar contacts mail notes onlyoffice tasks; + + # Custom app installation example. + cookbook = pkgs.fetchNextcloudApp rec { + url = + "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz"; + sha256 = "sha256-XgBwUr26qW6wvqhrnhhhhcN4wkI+eXDHnNSm1HDbP6M="; + }; + }; + + config = { + overwriteProtocol = "https"; + defaultPhoneRegion = "PT"; + dbtype = "pgsql"; + adminuser = "admin"; + adminpassFile = "/path/to/nextcloud-admin-pass"; + }; + }; + + onlyoffice = { + enable = true; + hostname = "onlyoffice.example.com"; + }; + }; +} diff --git a/flake.lock b/flake.lock index 36dc9c6..932499f 100644 --- a/flake.lock +++ b/flake.lock @@ -23,6 +23,173 @@ "type": "github" } }, + "attic": { + "inputs": { + "crane": [ + "chaotic", + "crane" + ], + "flake-compat": [ + "chaotic", + "flake-compat" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1711742460, + "narHash": "sha256-0O4v6e4a1toxXZ2gf5INhg4WPE5C5T+SVvsBt+45Mcc=", + "rev": "4dbdbee45728d8ce5788db6461aaaa89d98081f0", + "revCount": 197, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/zhaofengli/attic/0.1.197%2Brev-4dbdbee45728d8ce5788db6461aaaa89d98081f0/018e8bce-1229-7d78-a052-5121272f0341/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/zhaofengli/attic/0.1.%2A.tar.gz" + } + }, + "chaotic": { + "inputs": { + "attic": "attic", + "compare-to": "compare-to", + "conduit": "conduit", + "crane": "crane", + "fenix": "fenix", + "flake-compat": "flake-compat", + "flake-schemas": "flake-schemas", + "flake-utils": "flake-utils", + "home-manager": "home-manager_2", + "jovian": "jovian", + "jujutsu": "jujutsu", + "niri": "niri", + "nix-filter": "nix-filter", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "yafas": "yafas" + }, + "locked": { + "lastModified": 1716328281, + "narHash": "sha256-txo8aKDOc0pTVA2hNYVYzGl6GP+L3ccsWckfjHKJJ0o=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "3422bb01374e444f6a7ebebf304a48478f1a7fc9", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "compare-to": { + "locked": { + "lastModified": 1695341185, + "narHash": "sha256-htO6DSbWyCgaDkxi7foPjXwJFPzGjVt3RRUbPSpNtZY=", + "rev": "98b8e330823a3570d328720f87a1153f8a7f2224", + "revCount": 2, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/chaotic-cx/nix-empty-flake/0.1.2%2Brev-98b8e330823a3570d328720f87a1153f8a7f2224/018aba35-d228-7fa9-b205-7616c89ef4e0/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/chaotic-cx/nix-empty-flake/%3D0.1.2.tar.gz" + } + }, + "complement": { + "flake": false, + "locked": { + "lastModified": 1715700731, + "narHash": "sha256-cie+b5N/TQAFD8vF/XbqfyFJkFU0qUPDbtJQDm/TfQc=", + "owner": "matrix-org", + "repo": "complement", + "rev": "8587fb3cbe746754b2c883ff6c818ca4d987d0a5", + "type": "github" + }, + "original": { + "owner": "matrix-org", + "ref": "main", + "repo": "complement", + "type": "github" + } + }, + "conduit": { + "inputs": { + "attic": [ + "chaotic", + "attic" + ], + "complement": "complement", + "crane": [ + "chaotic", + "crane" + ], + "fenix": [ + "chaotic", + "fenix" + ], + "flake-compat": [ + "chaotic", + "flake-compat" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nix-filter": [ + "chaotic", + "nix-filter" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rocksdb": "rocksdb" + }, + "locked": { + "lastModified": 1716252956, + "narHash": "sha256-iuTf1JeDQNnPWoH24d9ePBVJ5Pp1cU5Y5tUztXg4dmk=", + "owner": "girlbossceo", + "repo": "conduwuit", + "rev": "9eb0784f6f5afe99bd997d931c67dca42d52e9fa", + "type": "github" + }, + "original": { + "owner": "girlbossceo", + "repo": "conduwuit", + "type": "github" + } + }, + "crane": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1716156051, + "narHash": "sha256-TjUX7WWRcrhuUxDHsR8pDR2N7jitqZehgCVSy3kBeS8=", + "rev": "7443df1c478947bf96a2e699209f53b2db26209d", + "revCount": 571, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/ipetkov/crane/0.17.1/018f92f7-d079-7a6a-8660-4fa94147552e/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/ipetkov/crane/%2A.tar.gz" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -45,6 +212,27 @@ "type": "github" } }, + "devshells": { + "inputs": { + "nixphps": "nixphps", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696826274, + "narHash": "sha256-wSgiH11yRQZf4JfcnIlSekr1jHaE/y1OBXn1diukIY8=", + "owner": "gburd", + "repo": "devshells", + "rev": "9e8da77202d216b2a21de1cba773a1706a8445f5", + "type": "github" + }, + "original": { + "owner": "gburd", + "repo": "devshells", + "type": "github" + } + }, "disko": { "inputs": { "nixpkgs": [ @@ -65,47 +253,275 @@ "type": "github" } }, - "firefox-addons": { - "inputs": { - "flake-utils": "flake-utils", - "nixpkgs": [ - "nixpkgs" - ] - }, + "doom-emacs": { + "flake": false, "locked": { - "dir": "pkgs/firefox-addons", - "lastModified": 1714536206, - "narHash": "sha256-pnE2Px1VlcnWDc92TUmaILRgrWBbetKhpnMu5DfntbM=", - "owner": "rycee", - "repo": "nur-expressions", - "rev": "7772d48f5a728af51cd8ac85be5b124e2da0feac", - "type": "gitlab" + "lastModified": 1662497747, + "narHash": "sha256-4n7E1fqda7cn5/F2jTkOnKw1juG6XMS/FI9gqODL3aU=", + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" }, "original": { - "dir": "pkgs/firefox-addons", - "owner": "rycee", - "repo": "nur-expressions", - "type": "gitlab" + "owner": "doomemacs", + "repo": "doomemacs", + "rev": "3853dff5e11655e858d0bfae64b70cb12ef685ac", + "type": "github" + } + }, + "doom-snippets": { + "flake": false, + "locked": { + "lastModified": 1694887483, + "narHash": "sha256-KlKhruPSLPSKqUnr5/U65arm16VrY9ORzm+XKNZhpTQ=", + "owner": "doomemacs", + "repo": "snippets", + "rev": "f022984ee1318a4015d5d081b3c3dab5a60dc6ff", + "type": "github" + }, + "original": { + "owner": "doomemacs", + "repo": "snippets", + "type": "github" + } + }, + "emacs-overlay": { + "flake": false, + "locked": { + "lastModified": 1676366521, + "narHash": "sha256-i4UAY8t9Au9SJtsgYppa3NHSVf1YkV6yqnNIQd+Km4g=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "c16be6de78ea878aedd0292aa5d4a1ee0a5da501", + "type": "github" + } + }, + "emacs-so-long": { + "flake": false, + "locked": { + "lastModified": 1575031854, + "narHash": "sha256-xIa5zO0ZaToDrec1OFjBK6l39AbA4l/CE4LInVu2hi0=", + "owner": "hlissner", + "repo": "emacs-so-long", + "rev": "ed666b0716f60e8988c455804de24b55919e71ca", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "emacs-so-long", + "type": "github" + } + }, + "evil-escape": { + "flake": false, + "locked": { + "lastModified": 1588439096, + "narHash": "sha256-aB2Ge5o/93B18tPf4fN1c+O46CNh/nOqwLJbox4c8Gw=", + "owner": "hlissner", + "repo": "evil-escape", + "rev": "819f1ee1cf3f69a1ae920e6004f2c0baeebbe077", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-escape", + "type": "github" + } + }, + "evil-markdown": { + "flake": false, + "locked": { + "lastModified": 1626852210, + "narHash": "sha256-HBBuZ1VWIn6kwK5CtGIvHM1+9eiNiKPH0GUsyvpUVN8=", + "owner": "Somelauw", + "repo": "evil-markdown", + "rev": "8e6cc68af83914b2fa9fd3a3b8472573dbcef477", + "type": "github" + }, + "original": { + "owner": "Somelauw", + "repo": "evil-markdown", + "type": "github" + } + }, + "evil-org-mode": { + "flake": false, + "locked": { + "lastModified": 1607203864, + "narHash": "sha256-JxwqVYDN6OIJEH15MVI6XOZAPtUWUhJQWHyzcrUvrFg=", + "owner": "hlissner", + "repo": "evil-org-mode", + "rev": "a9706da260c45b98601bcd72b1d2c0a24a017700", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "evil-org-mode", + "type": "github" + } + }, + "evil-quick-diff": { + "flake": false, + "locked": { + "lastModified": 1575189609, + "narHash": "sha256-oGzl1ayW9rIuq0haoiFS7RZsS8NFMdEA7K1BSozgnJU=", + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "rev": "69c883720b30a892c63bc89f49d4f0e8b8028908", + "type": "github" + }, + "original": { + "owner": "rgrinberg", + "repo": "evil-quick-diff", + "type": "github" + } + }, + "explain-pause-mode": { + "flake": false, + "locked": { + "lastModified": 1595842060, + "narHash": "sha256-++znrjiDSx+cy4okFBBXUBkRFdtnE2x+trkmqjB3Njs=", + "owner": "lastquestion", + "repo": "explain-pause-mode", + "rev": "2356c8c3639cbeeb9751744dbe737267849b4b51", + "type": "github" + }, + "original": { + "owner": "lastquestion", + "repo": "explain-pause-mode", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1714544767, + "narHash": "sha256-kF1bX+YFMedf1g0PAJYwGUkzh22JmULtj8Rm4IXAQKs=", + "rev": "73124e1356bde9411b163d636b39fe4804b7ca45", + "revCount": 1852, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/nix-community/fenix/0.1.1852%2Brev-73124e1356bde9411b163d636b39fe4804b7ca45/018f333a-c195-795f-9e07-b43b47d5391f/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/nix-community/fenix/0.1.%2A.tar.gz" + } + }, + "flake-compat": { + "flake": false, + "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/%2A.tar.gz" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1693491534, + "narHash": "sha256-ifw8Td8kD08J8DxFbYjeIx5naHcDLz7s2IFP3X42I/U=", + "rev": "c702cbb663d6d70bbb716584a2ee3aeb35017279", + "revCount": 21, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.1/018a4c59-80e1-708a-bb4d-854930c20f72/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.1.tar.gz" } }, "flake-utils": { + "inputs": { + "systems": [ + "chaotic", + "systems" + ] + }, "locked": { - "lastModified": 1629284811, - "narHash": "sha256-JHgasjPR0/J1J3DRm4KxM4zTyAj4IOJY8vIl75v/kPI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c5d161cc0af116a2e17f54316f0bf43f0819785c", - "type": "github" + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "revCount": 92, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.92%2Brev-b1d9ab70662946ef0850d488da1c9019f3a9752a/018e2ca5-e5a2-7f80-9261-445a8cecd4d7/source.tar.gz" }, "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "type": "tarball", + "url": "https://flakehub.com/f/numtide/flake-utils/0.1.%2A.tar.gz" } }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_4" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_5" }, "locked": { "lastModified": 1681202837, @@ -121,6 +537,23 @@ "type": "github" } }, + "format-all": { + "flake": false, + "locked": { + "lastModified": 1581716637, + "narHash": "sha256-ul7LCe60W8TIvUmUtZtZRo8489TK9iTPDsLHmzxY57M=", + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + }, + "original": { + "owner": "lassik", + "repo": "emacs-format-all-the-code", + "rev": "47d862d40a088ca089c92cd393c6dca4628f87d3", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -145,9 +578,30 @@ "home-manager_2": { "inputs": { "nixpkgs": [ + "chaotic", "nixpkgs" ] }, + "locked": { + "lastModified": 1715930644, + "narHash": "sha256-W9pyM3/vePxrffHtzlJI6lDS3seANQ+Nqp+i58O46LI=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "e3ad5108f54177e6520535768ddbf1e6af54b59d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_3": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, "locked": { "lastModified": 1714043624, "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", @@ -163,6 +617,28 @@ "type": "github" } }, + "home-manager_4": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs" + ], + "utils": "utils_2" + }, + "locked": { + "lastModified": 1663932797, + "narHash": "sha256-IH8ZBW99W2k7wKLS+Sat9HiKX1TPZjFTnsPizK5crok=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "de3758e31a3a1bc79d569f5deb5dac39791bf9b6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "impermanence": { "locked": { "lastModified": 1708968331, @@ -178,23 +654,167 @@ "type": "github" } }, - "nh": { + "jovian": { "inputs": { + "nix-github-actions": "nix-github-actions", "nixpkgs": [ + "chaotic", "nixpkgs" ] }, "locked": { - "lastModified": 1714557650, - "narHash": "sha256-N1qTL5wIlbbX7DorBaKOMYfz+gYoyf8LREMWVlOXNYc=", - "owner": "viperml", - "repo": "nh", - "rev": "e4eb011975bee4c3f47199cc01d2d986e24851bd", + "lastModified": 1716274466, + "narHash": "sha256-upoklExLKqq6LiZTLkaVK5LcBdl/VIiW7kZ8g2vdqhw=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "3516515f04e8ab8339a5d1eefd8f051b00d7c362", "type": "github" }, "original": { - "owner": "viperml", - "repo": "nh", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "jujutsu": { + "inputs": { + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1716273437, + "narHash": "sha256-XGO3oULrmEvPW8pPqFcMHjgu3C4jrEXgemkHCBUQiH0=", + "owner": "martinvonz", + "repo": "jj", + "rev": "13c8f32ceb3a3e8566a6d2512e65ff2ed191c18c", + "type": "github" + }, + "original": { + "owner": "martinvonz", + "repo": "jj", + "type": "github" + } + }, + "niri": { + "inputs": { + "crane": [ + "chaotic", + "crane" + ], + "fenix": [ + "chaotic", + "fenix" + ], + "flake-utils": [ + "chaotic", + "flake-utils" + ], + "nix-filter": [ + "chaotic", + "nix-filter" + ], + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1716275212, + "narHash": "sha256-cV/VGN5O7Q/S8v1yMBRLUg8c+L1oZNlxvYCSciQYos8=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "14d637f4efb6053c7243930944861f9eaf6127d3", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, + "nix-darwin": { + "inputs": { + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1716329735, + "narHash": "sha256-ap51w+VqG21vuzyQ04WrhI2YbWHd3UGz0e7dc/QQmoA=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "eac4f25028c1975a939c8f8fba95c12f8a25e01c", + "type": "github" + }, + "original": { + "owner": "LnL7", + "repo": "nix-darwin", + "type": "github" + } + }, + "nix-doom-emacs": { + "inputs": { + "doom-emacs": "doom-emacs", + "doom-snippets": "doom-snippets", + "emacs-overlay": "emacs-overlay", + "emacs-so-long": "emacs-so-long", + "evil-escape": "evil-escape", + "evil-markdown": "evil-markdown", + "evil-org-mode": "evil-org-mode", + "evil-quick-diff": "evil-quick-diff", + "explain-pause-mode": "explain-pause-mode", + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils_2", + "format-all": "format-all", + "nix-straight": "nix-straight", + "nixpkgs": [ + "nixpkgs-unstable" + ], + "nose": "nose", + "ob-racket": "ob-racket", + "org": "org", + "org-contrib": "org-contrib", + "org-yt": "org-yt", + "php-extras": "php-extras", + "revealjs": "revealjs", + "rotate-text": "rotate-text", + "sln-mode": "sln-mode", + "ts-fold": "ts-fold", + "ws-butler": "ws-butler" + }, + "locked": { + "lastModified": 1701264882, + "narHash": "sha256-MBXR7x7Ua8qystlGr+lenwjQd7dsFNFpEFmtHhh10zM=", + "owner": "nix-community", + "repo": "nix-doom-emacs", + "rev": "f7413022370f24bb53cb450bfb2803233510113e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-doom-emacs", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", "type": "github" } }, @@ -220,34 +840,225 @@ "type": "github" } }, - "nixos-hardware": { + "nix-formatter-pack_2": { + "inputs": { + "nixpkgs": [ + "nix-on-droid", + "nixpkgs" + ], + "nmd": "nmd_2", + "nmt": "nmt_2" + }, "locked": { - "lastModified": 1714465198, - "narHash": "sha256-ySkEJvS0gPz2UhXm0H3P181T8fUxvDVcoUyGn0Kc5AI=", - "owner": "nixos", - "repo": "nixos-hardware", - "rev": "68d680c1b7c0e67a9b2144d6776583ee83664ef4", + "lastModified": 1666720474, + "narHash": "sha256-iWojjDS1D19zpeZXbBdjWb9MiKmVVFQCqtJmtTXgPx8=", + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "rev": "14876cc8fe94a3d329964ecb073b4c988c7b61f5", "type": "github" }, "original": { - "owner": "nixos", + "owner": "Gerschtli", + "repo": "nix-formatter-pack", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "chaotic", + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690328911, + "narHash": "sha256-fxtExYk+aGf2YbjeWQ8JY9/n9dwuEt+ma1eUFzF8Jeo=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "96df4a39c52f53cb7098b923224d8ce941b64747", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-on-droid": { + "inputs": { + "home-manager": "home-manager_4", + "nix-formatter-pack": "nix-formatter-pack_2", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-for-bootstrap": "nixpkgs-for-bootstrap", + "nmd": "nmd_3" + }, + "locked": { + "lastModified": 1688144254, + "narHash": "sha256-8KL1l/7eP2Zm1aJjdVaSOk0W5kTnJo9kcgW03gqWuiI=", + "owner": "nix-community", + "repo": "nix-on-droid", + "rev": "2301e01d48c90b60751005317de7a84a51a87eb6", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "nix-on-droid", + "type": "github" + } + }, + "nix-straight": { + "flake": false, + "locked": { + "lastModified": 1694361489, + "narHash": "sha256-kjDp+j6OtrmqbtjQB5uuOtjS08+kgJQuxFqhWE1Y9Rw=", + "owner": "nix-community", + "repo": "nix-straight.el", + "rev": "748be99b84be0b130e946288099806a0f16d6e57", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-straight.el", + "type": "github" + } + }, + "nixlib": { + "locked": { + "lastModified": 1693701915, + "narHash": "sha256-waHPLdDYUOHSEtMKKabcKIMhlUOHPOOPQ9UyFeEoovs=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5af57d3ef9947a70ac86e42695231ac1ad00c25", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixos-generators": { + "inputs": { + "nixlib": "nixlib", + "nixpkgs": [ + "nixpkgs-unstable" + ] + }, + "locked": { + "lastModified": 1701140600, + "narHash": "sha256-cAaj5Hf6lgAO+GGPMN+5lf3PlbTLjr/lGq/yqDT9PoU=", + "owner": "tcarrio", + "repo": "nixos-generators", + "rev": "2a728c313f4b765bed326a3e24d8b547722ca311", + "type": "github" + }, + "original": { + "owner": "tcarrio", + "repo": "nixos-generators", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1716173274, + "narHash": "sha256-FC21Bn4m6ctajMjiUof30awPBH/7WjD0M5yqrWepZbY=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "d9e0b26202fd500cf3e79f73653cce7f7d541191", + "type": "github" + }, + "original": { + "owner": "NixOS", "ref": "master", "repo": "nixos-hardware", "type": "github" } }, + "nixphps": { + "inputs": { + "flake-compat": "flake-compat_2", + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1696146809, + "narHash": "sha256-+VjRYETjJn/ibiZtnCTf719dYzTdu0ehOIlu2TfxSJI=", + "owner": "fossar", + "repo": "nix-phps", + "rev": "305a8f56fa39a18db59e9dd3c2e8f1c9e0932feb", + "type": "github" + }, + "original": { + "owner": "fossar", + "repo": "nix-phps", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1715668745, - "narHash": "sha256-xp62OkRkbUDNUc6VSqH02jB0FbOS+MsfMb7wL1RJOfA=", + "lastModified": 1695978539, + "narHash": "sha256-lta5HToBZMWZ2hl5CautNSUgIZViR41QxN7JKbMAjgQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "bd9b686c0168041aea600222be0805a0de6e6ab8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-for-bootstrap": { + "locked": { + "lastModified": 1686921029, + "narHash": "sha256-J1bX9plPCFhTSh6E3TWn9XSxggBh/zDD4xigyaIQBy8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c7ff1b9b95620ce8728c0d7bd501c458e6da9e04", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1711460390, + "narHash": "sha256-akSgjDZL6pVHEfSE6sz1DNSXuYX6hq+P/1Z5IoYWs7E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "44733514b72e732bd49f5511bd0203dea9b9a434", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-trunk": { + "locked": { + "lastModified": 1716339019, + "narHash": "sha256-EgTlLEJcZt2kY2ckDfuADYZ2Q7nFxf2abZVXdOeuDc0=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9ddcaffecdf098822d944d4147dd8da30b4e6843", + "rev": "cc27efa5a601f1f5f85a1d6bc9d014a31a3f591d", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "master", "repo": "nixpkgs", "type": "github" } @@ -268,6 +1079,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1716218643, + "narHash": "sha256-i/E7gzQybvcGAYDRGDl39WL6yVk30Je/NXypBz6/nmM=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a8695cbd09a7ecf3376bd62c798b9864d20f86ee", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, "nmd": { "flake": false, "locked": { @@ -284,6 +1111,38 @@ "type": "gitlab" } }, + "nmd_2": { + "flake": false, + "locked": { + "lastModified": 1666190571, + "narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=", + "owner": "rycee", + "repo": "nmd", + "rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmd", + "type": "gitlab" + } + }, + "nmd_3": { + "flake": false, + "locked": { + "lastModified": 1666190571, + "narHash": "sha256-Z1hc7M9X6L+H83o9vOprijpzhTfOBjd0KmUTnpHAVjA=", + "owner": "rycee", + "repo": "nmd", + "rev": "b75d312b4f33bd3294cd8ae5c2ca8c6da2afc169", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmd", + "type": "gitlab" + } + }, "nmt": { "flake": false, "locked": { @@ -300,22 +1159,248 @@ "type": "gitlab" } }, + "nmt_2": { + "flake": false, + "locked": { + "lastModified": 1648075362, + "narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=", + "owner": "rycee", + "repo": "nmt", + "rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae", + "type": "gitlab" + }, + "original": { + "owner": "rycee", + "repo": "nmt", + "type": "gitlab" + } + }, + "nose": { + "flake": false, + "locked": { + "lastModified": 1400604510, + "narHash": "sha256-daEi8Kta1oGaDEmUUDDQMahTTPOpvNpDKk22rlr7cB0=", + "owner": "emacsattic", + "repo": "nose", + "rev": "f8528297519eba911696c4e68fa88892de9a7b72", + "type": "github" + }, + "original": { + "owner": "emacsattic", + "repo": "nose", + "type": "github" + } + }, + "ob-racket": { + "flake": false, + "locked": { + "lastModified": 1584656173, + "narHash": "sha256-rBUYDDCXb+3D4xTPQo9UocbTPZ32kWV1Uya/1DmZknU=", + "owner": "xchrishawk", + "repo": "ob-racket", + "rev": "83457ec9e1e96a29fd2086ed19432b9d75787673", + "type": "github" + }, + "original": { + "owner": "xchrishawk", + "repo": "ob-racket", + "type": "github" + } + }, + "org": { + "flake": false, + "locked": { + "lastModified": 1695726851, + "narHash": "sha256-qgbjspklSoI8M3cbCJOcUdjuijRgsL/+PSyEOW9VX4I=", + "owner": "emacs-straight", + "repo": "org-mode", + "rev": "aa9177e1a8b039c357d369c1c9aaab710bb247a9", + "type": "github" + }, + "original": { + "owner": "emacs-straight", + "repo": "org-mode", + "type": "github" + } + }, + "org-contrib": { + "flake": false, + "locked": { + "lastModified": 1694946041, + "narHash": "sha256-X/HFG6NZe5BY00KvGbcsIuf9R6Lg8x7Uhd0Y5+Q3qZU=", + "owner": "emacsmirror", + "repo": "org-contrib", + "rev": "5eabbf22bdd4523c922a30787e98ee66c24221aa", + "type": "github" + }, + "original": { + "owner": "emacsmirror", + "repo": "org-contrib", + "type": "github" + } + }, + "org-yt": { + "flake": false, + "locked": { + "lastModified": 1527381913, + "narHash": "sha256-dzQ6B7ryzatHCTLyEnRSbWO0VUiX/FHYnpHTs74aVUs=", + "owner": "TobiasZawada", + "repo": "org-yt", + "rev": "40cc1ac76d741055cbefa13860d9f070a7ade001", + "type": "github" + }, + "original": { + "owner": "TobiasZawada", + "repo": "org-yt", + "type": "github" + } + }, + "php-extras": { + "flake": false, + "locked": { + "lastModified": 1573312690, + "narHash": "sha256-r4WyVbzvT0ra4Z6JywNBOw5RxOEYd6Qe2IpebHXkj1U=", + "owner": "arnested", + "repo": "php-extras", + "rev": "d410c5af663c30c01d461ac476d1cbfbacb49367", + "type": "github" + }, + "original": { + "owner": "arnested", + "repo": "php-extras", + "type": "github" + } + }, + "revealjs": { + "flake": false, + "locked": { + "lastModified": 1695738029, + "narHash": "sha256-Z9c9Q41jMkj/DyXOiZYyIa7Gmn8VB8yauTyWrSsT+ps=", + "owner": "hakimel", + "repo": "reveal.js", + "rev": "88fbfc5751ad01e3f6adee5819eabeb9e73c3757", + "type": "github" + }, + "original": { + "owner": "hakimel", + "repo": "reveal.js", + "type": "github" + } + }, + "rocksdb": { + "flake": false, + "locked": { + "lastModified": 1714770052, + "narHash": "sha256-NCPYF2wYBsB9OHEkZSOYoPlxjC9BBMhJp8EM5M1o3Mc=", + "owner": "girlbossceo", + "repo": "rocksdb", + "rev": "db6df0b185774778457dabfcbd822cb81760cade", + "type": "github" + }, + "original": { + "owner": "girlbossceo", + "ref": "v9.1.1", + "repo": "rocksdb", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", + "chaotic": "chaotic", + "devshells": "devshells", "disko": "disko", - "firefox-addons": "firefox-addons", - "home-manager": "home-manager_2", + "home-manager": "home-manager_3", "impermanence": "impermanence", - "nh": "nh", + "nix-darwin": "nix-darwin", + "nix-doom-emacs": "nix-doom-emacs", "nix-formatter-pack": "nix-formatter-pack", + "nix-on-droid": "nix-on-droid", + "nixos-generators": "nixos-generators", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", + "nixpkgs-trunk": "nixpkgs-trunk", "nixpkgs-unstable": "nixpkgs-unstable", "sops-nix": "sops-nix", "vscode-server": "vscode-server" } }, + "rotate-text": { + "flake": false, + "locked": { + "lastModified": 1322962747, + "narHash": "sha256-SOeOgSlcEIsKhUiYDJv0p+mLUb420s9E2BmvZQvZ0wk=", + "owner": "debug-ito", + "repo": "rotate-text.el", + "rev": "48f193697db996855aee1ad2bc99b38c6646fe76", + "type": "github" + }, + "original": { + "owner": "debug-ito", + "repo": "rotate-text.el", + "type": "github" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1714501997, + "narHash": "sha256-g31zfxwUFzkPgX0Q8sZLcrqGmOxwjEZ/iqJjNx4fEGo=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "49e502b277a8126a9ad10c802d1aaa3ef1a280ef", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "chaotic", + "jujutsu", + "flake-utils" + ], + "nixpkgs": [ + "chaotic", + "jujutsu", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714961776, + "narHash": "sha256-LiIxWRKbm1DZ+7l1a6FMmIO8leQx5yrRLIApCMai1DY=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "f3b20ea4131408ea585bddb1f41f91c4de9499cf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "sln-mode": { + "flake": false, + "locked": { + "lastModified": 1423727528, + "narHash": "sha256-XqkqPyEJuTtFslOz1fpTf/Klbd/zA7IGpzpmum/MGao=", + "owner": "sensorflo", + "repo": "sln-mode", + "rev": "0f91d1b957c7d2a7bab9278ec57b54d57f1dbd9c", + "type": "github" + }, + "original": { + "owner": "sensorflo", + "repo": "sln-mode", + "type": "github" + } + }, "sops-nix": { "inputs": { "nixpkgs": [ @@ -355,6 +1440,21 @@ } }, "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_3": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -369,9 +1469,88 @@ "type": "github" } }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "ts-fold": { + "flake": false, + "locked": { + "lastModified": 1695278494, + "narHash": "sha256-O4NcUC1u08W8ZslqoA/i+iTaLotKwheURXQWBxLLMFc=", + "owner": "jcs-elpa", + "repo": "ts-fold", + "rev": "70b2c79ff4daa7351d4e2917b0343b9a18d4d4f2", + "type": "github" + }, + "original": { + "owner": "jcs-elpa", + "repo": "ts-fold", + "type": "github" + } + }, + "utils": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "vscode-server": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils_3", "nixpkgs": [ "nixpkgs" ] @@ -379,16 +1558,56 @@ "locked": { "lastModified": 1713958148, "narHash": "sha256-8PDNi/dgoI2kyM7uSiU4eoLBqUKoA+3TXuz+VWmuCOc=", - "owner": "nix-community", + "owner": "msteen", "repo": "nixos-vscode-server", "rev": "fc900c16efc6a5ed972fb6be87df018bcf3035bc", "type": "github" }, "original": { - "owner": "nix-community", + "owner": "msteen", "repo": "nixos-vscode-server", "type": "github" } + }, + "ws-butler": { + "flake": false, + "locked": { + "lastModified": 1634511126, + "narHash": "sha256-c0y0ZPtxxICPk+eaNbbQf6t+FRCliNY54CCz9QHQ8ZI=", + "owner": "hlissner", + "repo": "ws-butler", + "rev": "572a10c11b6cb88293de48acbb59a059d36f9ba5", + "type": "github" + }, + "original": { + "owner": "hlissner", + "repo": "ws-butler", + "type": "github" + } + }, + "yafas": { + "inputs": { + "flake-schemas": [ + "chaotic", + "flake-schemas" + ], + "systems": [ + "chaotic", + "systems" + ] + }, + "locked": { + "lastModified": 1695926485, + "narHash": "sha256-wNFFnItckgSs8XeYhhv8vlJs2WF09fSQaWgw4xkDqHQ=", + "rev": "7772afd6686458ca0ddbc599a52cf5d337367653", + "revCount": 4, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/UbiqueLambda/yafas/0.1.4%2Brev-7772afd6686458ca0ddbc599a52cf5d337367653/018add18-ebb4-72c6-93fe-d1d8da361703/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/UbiqueLambda/yafas/0.1.%2A.tar.gz" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ce048cc..2117086 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,11 @@ { description = "Greg Burd's NixOS and Home Manager Configuration"; - inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; # You can access packages and modules from different nixpkgs revs at the - # same time. See 'unstable-packages' overlay in 'overlays/default.nix'. + # same time. See 'unstable-packages' overlay in 'overlays/default.nix'. nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + nixpkgs-trunk.url = "github:nixos/nixpkgs/master"; agenix.url = "github:ryantm/agenix"; agenix.inputs.nixpkgs.follows = "nixpkgs"; @@ -13,73 +13,113 @@ disko.url = "github:nix-community/disko"; disko.inputs.nixpkgs.follows = "nixpkgs"; - #fh.url = "https://flakehub.com/f/DeterminateSystems/fh/*.tar.gz"; - home-manager.url = "github:nix-community/home-manager/release-23.11"; - home-manager.inputs.nixpkgs.follows = "nixpkgs"; + home-manager.inputs.nixpkgs.follows = "nixpkgs-unstable"; - nixos-hardware.url = "github:nixos/nixos-hardware/master"; + # Chaotic's Nyx provides many additional packages like NordVPN + chaotic.url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + chaotic.inputs.nixpkgs.follows = "nixpkgs"; - impermanence.url = "github:nix-community/impermanence"; + nix-doom-emacs.url = "github:nix-community/nix-doom-emacs"; + nix-doom-emacs.inputs.nixpkgs.follows = "nixpkgs-unstable"; nix-formatter-pack.url = "github:Gerschtli/nix-formatter-pack"; nix-formatter-pack.inputs.nixpkgs.follows = "nixpkgs"; - vscode-server.url = "github:nix-community/nixos-vscode-server"; + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + vscode-server.url = "github:msteen/nixos-vscode-server"; vscode-server.inputs.nixpkgs.follows = "nixpkgs"; + devshells.url = "github:gburd/devshells"; + devshells.inputs.nixpkgs.follows = "nixpkgs"; + + # Android support with nix-on-droid. Currently not updated for 23.11 + nix-on-droid.url = "github:nix-community/nix-on-droid/release-23.05"; + nix-on-droid.inputs.nixpkgs.follows = "nixpkgs"; + + # Darwin support with nix-darwin + nix-darwin.url = "github:LnL7/nix-darwin"; + nix-darwin.inputs.nixpkgs.follows = "nixpkgs-unstable"; + + # nixos-generators for sdcard and raw disk install generation + nixos-generators.url = "github:tcarrio/nixos-generators"; + nixos-generators.inputs.nixpkgs.follows = "nixpkgs-unstable"; + sops-nix.url = "github:mic92/sops-nix"; sops-nix.inputs.nixpkgs.follows = "nixpkgs"; sops-nix.inputs.nixpkgs-stable.follows = "nixpkgs"; - nh.url = "github:viperml/nh"; - nh.inputs.nixpkgs.follows = "nixpkgs"; + # TODO... review below here + impermanence.url = "github:nix-community/impermanence"; - firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; - firefox-addons.inputs.nixpkgs.follows = "nixpkgs"; + #nh.url = "github:viperml/nh"; + #nh.inputs.nixpkgs.follows = "nixpkgs"; + #firefox-addons.url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; + #firefox-addons.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self - , nixpkgs , nix-formatter-pack + , nixpkgs , ... } @ inputs: let - inherit (self) outputs; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion stateVersion = "23.11"; - libx = import ./lib { inherit inputs outputs stateVersion; }; + + inherit (self) outputs; + libx = import ./lib { inherit self inputs outputs stateVersion; }; in { # home-manager switch -b backup --flake $HOME/ws/nix-config # nix build .#homeConfigurations."gburd@floki".activationPackage homeConfigurations = { # .iso images - # "gburd@iso-console" = libx.mkHome { hostname = "iso-console"; username = "nixos"; }; - # "gburd@iso-desktop" = libx.mkHome { hostname = "iso-desktop"; username - # = "nixos"; desktop = "pantheon"; }; # Workstations "gburd@floki" = libx.mkHome { hostname = "floki"; username = "gburd"; desktop = "pantheon"; }; - #"gburd@floki" = libx.mkHome { hostname = "floki"; username = "gburd"; desktop = "mate"; }; # Servers }; + # Support for nix-darwin workstations + # - darwin-rebuild build --flake .#sktc0 + # darwinConfigurations = { + # "antanes" = libx.mkDarwin { username = "gburd"; hostname = "antanes"; stateVersion = 4; }; + # }; + + # Expose the package set, including overlays, for convenience. + # darwinPackages = self.darwinConfigurations."antanes".pkgs; + nixosConfigurations = { # .iso images # - nix build .#nixosConfigurations.{iso-console|iso-desktop}.config.system.build.isoImage - # iso-console = libx.mkHost { hostname = "iso-console"; username = "nixos"; installer = nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"; }; - # iso-desktop = libx.mkHost { hostname = "iso-desktop"; username = "nixos"; installer = nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares.nix"; desktop = "pantheon"; }; # Workstations # Lenovo Carbon X1 Extreme Gen 5 - x86_64 - floki = libx.mkHost { hostname = "floki"; username = "gburd"; desktop = "pantheon"; }; + floki = libx.mkHost { systemType = "workstation"; hostname = "floki"; username = "gburd"; desktop = "pantheon"; }; + # Servers + # Can be executed locally: + # - sudo nixos-rebuild switch --flake $HOME/ws/nix-config + # + # Or remotely: + # - nixos-rebuild switch --fast --flake .#${HOST} \ + # --target-host ${USERNAME}@${HOST}.${TAILNET} \ + # --build-host ${USERNAME}@${HOST}.${TAILNET} }; + # nixOnDroidConfigurations = { + # pixel6a-legacy = nix-on-droid.lib.nixOnDroidConfiguration { + # modules = [ ./android/pixel6a/config.nix ]; + # }; + # pixel6a = libx.mkDroid { hostname = "pixel6a"; username = "gburd"; }; + # }; + # Devshell for bootstrapping; acessible via 'nix develop' or 'nix-shell' (legacy) + #inherit (devshells) devShells; devShells = libx.forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in import ./shell.nix { inherit pkgs; } @@ -99,14 +139,31 @@ ); # Custom packages and modifications, exported as overlays - overlays = import ./overlays { inherit inputs outputs; }; - - homeManagerModules = import ./modules/home-manager; + overlays = import ./overlays { inherit inputs; }; # Custom packages; acessible via 'nix build', 'nix shell', etc - packages = libx.forAllSystems (system: - let pkgs = nixpkgs.legacyPackages.${system}; - in import ./pkgs { inherit pkgs; } - ); + packages = libx.forAllSystems + (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + (import ./pkgs { inherit pkgs; }) + // + { + # nuc-init = mkNuc "nixos" "nuc-init"; + # system-image-nuc0 = mkNuc "archon" "nuc0"; + # system-image-nuc1 = mkNuc "archon" "nuc1"; + # system-image-nuc2 = mkNuc "archon" "nuc2"; + # system-image-nuc3 = mkNuc "archon" "nuc3"; + # system-image-nuc4 = mkNuc "archon" "nuc4"; + # system-image-nuc5 = mkNuc "archon" "nuc5"; + # system-image-nuc6 = mkNuc "archon" "nuc6"; + # system-image-nuc7 = mkNuc "archon" "nuc7"; + # system-image-nuc8 = mkNuc "archon" "nuc8"; + # system-image-nuc9 = mkNuc "archon" "nuc9"; + } + ); + + # homeManagerModules = import ./modules/home-manager; }; } diff --git a/home-manager/_mixins/cli/default.nix b/home-manager/_mixins/cli/default.nix index 0739842..0f589cc 100644 --- a/home-manager/_mixins/cli/default.nix +++ b/home-manager/_mixins/cli/default.nix @@ -13,7 +13,6 @@ ./ranger.nix ./screen.nix ./ssh.nix - # ./xpo.nix ]; home.packages = with pkgs; [ @@ -23,7 +22,7 @@ bc # Calculator bottom # System viewer ncdu # TUI disk usage - # eza # Better ls + eza # Better ls ripgrep # Better grep fd # Better find curl # cURL diff --git a/home-manager/_mixins/cli/git.nix b/home-manager/_mixins/cli/git.nix index cc737b4..7b38a74 100644 --- a/home-manager/_mixins/cli/git.nix +++ b/home-manager/_mixins/cli/git.nix @@ -31,47 +31,6 @@ in programs.git = { enable = true; package = pkgs.gitAndTools.gitFull; - aliases = { - aa = "add --all"; - add-nowhitespace = "!git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero -"; - amend = "commit --amend"; - ci = "commit"; - co = "checkout"; - dag = "log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order"; - dc = "diff --cached"; - di = "diff"; - div = "divergence"; - fa = "fetch --all"; - fast-forward = "merge --ff-only"; - ff = "merge --ff-only"; - files = "show --oneline"; - gn = "goodness"; - gnc = "goodness --cached"; - graph = "log --decorate --oneline --graph"; - h = "!git head"; - head = "!git l -1"; - l = "log --graph --abbrev-commit --date=relative"; - la = "!git l --all"; - lastchange = "log -n 1 -p"; - lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"; - lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; - lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; - mend = "commit --amend --no-edit"; - pom = "push origin master"; - pullff = "pull --ff-only"; - pushall = "!git remote | xargs -L1 git push --all"; - r = "!git --no-pager l -20"; - ra = "!git r --all"; - st = "status --short"; - subdate = "submodule update --init --recursive"; - sync = "pull --rebase"; - unadd = "reset --"; - unedit = "checkout --"; - unrm = "checkout --"; - unstage = "reset HEAD"; - unstash = "stash pop"; - update = "merge --ff-only origin/master"; - }; userName = "Greg Burd"; userEmail = "greg@burd.me"; signing = { diff --git a/home-manager/_mixins/cli/signal.nix b/home-manager/_mixins/cli/signal.nix index d6812f4..0571b28 100644 --- a/home-manager/_mixins/cli/signal.nix +++ b/home-manager/_mixins/cli/signal.nix @@ -1,5 +1,5 @@ { desktop, lib, pkgs, ... }: { - imports = [ ] ++ lib.optionals (desktop != null) [ + imports = lib.optionals (desktop != null) [ ../desktop/signal.nix ]; home.packages = [ pkgs.signal-cli ]; diff --git a/home-manager/_mixins/console/asdf.nix b/home-manager/_mixins/console/asdf.nix new file mode 100644 index 0000000..902cec7 --- /dev/null +++ b/home-manager/_mixins/console/asdf.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ + asdf-vm + ]; +} diff --git a/home-manager/_mixins/console/charm-freeze.nix b/home-manager/_mixins/console/charm-freeze.nix new file mode 100644 index 0000000..526e094 --- /dev/null +++ b/home-manager/_mixins/console/charm-freeze.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + home.packages = with pkgs; [ charm-freeze ]; + + home.file.".config/freeze/user.json".text = builtins.readFile ./charm-freeze/config.json; +} diff --git a/home-manager/_mixins/console/charm-freeze/config.json b/home-manager/_mixins/console/charm-freeze/config.json new file mode 100644 index 0000000..f5726f8 --- /dev/null +++ b/home-manager/_mixins/console/charm-freeze/config.json @@ -0,0 +1,17 @@ +{ + "window": true, + "border": { + "radius": 8, + "width": 0, + "color": "#515151" + }, + "shadow": false, + "padding": [20, 20, 20, 20], + "margin": 32, + "font": { + "family": "FiraCode Nerd font", + "size": 12 + }, + "line_height": 1.2, + "theme": "dracula" + } \ No newline at end of file diff --git a/home-manager/_mixins/console/deckmaster.nix b/home-manager/_mixins/console/deckmaster.nix new file mode 100644 index 0000000..c0ee196 --- /dev/null +++ b/home-manager/_mixins/console/deckmaster.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + # Deckmaster and the utilities I bind to the Stream Deck + home.packages = with pkgs; [ + deckmaster + hueadm + unstable.obs-cli + playerctl + ]; +} diff --git a/home-manager/_mixins/console/default.nix b/home-manager/_mixins/console/default.nix index 3088ee8..971feb7 100644 --- a/home-manager/_mixins/console/default.nix +++ b/home-manager/_mixins/console/default.nix @@ -1,16 +1,57 @@ -{ config, lib, pkgs, ... }: { +{ config, pkgs, ... }: { + imports = [ + ./neovim.nix + ./tmux.nix + ]; + home = { file = { "${config.xdg.configHome}/neofetch/config.conf".text = builtins.readFile ./neofetch.conf; }; + # A Modern Unix experience + # https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/ packages = with pkgs; [ - neofetch + asciinema # Terminal recorder + breezy # Terminal bzr client + butler # Terminal Itch.io API client + chafa # Terminal image viewer + dconf2nix # Nix code from Dconf files + diffr # Modern Unix `diff` + difftastic # Modern Unix `diff` + dua # Modern Unix `du` + duf # Modern Unix `df` + du-dust # Modern Unix `du` + entr # Modern Unix `watch` + fd # Modern Unix `find` + ffmpeg-headless # Terminal video encoder + fzf # Command-line fuzzy finder + glow # Terminal Markdown renderer + gping # Modern Unix `ping` + hexyl # Modern Unix `hexedit` + hyperfine # Terminal benchmarking + jpegoptim # Terminal JPEG optimizer + jiq # Modern Unix `jq` + lazygit # Terminal Git client + neofetch # Terminal system info + nixpkgs-review # Nix code review + nurl # Nix URL fetcher + nyancat # Terminal rainbow spewing feline + optipng # Terminal PNG optimizer + page # Modern pager + procs # Modern Unix `ps` + quilt # Terminal patch manager + ripgrep # Modern Unix `grep` + tldr # Modern Unix `man` + tokei # Modern Unix `wc` for code + wget # Terminal downloader + yq-go # Terminal `jq` for YAML ]; + sessionVariables = { - EDITOR = "vi"; - MANPAGER = "sh -c 'col --no-backspaces --spaces | bat --language man'"; - SYSTEMD_EDITOR = "vi"; - VISUAL = "vi"; + EDITOR = "nvim"; + PAGER = "page"; + SYSTEMD_EDITOR = "nvim"; + VISUAL = "nvim"; }; }; @@ -25,7 +66,7 @@ package = pkgs.unstable.atuin; settings = { auto_sync = true; - dialect = "uk"; + dialect = "us"; show_preview = true; style = "compact"; sync_frequency = "1h"; @@ -33,13 +74,6 @@ update_check = false; }; }; - bat = { - enable = true; - extraPackages = with pkgs.bat-extras; [ - batwatch - prettybat - ]; - }; bottom = { enable = true; settings = { @@ -85,20 +119,52 @@ fish = { enable = true; shellAliases = { - #cat = "bat --paging=never --style=plain"; + diff = "diffr"; + glow = "glow --pager"; htop = "btm --basic --tree --hide_table_gap --dot_marker --mem_as_value"; ip = "ip --color --brief"; - #less = "bat --paging=always"; - #more = "bat --paging=always"; top = "btm --basic --tree --hide_table_gap --dot_marker --mem_as_value"; - tree = "exa --tree"; + tree = "eza --tree"; }; + functions = + let + doCurl = type: url: "$(curl -L \"${url}\" 2>/dev/null | ${type}sum | awk '{print $1}')"; + makeSriHasher = type: content: "nix-hash --type ${type} --to-sri ${content}"; + makeSriUrlHasher = url: type: makeSriHasher type (doCurl type url); + makeSriUrlHasherFishFunction = makeSriUrlHasher "$argv[1]"; + in + { + shell = '' + nix develop $HOME/ws/nix-config#$argv[1] || nix develop $HOME/ws/nix-config#( \ + git remote -v \ + | grep '(push)' \ + | awk '{print $2}' \ + | cut -d ':' -f 2 \ + | rev \ + | sed 's/tig.//' \ + | rev \ + ) + ''; + is-number = '' + string match --quiet --regex "^\d+\$" $argv[1] + ''; + deploy-nuc = "is-number $argv[1] && nixos-rebuild --fast --flake $HOME/ws/nix-config#nuc$argv[1] --target-host root@192.168.40.20$argv[1] $argv[2..]"; + + sriMd5Url = makeSriUrlHasherFishFunction "md5"; + sriSha1Url = makeSriUrlHasherFishFunction "sha1"; + sriSha256Url = makeSriUrlHasherFishFunction "sha256"; + sriSha512Url = makeSriUrlHasherFishFunction "sha512"; + }; + plugins = with pkgs.fishPlugins; [ + { name = "foreign-env"; inherit (foreign-env) src; } + { name = "fzf"; inherit (fzf-fish) src; } + ]; }; gh = { enable = true; extensions = with pkgs; [ gh-markdown-preview ]; settings = { - editor = "micro"; + editor = "nvim"; git_protocol = "ssh"; prompt = "enabled"; }; @@ -110,11 +176,88 @@ options = { features = "decorations"; navigate = true; + line-numbers = true; side-by-side = true; + syntax-theme = "GitHub"; }; }; aliases = { - lg = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"; + a = "add"; + aa = "add --all"; + aaa = "!git a $(git rd)"; + add-nowhitespace = "!git diff -U0 -w --no-color | git apply --cached --ignore-whitespace --unidiff-zero -"; + # amend + am = "!git cm --amend --no-edit --date=\"$(date +'%Y %D')\""; + amend = "commit --amend"; + # branch name + bn = "br --show-current"; + br = "branch"; + ci = "commit"; + co = "checkout"; + cob = "co -b"; + d = "diff"; + dag = "log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order"; + dc = "diff --cached"; + di = "diff"; + div = "divergence"; + ds = "d --staged"; + f = "fetch"; + fa = "f --all"; + fast-forward = "merge --ff-only"; + ff = "merge --ff-only"; + files = "show --oneline"; + gn = "goodness"; + gnc = "goodness --cached"; + # generate patch + gp = "!gitgenpatch() { target=$1; git format-patch $target --stdout | sed -n -e '/^diff --git/,$p' | head -n -3; }; gitgenpatch"; + graph = "log --decorate --oneline --graph"; + h = "!git head"; + head = "!git l -1"; + # shows commit history + hist = "log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short"; + l = "log --graph --abbrev-commit --date=relative"; + la = "!git l --all"; + lastchange = "log -n 1 -p"; + lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"; + lol = "log --graph --decorate --pretty=oneline --abbrev-commit"; + lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all"; + mend = "commit --amend --no-edit"; + p = "push"; + # force with lease + pf = "poh --force-with-lease"; + # FORCEEEE + pff = "poh --force"; + # push to origin HEAD + poh = "p origin HEAD"; + pom = "push origin master"; + # push and open pr + ppr = "!git poh; !git pr"; + # open pr + pr = "!gh pr create"; + pullff = "pull --ff-only"; + pushall = "!git remote | xargs -L1 git push --all"; + r = "!git --no-pager l -20"; + ra = "!git r --all"; + rb = "rebase"; + rbc = "rebase --continue"; + # gets root directory + rd = "rev-parse --show-toplevel"; + rh = "rs --hard"; + rho = "!git rh origin/$(git bn)"; + rs = "reset"; + # squash it + sq = "!gitsq() { git rb -i $(git sr $1) $2; }; gitsq"; + # gets latest shared commit + sr = "merge-base HEAD"; + st = "status --short"; + subdate = "submodule update --init --recursive"; + sync = "pull --rebase"; + unadd = "reset --"; + unedit = "checkout --"; + unrm = "checkout --"; + unstage = "reset HEAD"; + unstash = "stash pop"; + update = "merge --ff-only origin/master"; }; extraConfig = { push = { @@ -122,6 +265,7 @@ }; pull = { rebase = true; + ff = "only"; }; init = { defaultBranch = "main"; @@ -159,27 +303,10 @@ max-width = 60; }; }; - }; - - services = { - gpg-agent = { + zoxide = { enable = true; - enableSshSupport = true; - pinentryFlavor = "curses"; - }; - }; - - # Nicely reload system units when changing configs - systemd.user.startServices = "sd-switch"; - - xdg = { - enable = true; - userDirs = { - enable = true; - createDirectories = lib.mkDefault true; - extraConfig = { - XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Pictures/Screenshots"; - }; + enableBashIntegration = true; + enableFishIntegration = true; }; }; } diff --git a/home-manager/_mixins/console/neofetch.conf b/home-manager/_mixins/console/neofetch.conf index 02c5e78..14b506c 100644 --- a/home-manager/_mixins/console/neofetch.conf +++ b/home-manager/_mixins/console/neofetch.conf @@ -24,7 +24,7 @@ print_info() { info "${cl4} ├─ ${cl0}" disk # info "${cl4} ├─ ${cl0} " battery info "${cl4} ├─" gpu -# info "${cl4} ├─" gpu_driver + info "${cl4} ├─" gpu_driver info "${cl4} ╰─" resolution prin " " diff --git a/home-manager/_mixins/console/neovim.nix b/home-manager/_mixins/console/neovim.nix new file mode 100644 index 0000000..69a763e --- /dev/null +++ b/home-manager/_mixins/console/neovim.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + home.file.".config/nvim/init.lua".text = builtins.readFile ./neovim/init.lua; + + home.packages = with pkgs; [ + gcc + nnn + zig + ]; +} diff --git a/home-manager/_mixins/users/gburd/init.nvim b/home-manager/_mixins/console/neovim/init.lua similarity index 100% rename from home-manager/_mixins/users/gburd/init.nvim rename to home-manager/_mixins/console/neovim/init.lua diff --git a/home-manager/_mixins/console/systems/darwin.nix b/home-manager/_mixins/console/systems/darwin.nix new file mode 100644 index 0000000..958608a --- /dev/null +++ b/home-manager/_mixins/console/systems/darwin.nix @@ -0,0 +1 @@ +_: { } diff --git a/home-manager/_mixins/console/systems/linux.nix b/home-manager/_mixins/console/systems/linux.nix new file mode 100644 index 0000000..81c6f75 --- /dev/null +++ b/home-manager/_mixins/console/systems/linux.nix @@ -0,0 +1,28 @@ +{ lib, config, pkgs, ... }: { + home.packages = with pkgs; [ + debootstrap # Terminal Debian installer + lurk # Modern Unix `strace` + ]; + + services = { + gpg-agent = { + enable = true; + enableSshSupport = true; + pinentryFlavor = "curses"; + }; + }; + + # Nicely reload system units when changing configs + systemd.user.startServices = "sd-switch"; + + xdg = { + enable = true; + userDirs = { + enable = true; + createDirectories = lib.mkDefault true; + extraConfig = { + XDG_SCREENSHOTS_DIR = "${config.home.homeDirectory}/Pictures/Screenshots"; + }; + }; + }; +} diff --git a/home-manager/_mixins/console/tmux.nix b/home-manager/_mixins/console/tmux.nix new file mode 100644 index 0000000..3fd17a8 --- /dev/null +++ b/home-manager/_mixins/console/tmux.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: +let + theme = { + colors = { + black = "#282c34"; + blue = "#61afef"; + yellow = "#e5c07b"; + red = "#06c75"; + white = "#aab2bf"; + green = "#98c379"; + visual_grey = "#3e4452"; + comment_grey = "#5c6370"; + }; + }; + themeFile = pkgs.templateFile "onedark-theme.tmux" ./tmux/theme.tmux.tpl theme; + tmuxConfig = pkgs.templateFile "tmux.conf" ./tmux/tmux.conf.tpl { theme.path = "${themeFile}"; }; +in +{ + home.file.".tmux.conf".source = "${tmuxConfig}"; +} diff --git a/home-manager/_mixins/console/tmux/theme.tmux.tpl b/home-manager/_mixins/console/tmux/theme.tmux.tpl new file mode 100644 index 0000000..0560e12 --- /dev/null +++ b/home-manager/_mixins/console/tmux/theme.tmux.tpl @@ -0,0 +1,88 @@ +#!/bin/bash +color__black="{{colors.black}}" +color__blue="{{colors.blue}}" +color__yellow="{{colors.yellow}}" +color__red="{{colors.red}}" +color__white="{{colors.white}}" +color__green="{{colors.green}}" +color__visual_grey="{{colors.visual_grey}}" +color__comment_grey="{{colors.comment_grey}}" + +get() { + local option=$1 + local default_value=$2 + local option_value="$(tmux show-option -gqv "$option")" + + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +set() { + local option=$1 + local value=$2 + tmux set-option -gq "$option" "$value" +} + +setw() { + local option=$1 + local value=$2 + tmux set-window-option -gq "$option" "$value" +} + +set "status" "on" +set "status-justify" "left" + +set "status-left-length" "100" +set "status-right-length" "100" +set "status-right-attr" "none" + +set "message-fg" "$color__white" +set "message-bg" "$color__black" + +set "message-command-fg" "$color__white" +set "message-command-bg" "$color__black" + +set "status-attr" "none" +set "status-left-attr" "none" + +setw "window-status-fg" "$color__black" +setw "window-status-bg" "$color__black" +setw "window-status-attr" "none" + +setw "window-status-activity-bg" "$color__black" +setw "window-status-activity-fg" "$color__black" +setw "window-status-activity-attr" "none" + +setw "window-status-separator" "" + +set "window-style" "fg=$color__comment_grey" +set "window-active-style" "fg=$color__white" + +set "pane-border-fg" "$color__white" +set "pane-border-bg" "$color__black" +set "pane-active-border-fg" "$color__green" +set "pane-active-border-bg" "$color__black" + +set "display-panes-active-colour" "$color__yellow" +set "display-panes-colour" "$color__blue" + +set "status-bg" "$color__black" +set "status-fg" "$color__white" + +set "@prefix_highlight_fg" "$color__black" +set "@prefix_highlight_bg" "$color__green" +set "@prefix_highlight_copy_mode_attr" "fg=$color__black,bg=$color__green" +set "@prefix_highlight_output_prefix" "  " + +status_widgets=$(get "@color__widgets") +time_format=$(get "@color__time_format" "%R") +date_format=$(get "@color__date_format" "%d/%m/%Y") + +set "status-right" "#[fg=$color__white,bg=$color__black,nounderscore,noitalics]${time_format}  ${date_format} #[fg=$color__visual_grey,bg=$color__black]#[fg=$color__visual_grey,bg=$color__visual_grey]#[fg=$color__white, bg=$color__visual_grey]${status_widgets} #[fg=$color__green,bg=$color__visual_grey,nobold,nounderscore,noitalics]#[fg=$color__black,bg=$color__green,bold] #h #[fg=$color__yellow, bg=$color__green]#[fg=$color__red,bg=$color__yellow]" +set "status-left" "#[fg=$color__black,bg=$color__green,bold] #S #{prefix_highlight}#[fg=$color__green,bg=$color__black,nobold,nounderscore,noitalics]" + +set "window-status-format" "#[fg=$color__black,bg=$color__black,nobold,nounderscore,noitalics]#[fg=$color__white,bg=$color__black] #I  #W #[fg=$color__black,bg=$color__black,nobold,nounderscore,noitalics]" +set "window-status-current-format" "#[fg=$color__black,bg=$color__visual_grey,nobold,nounderscore,noitalics]#[fg=$color__white,bg=$color__visual_grey,nobold] #I  #W #[fg=$color__visual_grey,bg=$color__black,nobold,nounderscore,noitalics]" diff --git a/home-manager/_mixins/console/tmux/tmux-onedark-theme.tmux b/home-manager/_mixins/console/tmux/tmux-onedark-theme.tmux new file mode 100644 index 0000000..e440cc7 --- /dev/null +++ b/home-manager/_mixins/console/tmux/tmux-onedark-theme.tmux @@ -0,0 +1,88 @@ +#!/bin/bash +onedark_black="#282c34" +onedark_blue="#61afef" +onedark_yellow="#e5c07b" +onedark_red="#e06c75" +onedark_white="#aab2bf" +onedark_green="#98c379" +onedark_visual_grey="#3e4452" +onedark_comment_grey="#5c6370" + +get() { + local option=$1 + local default_value=$2 + local option_value="$(tmux show-option -gqv "$option")" + + if [ -z "$option_value" ]; then + echo "$default_value" + else + echo "$option_value" + fi +} + +set() { + local option=$1 + local value=$2 + tmux set-option -gq "$option" "$value" +} + +setw() { + local option=$1 + local value=$2 + tmux set-window-option -gq "$option" "$value" +} + +set "status" "on" +set "status-justify" "left" + +set "status-left-length" "100" +set "status-right-length" "100" +set "status-right-attr" "none" + +set "message-fg" "$onedark_white" +set "message-bg" "$onedark_black" + +set "message-command-fg" "$onedark_white" +set "message-command-bg" "$onedark_black" + +set "status-attr" "none" +set "status-left-attr" "none" + +setw "window-status-fg" "$onedark_black" +setw "window-status-bg" "$onedark_black" +setw "window-status-attr" "none" + +setw "window-status-activity-bg" "$onedark_black" +setw "window-status-activity-fg" "$onedark_black" +setw "window-status-activity-attr" "none" + +setw "window-status-separator" "" + +set "window-style" "fg=$onedark_comment_grey" +set "window-active-style" "fg=$onedark_white" + +set "pane-border-fg" "$onedark_white" +set "pane-border-bg" "$onedark_black" +set "pane-active-border-fg" "$onedark_green" +set "pane-active-border-bg" "$onedark_black" + +set "display-panes-active-colour" "$onedark_yellow" +set "display-panes-colour" "$onedark_blue" + +set "status-bg" "$onedark_black" +set "status-fg" "$onedark_white" + +set "@prefix_highlight_fg" "$onedark_black" +set "@prefix_highlight_bg" "$onedark_green" +set "@prefix_highlight_copy_mode_attr" "fg=$onedark_black,bg=$onedark_green" +set "@prefix_highlight_output_prefix" "  " + +status_widgets=$(get "@onedark_widgets") +time_format=$(get "@onedark_time_format" "%R") +date_format=$(get "@onedark_date_format" "%d/%m/%Y") + +set "status-right" "#[fg=$onedark_white,bg=$onedark_black,nounderscore,noitalics]${time_format}  ${date_format} #[fg=$onedark_visual_grey,bg=$onedark_black]#[fg=$onedark_visual_grey,bg=$onedark_visual_grey]#[fg=$onedark_white, bg=$onedark_visual_grey]${status_widgets} #[fg=$onedark_green,bg=$onedark_visual_grey,nobold,nounderscore,noitalics]#[fg=$onedark_black,bg=$onedark_green,bold] #h #[fg=$onedark_yellow, bg=$onedark_green]#[fg=$onedark_red,bg=$onedark_yellow]" +set "status-left" "#[fg=$onedark_black,bg=$onedark_green,bold] #S #{prefix_highlight}#[fg=$onedark_green,bg=$onedark_black,nobold,nounderscore,noitalics]" + +set "window-status-format" "#[fg=$onedark_black,bg=$onedark_black,nobold,nounderscore,noitalics]#[fg=$onedark_white,bg=$onedark_black] #I  #W #[fg=$onedark_black,bg=$onedark_black,nobold,nounderscore,noitalics]" +set "window-status-current-format" "#[fg=$onedark_black,bg=$onedark_visual_grey,nobold,nounderscore,noitalics]#[fg=$onedark_white,bg=$onedark_visual_grey,nobold] #I  #W #[fg=$onedark_visual_grey,bg=$onedark_black,nobold,nounderscore,noitalics]" diff --git a/home-manager/_mixins/console/tmux/tmux.conf.tpl b/home-manager/_mixins/console/tmux/tmux.conf.tpl new file mode 100644 index 0000000..213d55a --- /dev/null +++ b/home-manager/_mixins/console/tmux/tmux.conf.tpl @@ -0,0 +1 @@ +run-shell "/bin/bash -c {{theme.path}}" \ No newline at end of file diff --git a/home-manager/_mixins/desktop/audio-recorder.nix b/home-manager/_mixins/desktop/audio-recorder.nix index f6d2ed5..e7ddc2d 100644 --- a/home-manager/_mixins/desktop/audio-recorder.nix +++ b/home-manager/_mixins/desktop/audio-recorder.nix @@ -1,10 +1,6 @@ -{ config, lib, pkgs, username, ... }: +{ lib, config, username, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - audio-recorder - ]; - dconf.settings = { "apps/audio-recorder" = { append-to-file = false; @@ -20,8 +16,4 @@ with lib.hm.gvariant; timer-text = ""; }; }; - - systemd.user.tmpfiles.rules = [ - "d ${config.home.homeDirectory}/Audio 0755 ${username} users - -" - ]; } diff --git a/home-manager/_mixins/desktop/celluloid.nix b/home-manager/_mixins/desktop/celluloid.nix index 2b0b971..fe5672e 100644 --- a/home-manager/_mixins/desktop/celluloid.nix +++ b/home-manager/_mixins/desktop/celluloid.nix @@ -1,10 +1,6 @@ -{ lib, pkgs, ... }: +{ lib, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - celluloid - ]; - dconf.settings = { "io/github/celluloid-player/celluloid" = { csd-enable = false; diff --git a/home-manager/_mixins/desktop/dconf-editor.nix b/home-manager/_mixins/desktop/dconf-editor.nix index 55b194b..1e18794 100644 --- a/home-manager/_mixins/desktop/dconf-editor.nix +++ b/home-manager/_mixins/desktop/dconf-editor.nix @@ -1,10 +1,6 @@ -{ lib, pkgs, ... }: +{ lib, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - gnome.dconf-editor - ]; - dconf.settings = { "ca/desrt/dconf-editor" = { show-warning = false; diff --git a/home-manager/_mixins/desktop/deckmaster-xl.nix b/home-manager/_mixins/desktop/deckmaster-xl.nix index eddc9e3..1faf0bf 100644 --- a/home-manager/_mixins/desktop/deckmaster-xl.nix +++ b/home-manager/_mixins/desktop/deckmaster-xl.nix @@ -1,27 +1,20 @@ -{ config, pkgs, ... }: +{ config, username, ... }: { # https://github.com/muesli/deckmaster - home = { - file = { - "${config.xdg.configHome}/autostart/deskmaster-xl.desktop".text = " - [Desktop Entry] - Name=Deckmaster XL - Comment=Deckmaster XL - Type=Application - Exec=deckmaster -deck ${config.home.homeDirectory}/Studio/StreamDeck/Deckmaster-xl/main.deck - Categories= - Terminal=false - NoDisplay=true - StartupNotify=false"; - }; - # Deckmaster and the utilities I bind to the Stream Deck - packages = with pkgs; [ - bc - deckmaster - hueadm - libnotify - unstable.obs-cli - playerctl - ]; + imports = [ + ../console/decktrunk.nix + ]; + + home.file = { + "${config.xdg.configHome}/autostart/deskmaster-xl.desktop".text = " + [Desktop Entry] + Name=Deckmaster XL + Comment=Deckmaster XL + Type=Application + Exec=deckmaster -deck /home/${username}/Studio/StreamDeck/Deckmaster-xl/main.deck + Categories= + Terminal=false + NoDisplay=true + StartupNotify=false"; }; } diff --git a/home-manager/_mixins/desktop/default.nix b/home-manager/_mixins/desktop/default.nix index 3a77c18..9d0842f 100644 --- a/home-manager/_mixins/desktop/default.nix +++ b/home-manager/_mixins/desktop/default.nix @@ -1,10 +1,10 @@ -{ desktop, lib, username, ... }: { +{ desktop, ... }: { imports = [ + ./neovide.nix + ./emote.nix + ./tilix.nix (./. + "/${desktop}.nix") - ] ++ lib.optional (builtins.pathExists (./. + "/../users/${username}/desktop.nix")) ../users/${username}/desktop.nix; - - # https://nixos.wiki/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio - services.mpris-proxy.enable = true; + ]; xresources.properties = { "XTerm*background" = "#121214"; diff --git a/home-manager/_mixins/desktop/doom-emacs.nix b/home-manager/_mixins/desktop/doom-emacs.nix new file mode 100644 index 0000000..c1db1ec --- /dev/null +++ b/home-manager/_mixins/desktop/doom-emacs.nix @@ -0,0 +1,11 @@ +{ inputs, ... }: { + imports = [ + inputs.nix-doom-emacs.hmModule + ]; + + programs.doom-emacs = { + enable = true; + doomPrivateDir = ./doom.d; # Directory containing your config.el, init.el + # and packages.el files + }; +} diff --git a/home-manager/_mixins/desktop/doom.d/config.el b/home-manager/_mixins/desktop/doom.d/config.el new file mode 100644 index 0000000..69edd52 --- /dev/null +++ b/home-manager/_mixins/desktop/doom.d/config.el @@ -0,0 +1,54 @@ +;;; $DOOMDIR/config.el -*- lexical-binding: t; -*- + +;; Place your private configuration here! Remember, you do not need to run 'doom +;; sync' after modifying this file! + + +;; Some functionality uses this to identify you, e.g. GPG configuration, email +;; clients, file templates and snippets. +(setq user-full-name "Greg Burd" + user-mail-address "greg@burd.me") + +;; Doom exposes five (optional) variables for controlling fonts in Doom. Here +;; are the three important ones: +;; +;; + `doom-font' +;; + `doom-variable-pitch-font' +;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for +;; presentations or streaming. +;; +;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd +;; font string. You generally only need these two: +;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light) +;; doom-variable-pitch-font (font-spec :family "sans" :size 13)) + +;; There are two ways to load a theme. Both assume the theme is installed and +;; available. You can either set `doom-theme' or manually load a theme with the +;; `load-theme' function. This is the default: +(setq doom-theme 'doom-one) + +;; If you use `org' and don't want your org files in the default location below, +;; change `org-directory'. It must be set before org loads! +(setq org-directory "~/org/") + +;; This determines the style of line numbers in effect. If set to `nil', line +;; numbers are disabled. For relative line numbers, set this to `relative'. +(setq display-line-numbers-type t) + + +;; Here are some additional functions/macros that could help you configure Doom: +;; +;; - `load!' for loading external *.el files relative to this one +;; - `use-package!' for configuring packages +;; - `after!' for running code after a package has loaded +;; - `add-load-path!' for adding directories to the `load-path', relative to +;; this file. Emacs searches the `load-path' when you load packages with +;; `require' or `use-package'. +;; - `map!' for binding new keys +;; +;; To get information about any of these functions/macros, move the cursor over +;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k'). +;; This will open documentation for it, including demos of how they are used. +;; +;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how +;; they are implemented. diff --git a/home-manager/_mixins/desktop/doom.d/init.el b/home-manager/_mixins/desktop/doom.d/init.el new file mode 100644 index 0000000..999d950 --- /dev/null +++ b/home-manager/_mixins/desktop/doom.d/init.el @@ -0,0 +1,191 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a "Module Index" link where you'll find +;; a comprehensive list of Doom's modules and what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;chinese + ;;japanese ; どうも! + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + ;;ivy ; a search engine for love and life + vertico ; the search engine of the future + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs + (emoji +unicode) ; 🙂 + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ligatures ; ligatures and symbols to make your code pretty again + minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + ;;tabs ; a tab bar for Emacs + ;;treemacs ; a project drawer, like neotree but cooler + unicode ; extended unicode support for various languages + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + ;;window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + (format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + ;;word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;ibuffer ; interactive buffer management + undo ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + ;;eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;biblio ; Writes a PhD for you (citation needed) + ;;debugger ; FIXME stepping through code, to help you add bugs + ;;direnv + docker + editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + lsp ; M-x vscode + magit ; a git porcelain for Emacs + make ; run make tasks from Emacs + ;;pass ; password manager for nerds + ;;pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + ;;rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + terraform ; infrastructure as code + ;;tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + ;;cc ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + ;;data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;dhall + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fortran ; in FORTRAN, GOD is REAL (unless declared INTEGER) + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + (go +lsp) ; the hipster dialect + ;;(haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + json ; At least it ain't XML + ;;(java +lsp) ; the poster child for carpal tunnel syndrome + javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + org ; organize your plain life in plain text + php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + sh ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +org +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens)) diff --git a/home-manager/_mixins/desktop/doom.d/packages.el b/home-manager/_mixins/desktop/doom.d/packages.el new file mode 100644 index 0000000..b80e9cc --- /dev/null +++ b/home-manager/_mixins/desktop/doom.d/packages.el @@ -0,0 +1,50 @@ +;; -*- no-byte-compile: t; -*- +;;; $DOOMDIR/packages.el + +;; To install a package with Doom you must declare them here and run 'doom sync' +;; on the command line, then restart Emacs for the changes to take effect -- or +;; use 'M-x doom/reload'. + + +;; To install SOME-PACKAGE from MELPA, ELPA or emacsmirror: +;(package! some-package) + +;; To install a package directly from a remote git repo, you must specify a +;; `:recipe'. You'll find documentation on what `:recipe' accepts here: +;; https://github.com/raxod502/straight.el#the-recipe-format +;(package! another-package +; :recipe (:host github :repo "username/repo")) + +;; If the package you are trying to install does not contain a PACKAGENAME.el +;; file, or is located in a subdirectory of the repo, you'll need to specify +;; `:files' in the `:recipe': +;(package! this-package +; :recipe (:host github :repo "username/repo" +; :files ("some-file.el" "src/lisp/*.el"))) + +;; If you'd like to disable a package included with Doom, you can do so here +;; with the `:disable' property: +;(package! builtin-package :disable t) + +;; You can override the recipe of a built in package without having to specify +;; all the properties for `:recipe'. These will inherit the rest of its recipe +;; from Doom or MELPA/ELPA/Emacsmirror: +;(package! builtin-package :recipe (:nonrecursive t)) +;(package! builtin-package-2 :recipe (:repo "myfork/package")) + +;; Specify a `:branch' to install a package from a particular branch or tag. +;; This is required for some packages whose default branch isn't 'master' (which +;; our package manager can't deal with; see raxod502/straight.el#279) +;(package! builtin-package :recipe (:branch "develop")) + +;; Use `:pin' to specify a particular commit to install. +;(package! builtin-package :pin "1a2b3c4d5e") + + +;; Doom's packages are pinned to a specific commit and updated from release to +;; release. The `unpin!' macro allows you to unpin single packages... +;(unpin! pinned-package) +;; ...or multiple packages +;(unpin! pinned-package another-pinned-package) +;; ...Or *all* packages (NOT RECOMMENDED; will likely break things) +;(unpin! t) diff --git a/home-manager/_mixins/desktop/emote.nix b/home-manager/_mixins/desktop/emote.nix index c6e16c9..6215835 100644 --- a/home-manager/_mixins/desktop/emote.nix +++ b/home-manager/_mixins/desktop/emote.nix @@ -11,7 +11,7 @@ Description = "Emote"; }; Service = { - ExecStart = "${pkgs.unstable.emote}/bin/emote"; + ExecStart = "${pkgs.emote}/bin/emote"; Restart = "on-failure"; }; Install = { diff --git a/home-manager/_mixins/desktop/gitkraken.nix b/home-manager/_mixins/desktop/gitkraken.nix index 692e671..7fc5cf3 100644 --- a/home-manager/_mixins/desktop/gitkraken.nix +++ b/home-manager/_mixins/desktop/gitkraken.nix @@ -1,9 +1,5 @@ -{ pkgs, ... }: +_: { - home.packages = with pkgs; [ - unstable.gitkraken - ]; - home.file = { ".gitkraken/themes/bearded-vivid-black.jsonc".text = '' { diff --git a/home-manager/_mixins/desktop/gnome-sound-recorder.nix b/home-manager/_mixins/desktop/gnome-sound-recorder.nix index 8c57758..7553137 100644 --- a/home-manager/_mixins/desktop/gnome-sound-recorder.nix +++ b/home-manager/_mixins/desktop/gnome-sound-recorder.nix @@ -1,10 +1,6 @@ -{ config, lib, pkgs, username, ... }: +{ lib, username, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - gnome.gnome-sound-recorder - ]; - dconf.settings = { "org/gnome/SoundRecorder" = { audio-channel = "mono"; @@ -13,7 +9,6 @@ with lib.hm.gvariant; }; systemd.user.tmpfiles.rules = [ - "d ${config.home.homeDirectory}/Audio 0755 ${username} users - -" - "L+ ${config.home.homeDirectory}/.local/share/org.gnome.SoundRecorder/ - - - - ${config.home.homeDirectory}/Audio/" + "L+ /home/${username}/.local/share/org.gnome.SoundRecorder/ - - - - /home/${username}/Audio/" ]; } diff --git a/home-manager/_mixins/desktop/gnome.nix b/home-manager/_mixins/desktop/gnome.nix new file mode 100644 index 0000000..20023ad --- /dev/null +++ b/home-manager/_mixins/desktop/gnome.nix @@ -0,0 +1,174 @@ +{ config, lib, pkgs, ... }: +with lib.hm.gvariant; +{ + dconf.settings = { + "com/github/stsdc/monitor/settings" = { + background-state = true; + indicator-state = true; + indicator-cpu-state = false; + indicator-gpu-state = false; + indicator-memory-state = false; + indicator-network-download-state = true; + indicator-network-upload-state = true; + indicator-temperature-state = true; + }; + + "desktop/ibus/panel" = { + show-icon-on-systray = false; + use-custom-font = true; + custom-font = "Work Sans 10"; + }; + + "desktop/ibus/panel/emoji" = { + font = "JoyPixels 16"; + }; + + # "net/launchpad/plank/docks/dock1" = { + # alignment = "center"; + # hide-mode = "window-dodge"; + # icon-size = 48; + # pinned-only = false; + # position = "left"; + # theme = "Transparent"; + # }; + + "org/gnome/desktop/datetime" = { + automatic-timezone = true; + }; + + "org/gnome/desktop/input-sources" = { + xkb-options = [ "grp:alt_shift_toggle" "caps:none" ]; + }; + + "org/gnome/desktop/interface" = { + clock-format = "24h"; + color-scheme = "prefer-dark"; + cursor-size = 24; + cursor-theme = "adwaita"; + document-font-name = "Work Sans 12"; + font-name = "Work Sans 12"; + gtk-theme = "org.gnome.theme"; + gtk-enable-primary-paste = true; + icon-theme = "adwaita"; + monospace-font-name = "FiraCode Nerd Font Medium 13"; + text-scaling-factor = 1.0; + }; + + "org/gnome/desktop/session" = { + idle-delay = lib.hm.gvariant.mkUint32 7200; + }; + + # "org/gnome/desktop/sound" = { + # theme-name = "elementary"; + # }; + + "org/gnome/desktop/wm/keybindings" = { + switch-to-workspace-left = [ "Left" ]; + switch-to-workspace-right = [ "Right" ]; + switch-windows = [ " Tab" ]; + switch-windows-backward = [ " Tab" ]; + }; + + "org/gnome/desktop/wm/preferences" = { + audible-bell = false; + button-layout = ":minimize,maximize,close"; + num-workspaces = 8; + titlebar-font = "Work Sans Semi-Bold 12"; + workspace-names = [ "Web" "Work" "Chat" "Code" "Virt" "Cast" "Fun" "Stuff" ]; + }; + + "org/gnome/GWeather" = { + locations = "[<(uint32 2, <('Detroit', 'KDET', true, [(0.74017959717812587, -1.448797812080493)], [(0.73882277821762554, -1.4494218371012511)])>)>]"; + }; + + "org/gnome/mutter" = { + workspaces-only-on-primary = false; + dynamic-workspaces = false; + }; + + + "org/gnome/mutter/keybindings" = { + toggle-tiled-left = [ "Left" ]; + toggle-tiled-right = [ "Right" ]; + }; + + # "org/gnome/settings-daemon/plugins/media-keys" = { + # custom-keybindings = [ "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" ]; + # }; + + # "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = { + # binding = "e"; + # command = "io.elementary.files -n ~/"; + # name = "io.elementary.files -n ~/"; + # }; + + "org/gnome/settings-daemon/plugins/power" = { + power-button-action = "interactive"; + sleep-inactive-ac-timeout = 0; + sleep-inactive-ac-type = "nothing"; + }; + + #"org/gnome/settings-daemon/plugins/xsettings" = { + # overrides = "{\'Gtk/DialogsUseHeader\': <0>, \'Gtk/ShellShowsAppMenu\': <0>, \'Gtk/EnablePrimaryPaste\': <1>, \'Gtk/DecorationLayout\': <\':minimize,maximize,close,menu\'>, \'Gtk/ShowUnicodeMenu\': <0>}"; + #}; + + "org/gtk/gtk4/Settings/FileChooser" = { + clock-format = "24h"; + }; + + "org/gtk/Settings/FileChooser" = { + clock-format = "24h"; + }; + }; + + gtk = { + enable = true; + cursorTheme = { + name = "adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + size = 24; + }; + + font = { + name = "Work Sans 12"; + package = pkgs.work-sans; + }; + + gtk2 = { + configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + extraConfig = '' + gtk-application-prefer-dark-theme=1 + ''; + }; + + gtk3 = { + extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + }; + + gtk4 = { + extraConfig = { + gtk-application-prefer-dark-theme = 1; + }; + }; + + iconTheme = { + name = "adwaita"; + package = pkgs.gnome.adwaita-icon-theme; + }; + + theme = { + name = "org.gnome.theme"; + package = pkgs.numix-solarized-gtk-theme; + }; + }; + + home.pointerCursor = { + package = pkgs.gnome.adwaita-icon-theme; + name = "adwaita"; + size = 24; + gtk.enable = true; + x11.enable = true; + }; +} diff --git a/home-manager/_mixins/desktop/hyprland.nix b/home-manager/_mixins/desktop/hyprland.nix new file mode 100644 index 0000000..f3d1eec --- /dev/null +++ b/home-manager/_mixins/desktop/hyprland.nix @@ -0,0 +1,32 @@ +{ pkgs, ... }: { + wayland.windowManager.hyprland = { + enable = true; + settings = { + "$mod" = "SUPER"; + bind = + [ + "$mod, F, exec, ${pkgs.rofi}/bin/rofi" + ] + ++ ( + # workspaces + # binds $mod + [shift +] {1..10} to [move to] workspace {1..10} + builtins.concatLists (builtins.genList + ( + x: + let + ws = + let + c = (x + 1) / 10; + in + builtins.toString (x + 1 - (c * 10)); + in + [ + "$mod, ${ws}, workspace, ${toString (x + 1)}" + "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}" + ] + ) + 10) + ); + }; + }; +} diff --git a/home-manager/_mixins/desktop/i3.config b/home-manager/_mixins/desktop/i3.config new file mode 100644 index 0000000..fd35f5b --- /dev/null +++ b/home-manager/_mixins/desktop/i3.config @@ -0,0 +1,191 @@ +# This file has been auto-generated by i3-config-wizard(1). +# It will not be overwritten, so edit it as you like. +# +# Should you change your keyboard layout some time, delete +# this file and re-run i3-config-wizard(1). +# + +# i3 config file (v4) +# +# Please see https://i3wm.org/docs/userguide.html for a complete reference! + +set $mod Mod4 + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:monospace 8 + +# This font is widely installed, provides lots of unicode glyphs, right-to-left +# text rendering and scalability on retina/hidpi displays (thanks to pango). +#font pango:DejaVu Sans Mono 8 + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status + +# Use Mouse+$mod to drag floating windows to their wanted position +floating_modifier $mod + +# move tiling windows via drag & drop by left-clicking into the title bar, +# or left-clicking anywhere into the window while holding the floating modifier. +tiling_drag modifier titlebar + +# start a terminal +bindsym $mod+Return exec i3-sensible-terminal + +# kill focused window +bindsym $mod+Shift+q kill + +# start dmenu (a program launcher) +# bindsym $mod+d exec --no-startup-id dmenu_run +bindsym $mod+d exec "rofi -modi drun,run -show drun" +# A more modern dmenu replacement is rofi: +# bindcode $mod+40 exec "rofi -modi drun,run -show drun" +# There also is i3-dmenu-desktop which only displays applications shipping a +# .desktop file. It is a wrapper around dmenu, so you need that installed. +# bindcode $mod+40 exec --no-startup-id i3-dmenu-desktop + +# change focus +bindsym $mod+h focus left +bindsym $mod+j focus down +bindsym $mod+k focus up +bindsym $mod+l focus right + +# alternatively, you can use the cursor keys: +bindsym $mod+Left focus left +bindsym $mod+Down focus down +bindsym $mod+Up focus up +bindsym $mod+Right focus right + +# move focused window +bindsym $mod+Shift+h move left +bindsym $mod+Shift+j move down +bindsym $mod+Shift+k move up +bindsym $mod+Shift+l move right + +# alternatively, you can use the cursor keys: +bindsym $mod+Shift+Left move left +bindsym $mod+Shift+Down move down +bindsym $mod+Shift+Up move up +bindsym $mod+Shift+Right move right + +# split in horizontal orientation +bindsym $mod+Shift+g split h + +# split in vertical orientation +bindsym $mod+Shift+v split v + +# enter fullscreen mode for the focused container +bindsym $mod+f fullscreen toggle + +# change container layout (stacked, tabbed, toggle split) +bindsym $mod+s layout stacking +bindsym $mod+w layout tabbed +bindsym $mod+e layout toggle split + +# toggle tiling / floating +bindsym $mod+Shift+space floating toggle + +# change focus between tiling / floating windows +bindsym $mod+space focus mode_toggle + +# focus the parent container +bindsym $mod+a focus parent + +# focus the child container +#bindsym $mod+d focus child + +# Define names for default workspaces for which we configure key bindings later on. +# We use variables to avoid repeating the names in multiple places. +set $ws1 "1" +set $ws2 "2" +set $ws3 "3" +set $ws4 "4" +set $ws5 "5" +set $ws6 "6" +set $ws7 "7" +set $ws8 "8" +set $ws9 "9" +set $ws10 "10" + +# switch to workspace +bindsym $mod+1 workspace number $ws1 +bindsym $mod+2 workspace number $ws2 +bindsym $mod+3 workspace number $ws3 +bindsym $mod+4 workspace number $ws4 +bindsym $mod+5 workspace number $ws5 +bindsym $mod+6 workspace number $ws6 +bindsym $mod+7 workspace number $ws7 +bindsym $mod+8 workspace number $ws8 +bindsym $mod+9 workspace number $ws9 +bindsym $mod+0 workspace number $ws10 + +# move focused container to workspace +bindsym $mod+Shift+1 move container to workspace number $ws1 +bindsym $mod+Shift+2 move container to workspace number $ws2 +bindsym $mod+Shift+3 move container to workspace number $ws3 +bindsym $mod+Shift+4 move container to workspace number $ws4 +bindsym $mod+Shift+5 move container to workspace number $ws5 +bindsym $mod+Shift+6 move container to workspace number $ws6 +bindsym $mod+Shift+7 move container to workspace number $ws7 +bindsym $mod+Shift+8 move container to workspace number $ws8 +bindsym $mod+Shift+9 move container to workspace number $ws9 +bindsym $mod+Shift+0 move container to workspace number $ws10 + +# reload the configuration file +bindsym $mod+Shift+c reload +# restart i3 inplace (preserves your layout/session, can be used to upgrade i3) +bindsym $mod+Shift+r restart +# exit i3 (logs you out of your X session) +bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" + +# resize window (you can also use the mouse for that) +mode "resize" { + # These bindings trigger as soon as you enter the resize mode + + # Pressing left will shrink the window's width. + # Pressing right will grow the window's width. + # Pressing up will shrink the window's height. + # Pressing down will grow the window's height. + bindsym h resize shrink width 12 px or 12 ppt + bindsym j resize grow height 12 px or 12 ppt + bindsym k resize shrink height 12 px or 12 ppt + bindsym l resize grow width 12 px or 12 ppt + + # same bindings, but for the arrow keys + bindsym Left resize shrink width 3 px or 3 ppt + bindsym Down resize grow height 3 px or 3 ppt + bindsym Up resize shrink height 3 px or 3 ppt + bindsym Right resize grow width 3 px or 3 ppt + + # back to normal: Enter or Escape or $mod+r + bindsym Return mode "default" + bindsym Escape mode "default" + bindsym $mod+r mode "default" +} + +bindsym $mod+r mode "resize" + +# Start i3bar to display a workspace bar (plus the system information i3status +# finds out, if available) +bar { + status_command i3status +} diff --git a/home-manager/_mixins/desktop/i3.nix b/home-manager/_mixins/desktop/i3.nix new file mode 100644 index 0000000..ba74d2f --- /dev/null +++ b/home-manager/_mixins/desktop/i3.nix @@ -0,0 +1,33 @@ +{ pkgs, ... }: with pkgs.unstable; { + + home.file = { + ".config/i3/config".text = builtins.readFile ./i3.config; + }; + + # xsession.windowManager.i3 = { + # config = { + # bars = [ + # { + # position = "bottom"; + # statusCommand = "${i3status-rust}/bin/i3status-rs ~/.config/i3status-rust/config-top.toml"; + # } + # ]; + # }; + # }; + + # programs.i3status-rust = { + # enable = true; + # package = pkgs.unstable.i3status-rust; + # bars = { + # top = { + # blocks = [ + # { + # block = "time"; + # interval = 60; + # format = "%a %d/%m %k:%M %p"; + # } + # ]; + # }; + # }; + # }; +} diff --git a/home-manager/_mixins/desktop/jetbrains-toolbox.nix b/home-manager/_mixins/desktop/jetbrains-toolbox.nix deleted file mode 100644 index 2460d94..0000000 --- a/home-manager/_mixins/desktop/jetbrains-toolbox.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = [ pkgs.jetbrains-toolbox ]; -} diff --git a/home-manager/_mixins/desktop/keybase.nix b/home-manager/_mixins/desktop/keybase.nix new file mode 100644 index 0000000..0ad6085 --- /dev/null +++ b/home-manager/_mixins/desktop/keybase.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + keybase-gui + ]; + + systemd.user.services = { + keybase-gui = { + Unit = { + Description = "Keybase GUI"; + }; + Service = { + ExecStart = "${pkgs.keybase-gui}/bin/keybase-gui"; + Restart = "on-failure"; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; +} diff --git a/home-manager/_mixins/desktop/mate.nix b/home-manager/_mixins/desktop/mate.nix index 28988bf..51defc0 100644 --- a/home-manager/_mixins/desktop/mate.nix +++ b/home-manager/_mixins/desktop/mate.nix @@ -3,15 +3,15 @@ with lib.hm.gvariant; { dconf.settings = { "org/gnome/charmap" = { - font = "Work Sans 22"; + font = "Work Sans 18"; }; "org/gnome/desktop/interface" = { cursor-theme = "Yaru"; document-font-name = "Work Sans 12"; font-name = "Work Sans 12"; - gtk-theme = lib.mkForce "Yaru-magenta-dark"; - icon-theme = lib.mkForce "Yaru-magenta-dark"; + gtk-theme = "Yaru-magenta-dark"; + icon-theme = "Yaru-magenta-dark"; monospace-font-name = "FiraCode Nerd Font Medium 13"; }; @@ -107,7 +107,7 @@ with lib.hm.gvariant; }; "org/mate/desktop/peripherals/mouse" = { - cursor-size = 32; + cursor-size = 24; cursor-theme = "Yaru"; }; @@ -315,7 +315,7 @@ with lib.hm.gvariant; cursorTheme = { name = "Yaru"; package = pkgs.yaru-theme; - size = 32; + size = 24; }; font = { @@ -356,7 +356,7 @@ with lib.hm.gvariant; home.pointerCursor = { name = "Yaru"; package = pkgs.yaru-theme; - size = 32; + size = 24; gtk.enable = true; x11.enable = true; }; diff --git a/home-manager/_mixins/desktop/meld.nix b/home-manager/_mixins/desktop/meld.nix index 6544915..3f063a9 100644 --- a/home-manager/_mixins/desktop/meld.nix +++ b/home-manager/_mixins/desktop/meld.nix @@ -1,10 +1,6 @@ -{ lib, pkgs, ... }: +{ lib, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - meld - ]; - dconf.settings = { "org/gnome/meld" = { indent-width = 4; diff --git a/home-manager/_mixins/desktop/neovide.nix b/home-manager/_mixins/desktop/neovide.nix new file mode 100644 index 0000000..958608a --- /dev/null +++ b/home-manager/_mixins/desktop/neovide.nix @@ -0,0 +1 @@ +_: { } diff --git a/home-manager/_mixins/desktop/pantheon.nix b/home-manager/_mixins/desktop/pantheon.nix index 3a9a7e3..d63234d 100644 --- a/home-manager/_mixins/desktop/pantheon.nix +++ b/home-manager/_mixins/desktop/pantheon.nix @@ -101,7 +101,7 @@ with lib.hm.gvariant; "org/gnome/desktop/interface" = { clock-format = "24h"; color-scheme = "prefer-dark"; - cursor-size = 32; + cursor-size = 24; cursor-theme = "elementary"; document-font-name = "Work Sans 12"; font-name = "Work Sans 12"; @@ -195,7 +195,7 @@ with lib.hm.gvariant; cursorTheme = { name = "elementary"; package = pkgs.pantheon.elementary-icon-theme; - size = 32; + size = 24; }; font = { @@ -236,7 +236,7 @@ with lib.hm.gvariant; home.pointerCursor = { package = pkgs.pantheon.elementary-icon-theme; name = "elementary"; - size = 32; + size = 24; gtk.enable = true; x11.enable = true; }; diff --git a/home-manager/_mixins/desktop/rhythmbox.nix b/home-manager/_mixins/desktop/rhythmbox.nix index 7b6393f..6e795ba 100644 --- a/home-manager/_mixins/desktop/rhythmbox.nix +++ b/home-manager/_mixins/desktop/rhythmbox.nix @@ -1,10 +1,6 @@ -{ lib, pkgs, ... }: +{ lib, ... }: with lib.hm.gvariant; { - home.packages = with pkgs; [ - rhythmbox - ]; - dconf.settings = { "org/gnome/rhythmbox/plugins" = { active-plugins = [ "rb" "power-manager" "mpris" "iradio" "generic-player" "audiocd" "android" ]; @@ -14,6 +10,11 @@ with lib.hm.gvariant; download-interval = "manual"; }; + "org/gnome/rhythmbox/rhythmdb" = { + locations = [ "file:///home/${username}/Studio/Music" ]; + monitor-library = true; + }; + "org/gnome/rhythmbox/sources" = { browser-views = "genres-artists-albums"; visible-columns = [ "post-time" "duration" "track-number" "album" "genre" "beats-per-minute" "play-count" "artist" ]; diff --git a/home-manager/_mixins/desktop/skhd.nix b/home-manager/_mixins/desktop/skhd.nix new file mode 100644 index 0000000..2a103e3 --- /dev/null +++ b/home-manager/_mixins/desktop/skhd.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +let + templateValues = { + bin = { + yabai = "${pkgs.yabai}"; + }; + }; + + skhdConfig = pkgs.templateFile "skhdrc" ./skhd/skhd.conf.tpl templateValues; +in +{ + home.file.".config/skhd/skhdrc".source = "${skhdConfig}"; +} diff --git a/home-manager/_mixins/desktop/skhd/skhd.conf.tpl b/home-manager/_mixins/desktop/skhd/skhd.conf.tpl new file mode 100644 index 0000000..1a5d6b2 --- /dev/null +++ b/home-manager/_mixins/desktop/skhd/skhd.conf.tpl @@ -0,0 +1,55 @@ +cmd - return: open -n -a ITerm +# cmd - e : emacsclient -c +# Restart Yabai +alt + cmd - q: brew services restart {{bin.yabai}} +#restart emacs client +alt + cmd - e: brew services restart sketchybar + +### Switch focus to another destop ### +cmd - 1 : {{bin.yabai}} -m space --focus 1 +cmd - 2 : {{bin.yabai}} -m space --focus 2 +cmd - 3 : {{bin.yabai}} -m space --focus 3 +cmd - 4 : {{bin.yabai}} -m space --focus 4 +cmd - 5 : {{bin.yabai}} -m space --focus 5 +cmd - 6 : {{bin.yabai}} -m space --focus 6 +cmd - 7 : {{bin.yabai}} -m space --focus 7 +cmd - 8 : {{bin.yabai}} -m space --focus 8 +cmd - 9 : {{bin.yabai}} -m space --focus 9 +cmd - 0 : {{bin.yabai}} -m space --focus 10 +cmd - l : {{bin.yabai}} -m space --focus next +cmd - h : {{bin.yabai}} -m space --focus prev + +#resize windows +cmd + shift - h : {{bin.yabai}} -m window --resize right:-20:0 +cmd + shift - l : {{bin.yabai}} -m window --resize right:20:0 + +#kill active window +cmd + shift - c : {{bin.yabai}} -m window --close + +### Open dmenu ### +# cmd + shift - return : open -a Xquartz && /bin/bash -l -c "sh ~/dev/dots/dmenu/apps.sh" # App launcher + +### Send a window to a space ### +cmd + shift - 1 : {{bin.yabai}} -m window --space 1 +cmd + shift - 2 : {{bin.yabai}} -m window --space 2 +cmd + shift - 3 : {{bin.yabai}} -m window --space 3 +cmd + shift - 4 : {{bin.yabai}} -m window --space 4 +cmd + shift - 5 : {{bin.yabai}} -m window --space 5 +cmd + shift - 6 : {{bin.yabai}} -m window --space 6 +cmd + shift - 7 : {{bin.yabai}} -m window --space 7 +cmd + shift - 8 : {{bin.yabai}} -m window --space 8 +cmd + shift - 9 : {{bin.yabai}} -m window --space 9 +cmd + shift - h : {{bin.yabai}} -m window --space prev # Send window to space on the left +cmd + shift - l : {{bin.yabai}} -m window --space next # Send window to space on the right + +### Send a window to a space and follow focus ### +cmd + alt - 1 : {{bin.yabai}} -m window --space 1; {{bin.yabai}} -m space --focus 1 +cmd + alt - 2 : {{bin.yabai}} -m window --space 2; {{bin.yabai}} -m space --focus 2 +cmd + alt - 3 : {{bin.yabai}} -m window --space 3; {{bin.yabai}} -m space --focus 3 +cmd + alt - 4 : {{bin.yabai}} -m window --space 4; {{bin.yabai}} -m space --focus 4 +cmd + alt - 5 : {{bin.yabai}} -m window --space 5; {{bin.yabai}} -m space --focus 5 +cmd + alt - 6 : {{bin.yabai}} -m window --space 6; {{bin.yabai}} -m space --focus 6 +cmd + alt - 7 : {{bin.yabai}} -m window --space 7; {{bin.yabai}} -m space --focus 7 +cmd + alt - 8 : {{bin.yabai}} -m window --space 8; {{bin.yabai}} -m space --focus 8 +cmd + alt - h : {{bin.yabai}} -m window --space prev; {{bin.yabai}} -m space --focus prev # To the space on the left +cmd + alt - l : {{bin.yabai}} -m window --space next; {{bin.yabai}} -m space --focus next # To the spave on the right \ No newline at end of file diff --git a/home-manager/_mixins/desktop/tilix.nix b/home-manager/_mixins/desktop/tilix.nix index 42d5f8b..6151006 100644 --- a/home-manager/_mixins/desktop/tilix.nix +++ b/home-manager/_mixins/desktop/tilix.nix @@ -1,11 +1,9 @@ # Generated via dconf2nix: https://github.com/gvolpe/dconf2nix -{ lib, pkgs, ... }: -with lib.hm.gvariant; -{ - home.packages = with pkgs; [ - tilix - ]; +{ lib, ... }: +with lib.hm.gvariant; + +{ dconf.settings = { "com/gexperts/Tilix" = { app-title = "\${appName}: \${directory}"; @@ -48,7 +46,7 @@ with lib.hm.gvariant; default-size-columns = 132; default-size-rows = 50; draw-margin = 80; - font = "FiraCode Nerd Font Medium 12"; + font = "FiraCode Nerd Font Medium 10"; foreground-color = "#C8C8C8C8C8C8"; highlight-background-color = "#1E1E1E1E2020"; highlight-colors-set = false; @@ -56,7 +54,7 @@ with lib.hm.gvariant; palette = [ "#121212121414" "#D6D62B2B2B2B" "#4141DDDD7575" "#FFFFB6B63838" "#2828A9A9FFFF" "#E6E66D6DFFFF" "#1414E5E5D3D3" "#C8C8C8C8C8C8" "#434343434545" "#DEDE56565656" "#A1A1EEEEBBBB" "#FFFFC5C56060" "#9494D4D4FFFF" "#F2F2B6B6FFFF" "#A0A0F5F5EDED" "#E9E9E9E9E9E9" ]; scrollback-unlimited = true; terminal-title = ""; - use-system-font = true; + use-system-font = false; use-theme-colors = false; visible-name = "Bearded Dark Vivid"; }; diff --git a/home-manager/_mixins/games/default.nix b/home-manager/_mixins/games/default.nix deleted file mode 100644 index 77cc96e..0000000 --- a/home-manager/_mixins/games/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: { - imports = [ - # ./steam.nix - ]; - home.packages = with pkgs; [ gamescope ]; -} diff --git a/home-manager/_mixins/games/steam.nix b/home-manager/_mixins/games/steam.nix deleted file mode 100644 index 076ec70..0000000 --- a/home-manager/_mixins/games/steam.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ pkgs, lib, config, ... }: -let - steam-with-pkgs = pkgs.steam.override { - extraPkgs = pkgs: with pkgs; [ - xorg.libXcursor - xorg.libXi - xorg.libXinerama - xorg.libXScrnSaver - libpng - libpulseaudio - libvorbis - stdenv.cc.cc.lib - libkrb5 - keyutils - gamescope - mangohud - ]; - }; - - monitor = lib.head (lib.filter (m: m.primary) config.monitors); - steam-session = pkgs.writeTextDir "share/wayland-sessions/steam-sesson.desktop" '' - [Desktop Entry] - Name=Steam Session - Exec=${pkgs.gamescope}/bin/gamescope -W ${toString monitor.width} -H ${toString monitor.height} -O ${monitor.name} -e -- steam -gamepadui - Type=Application - ''; -in -{ - home.packages = with pkgs; [ - steam-with-pkgs - steam-session - gamescope - mangohud - protontricks - ]; - home.persistence = { - "/persist/home/${username}" = { - allowOther = true; - directories = [ - ".factorio" - ".config/Hero_Siege" - ".config/unity3d/Berserk Games/Tabletop Simulator" - ".config/unity3d/IronGate/Valheim" - ".local/share/Tabletop Simulator" - ".local/share/Paradox Interactive" - ".paradoxlauncher" - { - # A couple of games don't play well with bindfs - directory = ".local/share/Steam"; - method = "symlink"; - } - ]; - }; - }; -} diff --git a/home-manager/_mixins/helix/default.nix b/home-manager/_mixins/helix/default.nix deleted file mode 100644 index f08583b..0000000 --- a/home-manager/_mixins/helix/default.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ config, ... }: -let - inherit (config) colorscheme; -in -{ - home.sessionVariables.COLORTERM = "truecolor"; - programs.helix = { - enable = true; - settings = { - theme = colorscheme.slug; - editor = { - color-modes = true; - line-number = "relative"; - indent-guides.render = true; - cursor-shape = { - normal = "block"; - insert = "bar"; - select = "underline"; - }; - }; - }; - themes = import ./theme.nix { inherit colorscheme; }; - }; -} diff --git a/home-manager/_mixins/helix/theme.nix b/home-manager/_mixins/helix/theme.nix deleted file mode 100644 index 94b4151..0000000 --- a/home-manager/_mixins/helix/theme.nix +++ /dev/null @@ -1,72 +0,0 @@ -{ colorscheme }: { - "${colorscheme.slug}" = { - palette = builtins.mapAttrs (_name: value: "#${value}") colorscheme.colors; # Add leading '#' - "attributes" = "base09"; - "comment" = { fg = "base03"; modifiers = [ "italic" ]; }; - "constant" = "base09"; - "constant.character.escape" = "base0C"; - "constant.numeric" = "base09"; - "constructor" = "base0D"; - "debug" = "base03"; - "diagnostic" = { modifiers = [ "underlined" ]; }; - "diagnostic.error" = { underline = { style = "curl"; }; }; - "diagnostic.hint" = { underline = { style = "curl"; }; }; - "diagnostic.info" = { underline = { style = "curl"; }; }; - "diagnostic.warning" = { underline = { style = "curl"; }; }; - "diff.delta" = "base09"; - "diff.minus" = "base08"; - "diff.plus" = "base0B"; - "error" = "base08"; - "function" = "base0D"; - "hint" = "base03"; - "info" = "base0D"; - "keyword" = "base0E"; - "label" = "base0E"; - "markup.bold" = { fg = "base0A"; modifiers = [ "bold" ]; }; - "markup.heading" = "base0D"; - "markup.italic" = { fg = "base0E"; modifiers = [ "italic" ]; }; - "markup.link.text" = "base08"; - "markup.link.url" = { fg = "base09"; modifiers = [ "underlined" ]; }; - "markup.list" = "base08"; - "markup.quote" = "base0C"; - "markup.raw" = "base0B"; - "markup.strikethrough" = { modifiers = [ "crossed_out" ]; }; - "namespace" = "base0E"; - "operator" = "base05"; - "special" = "base0D"; - "string" = "base0B"; - "type" = "base0A"; - "ui.background" = { bg = "base00"; }; - "ui.bufferline" = { fg = "base04"; bg = "base00"; }; - "ui.bufferline.active" = { fg = "base00"; bg = "base03"; modifiers = [ "bold" ]; }; - "ui.cursor" = { fg = "base04"; modifiers = [ "reversed" ]; }; - "ui.cursor.insert" = { fg = "base0A"; modifiers = [ "underlined" ]; }; - "ui.cursor.match" = { fg = "base0A"; modifiers = [ "underlined" ]; }; - "ui.cursor.select" = { fg = "base0A"; modifiers = [ "underlined" ]; }; - "ui.cursorline.primary" = { fg = "base05"; bg = "base01"; }; - "ui.gutter" = { bg = "base00"; }; - "ui.help" = { fg = "base06"; bg = "base01"; }; - "ui.linenr" = { fg = "base03"; bg = "base00"; }; - "ui.linenr.selected" = { fg = "base04"; bg = "base01"; modifiers = [ "bold" ]; }; - "ui.menu" = { fg = "base05"; bg = "base01"; }; - "ui.menu.scroll" = { fg = "base03"; bg = "base01"; }; - "ui.menu.selected" = { fg = "base01"; bg = "base04"; }; - "ui.popup" = { bg = "base01"; }; - "ui.selection" = { bg = "base02"; }; - "ui.selection.primary" = { bg = "base02"; }; - "ui.statusline" = { fg = "base0B"; bg = "base02"; }; - "ui.statusline.inactive" = { bg = "base01"; fg = "base02"; }; - "ui.statusline.insert" = { fg = "base00"; bg = "base0B"; }; - "ui.statusline.normal" = { fg = "base00"; bg = "base04"; }; - "ui.statusline.select" = { fg = "base00"; bg = "base0E"; }; - "ui.text" = "base05"; - "ui.text.focus" = "base05"; - "ui.virtual.indent-guide" = { fg = "base03"; }; - "ui.virtual.ruler" = { bg = "base01"; }; - "ui.virtual.whitespace" = { fg = "base01"; }; - "ui.window" = { bg = "base01"; }; - "variable" = "base08"; - "variable.other.member" = "base08"; - "warning" = "base09"; - }; -} diff --git a/home-manager/_mixins/music/default.nix b/home-manager/_mixins/music/default.nix deleted file mode 100644 index 60d5c9d..0000000 --- a/home-manager/_mixins/music/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ alsa-utils ]; - services.fluidsynth = { - enable = true; - soundService = "pipewire-pulse"; - extraOptions = [ - "-g 2" - ]; - }; -} diff --git a/home-manager/_mixins/nvim/default.nix b/home-manager/_mixins/nvim/default.nix deleted file mode 100644 index 53eb860..0000000 --- a/home-manager/_mixins/nvim/default.nix +++ /dev/null @@ -1,171 +0,0 @@ -{ config, pkgs, ... }: -{ - imports = [ - ./lsp.nix - ./syntaxes.nix - ./ui.nix - ]; - - programs.neovim = { - enable = true; - - extraConfig = /* vim */ '' - "Use system clipboard - set clipboard=unnamedplus - "Set fold level to highest in file - "so everything starts out unfolded at just the right level - augroup initial_fold - autocmd! - autocmd BufWinEnter * let &foldlevel = max(map(range(1, line('$')), 'foldlevel(v:val)')) - augroup END - - "Tabs - set tabstop=4 "4 char-wide tab - set expandtab "Use spaces - set softtabstop=0 "Use same length as 'tabstop' - set shiftwidth=0 "Use same length as 'tabstop' - "2 char-wide overrides - augroup two_space_tab - autocmd! - autocmd FileType json,html,htmldjango,hamlet,nix,scss,typescript,php,haskell,terraform setlocal tabstop=2 - augroup END - - "Set tera to use htmldjango syntax - augroup tera_htmldjango - autocmd! - autocmd BufRead,BufNewFile *.tera setfiletype htmldjango - augroup END - - "Options when composing mutt mail - augroup mail_settings - autocmd FileType mail set noautoindent wrapmargin=0 textwidth=0 linebreak wrap formatoptions +=w - augroup END - - "Fix nvim size according to terminal - "(https://github.com/neovim/neovim/issues/11330) - augroup fix_size - autocmd VimEnter * silent exec "!kill -s SIGWINCH" getpid() - augroup END - - "Line numbers - set number relativenumber - - "Scroll up and down - nmap - nmap - - "Buffers - nmap :bnext - nmap :bprev - nmap :bdel - - "Loclist - nmap l :lwindow - nmap [l :lprev - nmap ]l :lnext - - nmap L :lhistory - nmap [L :lolder - nmap ]L :lnewer - - "Quickfix - nmap q :cwindow - nmap [q :cprev - nmap ]q :cnext - - nmap Q :chistory - nmap [Q :colder - nmap ]Q :cnewer - - "Make - nmap m :make - - "Grep (replace with ripgrep) - nmap g :grep - if executable('rg') - set grepprg=rg\ --vimgrep - set grepformat=%f:%l:%c:%m - endif - - "Close other splits - nmap o :only - - "Sudo save - cmap w!! w !sudo tee > /dev/null % - ''; - extraLuaConfig = /* lua */ '' - vim.keymap.set("n", "gD", vim.lsp.buf.declaration, { desc = "Go to declaration" }) - vim.keymap.set("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) - vim.keymap.set("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" }) - vim.keymap.set("n", "f", vim.lsp.buf.format, { desc = "Format code" }) - vim.keymap.set("n", "K", vim.lsp.buf.hover, { desc = "Hover Documentation" }) - vim.keymap.set("n", "c", vim.lsp.buf.code_action, { desc = "Code action" }) - - -- Diagnostic - vim.keymap.set("n", "e", vim.diagnostic.open_float, { desc = "Floating diagnostic" }) - vim.keymap.set("n", "[d", vim.diagnostic.goto_prev, { desc = "Previous diagnostic" }) - vim.keymap.set("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" }) - vim.keymap.set("n", "gl", vim.diagnostic.setloclist, { desc = "Diagnostics on loclist" }) - vim.keymap.set("n", "gq", vim.diagnostic.setqflist, { desc = "Diagnostics on quickfix" }) - - function add_sign(name, text) - vim.fn.sign_define(name, { text = text, texthl = name, numhl = name}) - end - - add_sign("DiagnosticSignError", "󰅚 ") - add_sign("DiagnosticSignWarn", " ") - add_sign("DiagnosticSignHint", "󰌶 ") - add_sign("DiagnosticSignInfo", " ") - ''; - - plugins = with pkgs.vimPlugins; [ - vim-table-mode - editorconfig-nvim - vim-surround - { - plugin = nvim-autopairs; - type = "lua"; - config = /* lua */ '' - require('nvim-autopairs').setup{} - ''; - } - ]; - }; - - xdg.configFile."nvim/init.lua".onChange = '' - XDG_RUNTIME_DIR=''${XDG_RUNTIME_DIR:-/run/user/$(id -u)} - for server in $XDG_RUNTIME_DIR/nvim.*; do - nvim --server $server --remote-send ':source $MYVIMRC' & - done - ''; - - xdg.desktopEntries = { - nvim = { - name = "Neovim"; - genericName = "Text Editor"; - comment = "Edit text files"; - exec = "nvim %F"; - icon = "nvim"; - mimeType = [ - "text/english" - "text/plain" - "text/x-makefile" - "text/x-c++hdr" - "text/x-c++src" - "text/x-chdr" - "text/x-csrc" - "text/x-java" - "text/x-moc" - "text/x-pascal" - "text/x-tcl" - "text/x-tex" - "application/x-shellscript" - "text/x-c" - "text/x-c++" - ]; - terminal = true; - type = "Application"; - categories = [ "Utility" "TextEditor" ]; - }; - }; -} diff --git a/home-manager/_mixins/nvim/lsp.nix b/home-manager/_mixins/nvim/lsp.nix deleted file mode 100644 index 6b072ad..0000000 --- a/home-manager/_mixins/nvim/lsp.nix +++ /dev/null @@ -1,91 +0,0 @@ -{ pkgs, ... }: { - programs.neovim.plugins = with pkgs.vimPlugins; [ - # LSP - { - plugin = nvim-lspconfig; - type = "lua"; - config = /* lua */ '' - local lspconfig = require('lspconfig') - - function add_lsp(binary, server, options) - if not options["cmd"] then options["cmd"] = { binary, unpack(options["cmd_args"] or {}) } end - if vim.fn.executable(binary) == 1 then server.setup(options) end - end - - add_lsp("docker-langserver", lspconfig.dockerls, {}) - add_lsp("bash-language-server", lspconfig.bashls, {}) - add_lsp("clangd", lspconfig.clangd, {}) - add_lsp("nil", lspconfig.nil_ls, {}) - add_lsp("pylsp", lspconfig.pylsp, {}) - add_lsp("solargraph", lspconfig.solargraph, {}) - add_lsp("phpactor", lspconfig.phpactor, {}) - add_lsp("terraform-ls", lspconfig.terraformls, { - cmd_args = { "serve" } - }) - add_lsp("texlab", lspconfig.texlab, {}) - add_lsp("gopls", lspconfig.gopls, {}) - add_lsp("tsserver", lspconfig.tsserver, {}) - add_lsp("lua-lsp", lspconfig.lua_ls, {}) - add_lsp("jdt-language-server", lspconfig.jdtls, {}) - add_lsp("texlab", lspconfig.texlab, { - chktex = { - onEdit = true, - onOpenAndSave = true - } - }) - ''; - } - { - plugin = ltex_extra-nvim; - type = "lua"; - config = /* lua */ '' - local ltex_extra = require('ltex_extra') - add_lsp("ltex-ls", lspconfig.ltex, { - on_attach = function(client, bufnr) - ltex_extra.setup{ - path = vim.fn.expand("~") .. "/.local/state/ltex" - } - end - }) - ''; - } - { - plugin = rust-tools-nvim; - type = "lua"; - config = /* lua */ '' - local rust_tools = require('rust-tools') - add_lsp("rust-analyzer", rust_tools, { - tools = { autoSetHints = true } - }) - vim.api.nvim_set_hl(0, '@lsp.type.comment.rust', {}) - ''; - } - - # Completions - cmp-nvim-lsp - cmp-buffer - lspkind-nvim - { - plugin = nvim-cmp; - type = "lua"; - config = /* lua */ '' - local cmp = require('cmp') - - cmp.setup{ - formatting = { format = require('lspkind').cmp_format() }, - -- Same keybinds as vim's vanilla completion - mapping = { - [''] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm(), - }, - sources = { - { name='buffer', option = { get_bufnrs = vim.api.nvim_list_bufs } }, - { name='nvim_lsp' }, - }, - } - ''; - } - ]; -} diff --git a/home-manager/_mixins/nvim/syntaxes.nix b/home-manager/_mixins/nvim/syntaxes.nix deleted file mode 100644 index ed63777..0000000 --- a/home-manager/_mixins/nvim/syntaxes.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ pkgs, config, lib, ... }: { - programs.neovim = { - extraConfig = /* vim */ lib.mkAfter '' - function! SetCustomKeywords() - syn match Todo /TODO/ - syn match Done /DONE/ - syn match Start /START/ - syn match End /END/ - endfunction - - autocmd Syntax * call SetCustomKeywords() - ''; - plugins = with pkgs.vimPlugins; [ - rust-vim - vim-markdown - vim-nix - vim-toml - mermaid-vim - pgsql-vim - vim-terraform - vim-jsx-typescript - vim-caddyfile - - { - plugin = vimtex; - config = - let - method = - if config.programs.zathura.enable - then "zathura" - else "general"; - in - '' - let g:vimtex_view_method = '${method}' - ''; - } - - # Tree sitter - { - plugin = nvim-treesitter.withAllGrammars; - type = "lua"; - config = /* lua */ '' - require('nvim-treesitter.configs').setup{ - highlight = { - enable = true, - additional_vim_regex_highlighting = false, - }, - } - ''; - } - ]; - }; -} diff --git a/home-manager/_mixins/nvim/theme.nix b/home-manager/_mixins/nvim/theme.nix deleted file mode 100644 index 9665497..0000000 --- a/home-manager/_mixins/nvim/theme.nix +++ /dev/null @@ -1,329 +0,0 @@ -scheme: -let c = scheme.colors; -in /* vim */ '' - let g:colors_name="nix-${scheme.slug}" - - set termguicolors - - if exists("syntax_on") - syntax reset - endif - - hi clear - - hi Normal guifg=#${c.base05} guibg=#${c.base00} gui=NONE guisp=NONE - hi Bold guifg=NONE guibg=NONE gui=bold guisp=NONE - hi Debug guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi Directory guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi Error guifg=#${c.base00} guibg=#${c.base08} gui=NONE guisp=NONE - hi ErrorMsg guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - hi Exception guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi FoldColumn guifg=#${c.base0C} guibg=#${c.base00} gui=NONE guisp=NONE - hi Folded guifg=#${c.base03} guibg=#${c.base01} gui=NONE guisp=NONE - hi IncSearch guifg=#${c.base01} guibg=#${c.base09} gui=NONE guisp=NONE - hi Italic guifg=NONE guibg=NONE gui=NONE guisp=NONE - hi Macro guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi MatchParen guifg=NONE guibg=#${c.base03} gui=NONE guisp=NONE - hi ModeMsg guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi MoreMsg guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi Question guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi Search guifg=#${c.base01} guibg=#${c.base0A} gui=NONE guisp=NONE - hi Substitute guifg=#${c.base01} guibg=#${c.base0A} gui=NONE guisp=NONE - hi SpecialKey guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi TooLong guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi Underlined guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi Visual guifg=NONE guibg=#${c.base02} gui=NONE guisp=NONE - hi VisualNOS guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi WarningMsg guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi WildMenu guifg=#${c.base08} guibg=#${c.base0A} gui=NONE guisp=NONE - hi Title guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi Conceal guifg=#${c.base0D} guibg=#${c.base00} gui=NONE guisp=NONE - hi Cursor guifg=#${c.base00} guibg=#${c.base05} gui=NONE guisp=NONE - hi NonText guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi LineNr guifg=#${c.base04} guibg=#${c.base00} gui=NONE guisp=NONE - hi SignColumn guifg=#${c.base04} guibg=#${c.base00} gui=NONE guisp=NONE - hi StatusLine guifg=#${c.base0B} guibg=#${c.base02} gui=NONE guisp=NONE - hi StatusLineNC guifg=#${c.base04} guibg=#${c.base01} gui=NONE guisp=NONE - hi VertSplit guifg=#${c.base01} guibg=#${c.base00} gui=NONE guisp=NONE - hi ColorColumn guifg=NONE guibg=#${c.base01} gui=NONE guisp=NONE - hi CursorColumn guifg=NONE guibg=#${c.base01} gui=NONE guisp=NONE - hi CursorLine guifg=NONE guibg=#${c.base02} gui=NONE guisp=NONE - hi CursorLineNr guifg=#${c.base0B} guibg=#${c.base01} gui=NONE guisp=NONE - hi QuickFixLine guifg=NONE guibg=#${c.base01} gui=NONE guisp=NONE - hi PMenu guifg=#${c.base05} guibg=#${c.base01} gui=NONE guisp=NONE - hi PMenuSel guifg=#${c.base01} guibg=#${c.base05} gui=NONE guisp=NONE - hi TabLine guifg=#${c.base03} guibg=#${c.base01} gui=NONE guisp=NONE - hi TabLineFill guifg=#${c.base03} guibg=#${c.base02} gui=NONE guisp=NONE - hi TabLineSel guifg=#${c.base0B} guibg=#${c.base01} gui=NONE guisp=NONE - hi EndOfBuffer guifg=#${c.base00} guibg=NONE gui=NONE guisp=NONE - - hi Boolean guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi Character guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi Comment guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi Conditional guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi Constant guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi Define guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi Delimiter guifg=#${c.base0F} guibg=NONE gui=NONE guisp=NONE - hi Float guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi Function guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi Identifier guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi Include guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi Keyword guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi Label guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi Number guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi Operator guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi PreProc guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi Repeat guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi Special guifg=#${c.base0C} guibg=NONE gui=NONE guisp=NONE - hi SpecialChar guifg=#${c.base0F} guibg=NONE gui=NONE guisp=NONE - hi Statement guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi StorageClass guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi String guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi Structure guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi Tag guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi Type guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi Typedef guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - - hi Todo guifg=#${c.base01} guibg=#${c.base0A} gui=NONE guisp=NONE - hi Done guifg=#${c.base01} guibg=#${c.base0B} gui=NONE guisp=NONE - hi Start guifg=#${c.base01} guibg=#${c.base0D} gui=NONE guisp=NONE - hi End guifg=#${c.base01} guibg=#${c.base0E} gui=NONE guisp=NONE - - hi DiffAdd guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffChange guifg=#${c.base03} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffDelete guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffText guifg=#${c.base0D} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffAdded guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffFile guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffNewFile guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffLine guifg=#${c.base0D} guibg=#${c.base00} gui=NONE guisp=NONE - hi DiffRemoved guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - - hi gitcommitOverflow guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi gitcommitSummary guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi gitcommitComment guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi gitcommitUntracked guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi gitcommitDiscarded guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi gitcommitSelected guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi gitcommitHeader guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi gitcommitSelectedType guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi gitcommitUnmergedType guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi gitcommitDiscardedType guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi gitcommitBranch guifg=#${c.base09} guibg=NONE gui=bold guisp=NONE - hi gitcommitUntrackedFile guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi gitcommitUnmergedFile guifg=#${c.base08} guibg=NONE gui=bold guisp=NONE - hi gitcommitDiscardedFile guifg=#${c.base08} guibg=NONE gui=bold guisp=NONE - hi gitcommitSelectedFile guifg=#${c.base0B} guibg=NONE gui=bold guisp=NONE - - hi GitGutterAdd guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi GitGutterChange guifg=#${c.base0D} guibg=#${c.base00} gui=NONE guisp=NONE - hi GitGutterDelete guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - hi GitGutterChangeDelete guifg=#${c.base0E} guibg=#${c.base00} gui=NONE guisp=NONE - - hi SpellBad guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base08} - hi SpellLocal guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0C} - hi SpellCap guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0D} - hi SpellRare guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0E} - - hi DiagnosticError guifg=#${c.base08} guibg=#${c.base01} gui=NONE guisp=NONE - hi DiagnosticWarn guifg=#${c.base0E} guibg=#${c.base01} gui=NONE guisp=NONE - hi DiagnosticInfo guifg=#${c.base05} guibg=#${c.base01} gui=NONE guisp=NONE - hi DiagnosticHint guifg=#${c.base0C} guibg=#${c.base01} gui=NONE guisp=NONE - hi DiagnosticUnderlineError guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base08} - hi DiagnosticUnderlineWarning guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0E} - hi DiagnosticUnderlineWarn guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0E} - hi DiagnosticUnderlineInformation guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0F} - hi DiagnosticUnderlineHint guifg=NONE guibg=NONE gui=undercurl guisp=#${c.base0C} - - hi LspReferenceText guifg=NONE guibg=NONE gui=underline guisp=#${c.base04} - hi LspReferenceRead guifg=NONE guibg=NONE gui=underline guisp=#${c.base04} - hi LspReferenceWrite guifg=NONE guibg=NONE gui=underline guisp=#${c.base04} - - hi link LspDiagnosticsDefaultError DiagnosticError - hi link LspDiagnosticsDefaultWarning DiagnosticWarn - hi link LspDiagnosticsDefaultInformation DiagnosticInfo - hi link LspDiagnosticsDefaultHint DiagnosticHint - hi link LspDiagnosticsUnderlineError DiagnosticUnderlineError - hi link LspDiagnosticsUnderlineWarning DiagnosticUnderlineWarning - hi link LspDiagnosticsUnderlineInformation DiagnosticUnderlineInformation - hi link LspDiagnosticsUnderlineHint DiagnosticUnderlineHint - - hi TSAnnotation guifg=#${c.base0F} guibg=NONE gui=NONE guisp=NONE - hi TSAttribute guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi TSBoolean guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi TSCharacter guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSComment guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE "was italic - hi TSConstructor guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi TSConditional guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi TSConstant guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi TSConstBuiltin guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE "was italic - hi TSConstMacro guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSError guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSException guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSField guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSFloat guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi TSFunction guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi TSFuncBuiltin guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE "was italic - hi TSFuncMacro guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSInclude guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi TSKeyword guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi TSKeywordFunction guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi TSKeywordOperator guifg=#${c.base0E} guibg=NONE gui=NONE guisp=NONE - hi TSLabel guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi TSMethod guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi TSNamespace guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSNone guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSNumber guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi TSOperator guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSParameter guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSParameterReference guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSProperty guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSPunctDelimiter guifg=#${c.base0F} guibg=NONE gui=NONE guisp=NONE - hi TSPunctBracket guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSPunctSpecial guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSRepeat guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi TSString guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi TSStringRegex guifg=#${c.base0C} guibg=NONE gui=NONE guisp=NONE - hi TSStringEscape guifg=#${c.base0C} guibg=NONE gui=NONE guisp=NONE - hi TSSymbol guifg=#${c.base0B} guibg=NONE gui=NONE guisp=NONE - hi TSTag guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi TSTagDelimiter guifg=#${c.base0F} guibg=NONE gui=NONE guisp=NONE - hi TSText guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi TSStrong guifg=NONE guibg=NONE gui=bold guisp=NONE - hi TSEmphasis guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE "was italic - hi TSUnderline guifg=#${c.base00} guibg=NONE gui=underline guisp=NONE - hi TSStrike guifg=#${c.base00} guibg=NONE gui=strikethrough guisp=NONE - hi TSTitle guifg=#${c.base0D} guibg=NONE gui=NONE guisp=NONE - hi TSLiteral guifg=#${c.base09} guibg=NONE gui=NONE guisp=NONE - hi TSURI guifg=#${c.base09} guibg=NONE gui=underline guisp=NONE - hi TSType guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE - hi TSTypeBuiltin guifg=#${c.base0A} guibg=NONE gui=NONE guisp=NONE "was italic - hi TSVariable guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE - hi TSVariableBuiltin guifg=#${c.base08} guibg=NONE gui=NONE guisp=NONE "was italic - - hi TSDefinition guifg=NONE guibg=NONE gui=underline guisp=#${c.base04} - hi TSDefinitionUsage guifg=NONE guibg=NONE gui=underline guisp=#${c.base04} - hi TSCurrentScope guifg=NONE guibg=NONE gui=bold guisp=NONE - if has('nvim-0.8.0') - highlight! link @annotation TSAnnotation - highlight! link @attribute TSAttribute - highlight! link @boolean TSBoolean - highlight! link @character TSCharacter - highlight! link @comment TSComment - highlight! link @conditional TSConditional - highlight! link @constant TSConstant - highlight! link @constant.builtin TSConstBuiltin - highlight! link @constant.macro TSConstMacro - highlight! link @constructor TSConstructor - highlight! link @exception TSException - highlight! link @field TSField - highlight! link @float TSFloat - highlight! link @function TSFunction - highlight! link @function.builtin TSFuncBuiltin - highlight! link @function.macro TSFuncMacro - highlight! link @include TSInclude - highlight! link @keyword TSKeyword - highlight! link @keyword.function TSKeywordFunction - highlight! link @keyword.operator TSKeywordOperator - highlight! link @label TSLabel - highlight! link @method TSMethod - highlight! link @namespace TSNamespace - highlight! link @none TSNone - highlight! link @number TSNumber - highlight! link @operator TSOperator - highlight! link @parameter TSParameter - highlight! link @parameter.reference TSParameterReference - highlight! link @property TSProperty - highlight! link @punctuation.bracket TSPunctBracket - highlight! link @punctuation.delimiter TSPunctDelimiter - highlight! link @punctuation.special TSPunctSpecial - highlight! link @repeat TSRepeat - highlight! link @storageclass TSStorageClass - highlight! link @string TSString - highlight! link @string.escape TSStringEscape - highlight! link @string.regex TSStringRegex - highlight! link @symbol TSSymbol - highlight! link @tag TSTag - highlight! link @tag.delimiter TSTagDelimiter - highlight! link @text TSText - highlight! link @strike TSStrike - highlight! link @math TSMath - highlight! link @type TSType - highlight! link @type.builtin TSTypeBuiltin - highlight! link @uri TSURI - highlight! link @variable TSVariable - highlight! link @variable.builtin TSVariableBuiltin - endif - - hi IndentBlankLine guifg=#${c.base01} guibg=NONE gui=NONE guisp=NONE - - hi NvimTreeNormal guifg=#${c.base05} guibg=#${c.base00} gui=NONE guisp=NONE - - hi CmpItemAbbr guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi CmpItemAbbrDeprecated guifg=#${c.base03} guibg=NONE gui=NONE guisp=NONE - hi CmpItemAbbrMatch guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi CmpItemAbbrMatchFuzzy guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - hi CmpItemKind guifg=#${c.base0C} guibg=NONE gui=NONE guisp=NONE - hi CmpItemMenu guifg=#${c.base05} guibg=NONE gui=NONE guisp=NONE - - hi BufferCurrent guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferCurrentIndex guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferCurrentMod guifg=#${c.base0E} guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferCurrentSign guifg=#${c.base0B} guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferCurrentTarget guifg=#${c.base08} guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferCurrentIcon guifg=NONE guibg=#${c.base00} gui=NONE guisp=NONE - hi BufferVisible guifg=#${c.base0A} guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferVisibleIndex guifg=#${c.base0A} guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferVisibleMod guifg=#${c.base0E} guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferVisibleSign guifg=#${c.base0A} guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferVisibleTarget guifg=#${c.base08} guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferVisibleIcon guifg=NONE guibg=#${c.base01} gui=NONE guisp=NONE - hi BufferInactive guifg=#${c.base04} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferInactiveIndex guifg=#${c.base05} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferInactiveMod guifg=#${c.base0E} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferInactiveSign guifg=#${c.base05} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferInactiveTarget guifg=#${c.base08} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferInactiveIcon guifg=NONE guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferTabpages guifg=#${c.base03} guibg=#${c.base02} gui=NONE guisp=NONE - hi BufferTabpageFill guifg=#${c.base03} guibg=#${c.base02} gui=NONE guisp=NONE - - hi NvimInternalError guifg=#${c.base00} guibg=#${c.base08} gui=NONE guisp=NONE - - hi NormalFloat guifg=#${c.base05} guibg=#${c.base00} gui=NONE guisp=NONE - hi FloatBorder guifg=#${c.base05} guibg=#${c.base00} gui=NONE guisp=NONE - hi NormalNC guifg=#${c.base05} guibg=#${c.base00} gui=NONE guisp=NONE - hi TermCursor guifg=#${c.base00} guibg=#${c.base05} gui=NONE guisp=NONE - hi TermCursorNC guifg=#${c.base00} guibg=#${c.base05} gui=NONE guisp=NONE - - hi User1 guifg=#${c.base08} guibg=#${c.base02} gui=NONE guisp=NONE - hi User2 guifg=#${c.base0E} guibg=#${c.base02} gui=NONE guisp=NONE - hi User3 guifg=#${c.base05} guibg=#${c.base02} gui=NONE guisp=NONE - hi User4 guifg=#${c.base0C} guibg=#${c.base02} gui=NONE guisp=NONE - hi User5 guifg=#${c.base01} guibg=#${c.base02} gui=NONE guisp=NONE - hi User6 guifg=#${c.base05} guibg=#${c.base02} gui=NONE guisp=NONE - hi User7 guifg=#${c.base05} guibg=#${c.base02} gui=NONE guisp=NONE - hi User8 guifg=#${c.base00} guibg=#${c.base02} gui=NONE guisp=NONE - hi User9 guifg=#${c.base00} guibg=#${c.base02} gui=NONE guisp=NONE - - hi TreesitterContext guifg=NONE guibg=#${c.base01} gui=NONE guisp=NONE "was italic - - let g:terminal_color_background = "#${c.base00}" - let g:terminal_color_foreground = "#${c.base05}" - - let g:terminal_color_0 = "#${c.base00}" - let g:terminal_color_1 = "#${c.base08}" - let g:terminal_color_2 = "#${c.base0B}" - let g:terminal_color_3 = "#${c.base0A}" - let g:terminal_color_4 = "#${c.base0D}" - let g:terminal_color_5 = "#${c.base0E}" - let g:terminal_color_6 = "#${c.base0C}" - let g:terminal_color_7 = "#${c.base05}" - let g:terminal_color_8 = "#${c.base03}" - let g:terminal_color_9 = "#${c.base08}" - let g:terminal_color_10 = "#${c.base0B}" - let g:terminal_color_11 = "#${c.base0A}" - let g:terminal_color_12 = "#${c.base0D}" - let g:terminal_color_13 = "#${c.base0E}" - let g:terminal_color_14 = "#${c.base0C}" - let g:terminal_color_15 = "#${c.base07}" -'' diff --git a/home-manager/_mixins/nvim/ui.nix b/home-manager/_mixins/nvim/ui.nix deleted file mode 100644 index a17b64b..0000000 --- a/home-manager/_mixins/nvim/ui.nix +++ /dev/null @@ -1,128 +0,0 @@ -{ pkgs, ... }: { - programs.neovim.plugins = with pkgs.vimPlugins; [ - # UI - vim-illuminate - vim-numbertoggle - # vim-markology - { - plugin = vim-fugitive; - type = "viml"; - config = /* vim */ '' - nmap G :Git - ''; - } - { - plugin = nvim-bqf; - type = "lua"; - config = /* lua * */ '' - require('bqf').setup{} - ''; - } - { - plugin = alpha-nvim; - type = "lua"; - config = /* lua */ '' - local alpha = require("alpha") - local dashboard = require("alpha.themes.dashboard") - - dashboard.section.header.val = { - " ", - " ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ", - " ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ", - " ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ", - " ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ", - " ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ", - " ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ", - " ", - } - dashboard.section.header.opts.hl = "Title" - - dashboard.section.buttons.val = { - dashboard.button( "n", "󰈔 New file" , ":enew"), - dashboard.button( "e", " Explore", ":Explore"), - dashboard.button( "g", " Git summary", ":Git | :only"), - dashboard.button( "c", " Nix config flake" , ":cd ~/Documents/NixConfig | :e flake.nix"), - dashboard.button( "q", "󰅙 Quit nvim", ":qa"), - } - - alpha.setup(dashboard.opts) - vim.keymap.set("n", "a", ":Alpha", { desc = "Open alpha dashboard" }) - ''; - } - { - plugin = bufferline-nvim; - type = "lua"; - config = /* lua */ '' - require('bufferline').setup{} - ''; - } - { - plugin = scope-nvim; - type = "lua"; - config = /* lua */ '' - require('scope').setup{} - ''; - } - { - plugin = which-key-nvim; - type = "lua"; - config = /* lua */ '' - require('which-key').setup{} - ''; - } - { - plugin = range-highlight-nvim; - type = "lua"; - config = /* lua */ '' - require('range-highlight').setup{} - ''; - } - { - plugin = indent-blankline-nvim; - type = "lua"; - config = /* lua */ '' - require('indent_blankline').setup{char_highlight_list={'IndentBlankLine'}} - ''; - } - { - plugin = nvim-web-devicons; - type = "lua"; - config = /* lua */ '' - require('nvim-web-devicons').setup{} - ''; - } - { - plugin = gitsigns-nvim; - type = "lua"; - config = /* lua */ '' - require('gitsigns').setup{ - signs = { - add = { text = '+' }, - change = { text = '~' }, - delete = { text = '_' }, - topdelete = { text = '‾' }, - changedelete = { text = '~' }, - }, - } - ''; - } - { - plugin = nvim-colorizer-lua; - type = "lua"; - config = /* lua */ '' - require('colorizer').setup{} - ''; - } - { - plugin = fidget-nvim; - type = "lua"; - config = /* lua */ '' - require('fidget').setup{ - text = { - spinner = "dots", - }, - } - ''; - } - ]; -} diff --git a/home-manager/_mixins/pass/default.nix b/home-manager/_mixins/pass/default.nix deleted file mode 100644 index 98aef4b..0000000 --- a/home-manager/_mixins/pass/default.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs, config, username, ... }: { - programs.password-store = { - enable = true; - settings = { PASSWORD_STORE_DIR = "$HOME/.password-store"; }; - package = pkgs.pass.withExtensions (p: [ p.pass-otp ]); - }; - - services.pass-secret-service = { - enable = true; - storePath = "${config.home.homeDirectory}/.password-store"; - extraArgs = [ "-e${config.programs.password-store.package}/bin/pass" ]; - }; - - home.persistence = { - "/persist/home/${username}".directories = [ ".password-store" ]; - }; -} diff --git a/home-manager/_mixins/productivity/default.nix b/home-manager/_mixins/productivity/default.nix deleted file mode 100644 index 0c3a5e8..0000000 --- a/home-manager/_mixins/productivity/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ - imports = [ - ./khal.nix - ./khard.nix - ./todoman.nix - ./vdirsyncer.nix - - ./mail.nix - ./neomutt.nix - - # Pass feature is required - ../pass - ]; -} diff --git a/home-manager/_mixins/productivity/khal.nix b/home-manager/_mixins/productivity/khal.nix deleted file mode 100644 index eacb9ec..0000000 --- a/home-manager/_mixins/productivity/khal.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ khal ]; - xdg.configFile."khal/config".text = '' - [calendars] - - [[calendars]] - path = ~/Calendars/* - type = discover - - [locale] - timeformat = %H:%M - dateformat = %d/%m/%Y - ''; -} diff --git a/home-manager/_mixins/productivity/khard.nix b/home-manager/_mixins/productivity/khard.nix deleted file mode 100644 index 933e195..0000000 --- a/home-manager/_mixins/productivity/khard.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ khard ]; - xdg.configFile."khard/khard.conf".text = '' - [addressbooks] - [[contacts]] - path = ~/Contacts/Main - ''; -} diff --git a/home-manager/_mixins/productivity/mail.nix b/home-manager/_mixins/productivity/mail.nix deleted file mode 100644 index fd2ba09..0000000 --- a/home-manager/_mixins/productivity/mail.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ pkgs, config, ... }: - -let - mbsync = "${config.programs.mbsync.package}/bin/mbsync"; - pass = "${config.programs.password-store.package}/bin/pass"; - - common = rec { - realName = "Greg Burd"; - gpg = { - key = "D4BB42BE729AEFBD2EFEBF8822931AF7895E82DF"; - signByDefault = true; - }; - signature = { - showSignature = "append"; - text = '' - ${realName} - - https://burd.me - PGP: ${gpg.key} - ''; - }; - }; -in -{ - home.persistence = { - "/persist/home/${username}".directories = [ "Mail" ]; - }; - - accounts.email = { - maildirBasePath = "Mail"; - accounts = { - personal = rec { - primary = true; - address = "greg@burd.me"; - aliases = [ "gregburd@gmail.com" ]; - passwordCommand = "${pass} ${smtp.host}/${address}"; - - imap.host = "mail.burd.me"; - mbsync = { - enable = true; - create = "maildir"; - expunge = "both"; - }; - folders = { - inbox = "Inbox"; - drafts = "Drafts"; - sent = "Sent"; - trash = "Trash"; - }; - neomutt = { - enable = true; - extraMailboxes = [ "Archive" "Drafts" "Junk" "Sent" "Trash" ]; - }; - - msmtp.enable = true; - smtp.host = "mail.burd.me"; - userName = address; - } // common; - - symas = rec { - address = "gburd@symas.com"; - passwordCommand = "${pass} ${smtp.host}/${address}"; - - /* TODO: add imap (conditionally) - imap.host = "symas.zmailcloud.com"; - mbsync = { - enable = true; - create = "maildir"; - expunge = "both"; - }; - folders = { - inbox = "INBOX"; - trash = "Trash"; - }; - neomutt = { - enable = true; - }; - */ - - msmtp.enable = true; - smtp.host = "symas.zmailcloud.com"; - userName = address; - } // common; - }; - }; - - programs.mbsync.enable = true; - programs.msmtp.enable = true; - - systemd.user.services.mbsync = { - Unit = { Description = "mbsync synchronization"; }; - Service = - let gpgCmds = import ../cli/gpg-commands.nix { inherit pkgs; }; - in - { - Type = "oneshot"; - ExecCondition = '' - /bin/sh -c "${gpgCmds.isUnlocked}" - ''; - ExecStart = "${mbsync} -a"; - }; - }; - systemd.user.timers.mbsync = { - Unit = { Description = "Automatic mbsync synchronization"; }; - Timer = { - OnBootSec = "30"; - OnUnitActiveSec = "5m"; - }; - Install = { WantedBy = [ "timers.target" ]; }; - }; -} diff --git a/home-manager/_mixins/productivity/neomutt.nix b/home-manager/_mixins/productivity/neomutt.nix deleted file mode 100644 index 3378414..0000000 --- a/home-manager/_mixins/productivity/neomutt.nix +++ /dev/null @@ -1,232 +0,0 @@ -{ config, pkgs, lib, ... }: { - xdg = { - desktopEntries = { - neomutt = { - name = "Neomutt"; - genericName = "Email Client"; - comment = "Read and send emails"; - exec = "neomutt %U"; - icon = "mutt"; - terminal = true; - categories = [ "Network" "Email" "ConsoleOnly" ]; - type = "Application"; - mimeType = [ "x-scheme-handler/mailto" ]; - }; - }; - mimeApps.defaultApplications = { - "x-scheme-handler/mailto" = "neomutt.desktop"; - }; - }; - - programs.neomutt = { - enable = true; - vimKeys = true; - checkStatsInterval = 60; - sidebar = { - enable = true; - width = 30; - }; - settings = { - mark_old = "no"; - text_flowed = "yes"; - reverse_name = "yes"; - query_command = ''"khard email --parsable '%s'"''; - }; - binds = [ - { - action = "sidebar-toggle-visible"; - key = "\\\\"; - map = [ "index" "pager" ]; - } - { - action = "group-reply"; - key = "L"; - map = [ "index" "pager" ]; - } - { - action = "toggle-new"; - key = "B"; - map = [ "index" ]; - } - ]; - macros = - let - browserpipe = - "cat /dev/stdin > /tmp/muttmail.html && xdg-open /tmp/muttmail.html"; - in - [ - { - action = ""; - key = "J"; - map = [ "index" "pager" ]; - } - { - action = ""; - key = "K"; - map = [ "index" "pager" ]; - } - { - action = - ":set confirmappend=no\\n+Archive:set confirmappend=yes\\n"; - key = "A"; - map = [ "index" "pager" ]; - } - { - action = "${browserpipe}"; - key = "V"; - map = [ "attach" ]; - } - { - action = "${pkgs.urlscan}/bin/urlscan"; - key = "F"; - map = [ "pager" ]; - } - { - action = - "html${browserpipe}"; - key = "V"; - map = [ "index" "pager" ]; - } - ]; - extraConfig = - let - # Collect all addresses and aliases - addresses = lib.flatten (lib.mapAttrsToList (_n: v: [ v.address ] ++ v.aliases) config.accounts.email.accounts); - in - '' - alternates "${lib.concatStringsSep "|" addresses}" - '' + '' - # From: https://github.com/altercation/mutt-colors-solarized/blob/master/mutt-colors-solarized-dark-16.muttrc - - # basic colors --------------------------------------------------------- - color normal brightyellow default - color error red default - color tilde black default - color message cyan default - color markers red white - color attachment white default - color search brightmagenta default - color status brightyellow black - color indicator brightblack yellow - color tree cyan default # arrow in threads - - # basic monocolor screen - mono bold bold - mono underline underline - mono indicator reverse - mono error bold - - # index ---------------------------------------------------------------- - - color index red default "~A" # all messages - color index blue default "~N" # new messages - color index brightred default "~E" # expired messages - color index blue default "~N" # new messages - color index blue default "~O" # old messages - color index brightmagenta default "~Q" # messages that have been replied to - color index brightgreen default "~R" # read messages - color index blue default "~U" # unread messages - color index blue default "~U~$" # unread, unreferenced messages - color index cyan default "~v" # messages part of a collapsed thread - color index magenta default "~P" # messages from me - color index cyan default "~p!~F" # messages to me - color index cyan default "~N~p!~F" # new messages to me - color index cyan default "~U~p!~F" # unread messages to me - color index brightgreen default "~R~p!~F" # messages to me - color index red default "~F" # flagged messages - color index red default "~F~p" # flagged messages to me - color index red default "~N~F" # new flagged messages - color index red default "~N~F~p" # new flagged messages to me - color index red default "~U~F~p" # new flagged messages to me - color index brightcyan default "~v~(!~N)" # collapsed thread with no unread - color index yellow default "~v~(~N)" # collapsed thread with some unread - color index green default "~N~v~(~N)" # collapsed thread with unread parent - color index red black "~v~(~F)!~N" # collapsed thread with flagged, no unread - color index yellow black "~v~(~F~N)" # collapsed thread with some unread & flagged - color index green black "~N~v~(~F~N)" # collapsed thread with unread parent & flagged - color index green black "~N~v~(~F)" # collapsed thread with unread parent, no unread inside, but some flagged - color index cyan black "~v~(~p)" # collapsed thread with unread parent, no unread inside, some to me directly - color index yellow red "~v~(~D)" # thread with deleted (doesn't differentiate between all or partial) - color index yellow default "~(~N)" # messages in threads with some unread - color index green default "~S" # superseded messages - color index black red "~D" # deleted messages - color index black red "~N~D" # deleted messages - color index red default "~T" # tagged messages - - # message headers ------------------------------------------------------ - - color hdrdefault brightgreen default - color header brightyellow default "^(From)" - color header blue default "^(Subject)" - - # body ----------------------------------------------------------------- - - color quoted blue default - color quoted1 cyan default - color quoted2 yellow default - color quoted3 red default - color quoted4 brightred default - - color signature brightgreen default - color bold black default - color underline black default - color normal default default - color body brightcyan default "[;:][-o][)/(|]" # emoticons - color body brightcyan default "[;:][)(|]" # emoticons - color body brightcyan default "[*]?((N)?ACK|CU|LOL|SCNR|BRB|BTW|CWYL|\ - |FWIW|vbg|GD&R|HTH|HTHBE|IMHO|IMNSHO|\ - |IRL|RTFM|ROTFL|ROFL|YMMV)[*]?" - color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon? - color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon? - - ## pgp - - color body red default "(BAD signature)" - color body cyan default "(Good signature)" - color body brightblack default "^gpg: Good signature .*" - color body brightyellow default "^gpg: " - color body brightyellow red "^gpg: BAD signature from.*" - mono body bold "^gpg: Good signature" - mono body bold "^gpg: BAD signature from.*" - - # yes, an insance URL regex - color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]" - # and a heavy handed email regex - color body magenta default "((@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]),)*@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]\\]):)?[0-9a-z_.+%$-]+@(([0-9a-z-]+\\.)*[0-9a-z-]+\\.?|#[0-9]+|\\[[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\.[0-2]?[0-9]?[0-9]\\])" - - # Various smilies and the like - color body brightwhite default "<[Gg]>" # - color body brightwhite default "<[Bb][Gg]>" # - color body yellow default " [;:]-*[})>{(<|]" # :-) etc... - # *bold* - color body blue default "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" - mono body bold "(^|[[:space:][:punct:]])\\*[^*]+\\*([[:space:][:punct:]]|$)" - # _underline_ - color body blue default "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" - mono body underline "(^|[[:space:][:punct:]])_[^_]+_([[:space:][:punct:]]|$)" - # /italic/ (Sometimes gets directory names) - color body blue default "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" - mono body underline "(^|[[:space:][:punct:]])/[^/]+/([[:space:][:punct:]]|$)" - - # Border lines. - color body blue default "( *[-+=#*~_]){6,}" - - # From https://github.com/jessfraz/dockerfiles/blob/master/mutt/.mutt/mutt-patch-highlighting.muttrc - color body cyan default ^(Signed-off-by).* - color body cyan default ^(Docker-DCO-1.1-Signed-off-by).* - color body brightwhite default ^(Cc) - color body yellow default "^diff \-.*" - color body brightwhite default "^index [a-f0-9].*" - color body brightblue default "^---$" - color body white default "^\-\-\- .*" - color body white default "^[\+]{3} .*" - color body green default "^[\+][^\+]+.*" - color body red default "^\-[^\-]+.*" - color body brightblue default "^@@ .*" - color body green default "LGTM" - color body brightmagenta default "-- Commit Summary --" - color body brightmagenta default "-- File Changes --" - color body brightmagenta default "-- Patch Links --" - ''; - }; -} diff --git a/home-manager/_mixins/productivity/todoman.nix b/home-manager/_mixins/productivity/todoman.nix deleted file mode 100644 index 0ee8e2a..0000000 --- a/home-manager/_mixins/productivity/todoman.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: { - home.packages = with pkgs; [ todoman ]; - xdg.configFile."todoman/config.py".text = '' - path = "~/Calendars/*" - default_list = "Personal" - date_format = "%d/%m/%Y" - time_format = "%H:%M" - humanize = True - default_due = 0 - ''; -} diff --git a/home-manager/_mixins/productivity/vdirsyncer.nix b/home-manager/_mixins/productivity/vdirsyncer.nix deleted file mode 100644 index 7cd7930..0000000 --- a/home-manager/_mixins/productivity/vdirsyncer.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ pkgs, config, ... }: -let - pass = "${config.programs.password-store.package}/bin/pass"; -in -{ - home.packages = with pkgs; [ vdirsyncer ]; - - home.persistence = { - "/persist/home/${username}".directories = - [ "Calendars" "Contacts" ".local/share/vdirsyncer" ]; - }; - - xdg.configFile."vdirsyncer/config".text = '' - [general] - status_path = "~/.local/share/vdirsyncer/status" - - [pair contacts] - a = "contacts_local" - b = "contacts_remote" - collections = ["from a", "from b"] - conflict_resolution = "b wins" - - [storage contacts_local] - type = "filesystem" - path = "~/Contacts" - fileext = ".vcf" - - [storage contacts_remote] - type = "carddav" - url = "https://dav.burd.me" - username = "greg@burd.me" - password.fetch = ["command", "${pass}", "mail.burd.me/greg@burd.me"] - - [pair calendars] - a = "calendars_local" - b = "calendars_remote" - collections = ["from a", "from b"] - metadata = ["color"] - conflict_resolution = "b wins" - - [storage calendars_local] - type = "filesystem" - path = "~/Calendars" - fileext = ".ics" - - [storage calendars_remote] - type = "caldav" - url = "https://dav.burd.me" - username = "greg@burd.me" - password.fetch = ["command", "${pass}", "mail.burd.me/greg@burd.me"] - ''; - - systemd.user.services.vdirsyncer = { - Unit = { Description = "vdirsyncer synchronization"; }; - Service = - let gpgCmds = import ../cli/gpg-commands.nix { inherit pkgs; }; - in - { - Type = "oneshot"; - ExecCondition = '' - /bin/sh -c "${gpgCmds.isUnlocked}" - ''; - ExecStart = "${pkgs.vdirsyncer}/bin/vdirsyncer sync"; - }; - }; - systemd.user.timers.vdirsyncer = { - Unit = { Description = "Automatic vdirsyncer synchronization"; }; - Timer = { - OnBootSec = "30"; - OnUnitActiveSec = "5m"; - }; - Install = { WantedBy = [ "timers.target" ]; }; - }; -} diff --git a/home-manager/_mixins/rgb/default.nix b/home-manager/_mixins/rgb/default.nix deleted file mode 100644 index 838da0e..0000000 --- a/home-manager/_mixins/rgb/default.nix +++ /dev/null @@ -1,28 +0,0 @@ -{ config, ... }: -let inherit (config.colorscheme) colors; -in { - services.rgbdaemon = { - enable = true; - daemons = { - swayLock = true; - mute = true; - player = true; - }; - colors = { - background = "${colors.base00}"; - foreground = "${colors.base05}"; - secondary = "${colors.base0B}"; - tertiary = "${colors.base0E}"; - quaternary = "${colors.base05}"; - }; - keyboard = { - device = "/dev/input/ckb1/cmd"; - highlighted = [ "h" "j" "k" "l" "w" "a" "s" "d" "m3" "g11" "profswitch" "lwin" "rwin" ]; - }; - mouse = { - device = "/dev/input/ckb2/cmd"; - dpi = 750; - highlighted = [ "wheel" "thumb" ]; - }; - }; -} diff --git a/home-manager/_mixins/services/keybase.nix b/home-manager/_mixins/services/keybase.nix index 9844ac4..202215f 100644 --- a/home-manager/_mixins/services/keybase.nix +++ b/home-manager/_mixins/services/keybase.nix @@ -1,6 +1,6 @@ { desktop, lib, ... }: { - imports = [ ] ++ lib.optionals (desktop != null) [ - ./keybase-gui.nix + imports = lib.optionals (desktop != null) [ + ../desktop/keybase.nix ]; services = { diff --git a/home-manager/_mixins/services/mpris-proxy.nix b/home-manager/_mixins/services/mpris-proxy.nix new file mode 100644 index 0000000..c13ae41 --- /dev/null +++ b/home-manager/_mixins/services/mpris-proxy.nix @@ -0,0 +1,4 @@ +_: { + # https://nixos.wiki/wiki/Bluetooth#Using_Bluetooth_headsets_with_PulseAudio + services.mpris-proxy.enable = true; +} diff --git a/home-manager/_mixins/services/syncthing-tray.nix b/home-manager/_mixins/services/syncthing-tray.nix deleted file mode 100644 index fc14743..0000000 --- a/home-manager/_mixins/services/syncthing-tray.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ pkgs, ... }: { - services.syncthing = { - tray = { - enable = true; - package = pkgs.unstable.syncthingtray; - }; - }; -} diff --git a/home-manager/_mixins/services/syncthing.nix b/home-manager/_mixins/services/syncthing.nix index de627d0..1b16187 100644 --- a/home-manager/_mixins/services/syncthing.nix +++ b/home-manager/_mixins/services/syncthing.nix @@ -1,16 +1,16 @@ -{ config, desktop, hostname, lib, ... }: { - imports = [ ] ++ lib.optionals (desktop != null) [ - ./syncthing-tray.nix - ]; - +{ hostname, pkgs, username, ... }: { services.syncthing = { enable = true; extraOptions = [ - "--config=${config.home.homeDirectory}/Syncthing/Devices/${hostname}" - "--data=${config.home.homeDirectory}/Syncthing/DB/${hostname}" + "--config=/home/${username}/Syncthing/Devices/${hostname}" + "--data=/home/${username}/Syncthing/DB/${hostname}" "--gui-address=0.0.0.0:8384" "--no-default-folder" "--no-browser" ]; + tray = { + enable = true; + package = pkgs.unstable.syncthingtray; + }; }; } diff --git a/home-manager/_mixins/users/_gburd/default.nix b/home-manager/_mixins/users/_gburd/default.nix index f84f8ee..2457787 100644 --- a/home-manager/_mixins/users/_gburd/default.nix +++ b/home-manager/_mixins/users/_gburd/default.nix @@ -77,7 +77,7 @@ }, "vscode-neovim.neovimExecutablePaths.linux": "/home/gburd/.nix-profile/bin/nvim", } - ''; + ''; file.".config/alacritty/alacritty.yml".source = ./alacritty.yml; @@ -133,8 +133,7 @@ enableDebugInfo = true; }; - programs = { - }; + programs = { }; systemd.user.tmpfiles.rules = [ "d ${config.home.homeDirectory}/ws 0755 ${username} users - -" diff --git a/home-manager/_mixins/users/_gburd/desktop.nix b/home-manager/_mixins/users/_gburd/desktop.nix index d73ae91..eca6e92 100644 --- a/home-manager/_mixins/users/_gburd/desktop.nix +++ b/home-manager/_mixins/users/_gburd/desktop.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ lib, ... }: with lib.hm.gvariant; { imports = [ diff --git a/home-manager/_mixins/users/gburd/default.nix b/home-manager/_mixins/users/gburd/default.nix index d73301c..fdfc08a 100644 --- a/home-manager/_mixins/users/gburd/default.nix +++ b/home-manager/_mixins/users/gburd/default.nix @@ -1,430 +1,89 @@ -{ inputs, config, pkgs, username, ... }: { +{ lib, hostname, inputs, platform, pkgs, ... }: +let + systemInfo = lib.splitString "-" platform; + systemType = builtins.elemAt systemInfo 1; +in +{ imports = [ inputs.impermanence.nixosModules.home-manager.impermanence - ../../pass ../../cli - ../../nvim - # TODO: - # ../../productivity - # ../../games - ]; + #../../console/charm-freeze.nix + ] + ++ lib.optional (builtins.pathExists (./. + "/hosts/${hostname}.nix")) ./hosts/${hostname}.nix + ++ lib.optional (builtins.pathExists (./. + "/hosts/${hostname}/default.nix")) ./hosts/${hostname}/default.nix + ++ lib.optional (builtins.pathExists (./. + "/systems/${systemType}.nix")) ./systems/${systemType}.nix; home = { - persistence = { - "/persist/home/gburd" = { - directories = [ - "Documents" - "Downloads" - "Pictures" - "Videos" - ".local/bin" - ".config" - ]; - allowOther = true; - }; - }; - - file.".face".source = ./face.png; - - file.".ssh/config".text = '' - Host burd.me *.burd.me *.ts.burd.me - ForwardAgent yes - Host floki - ForwardAgent yes - RemoteForward /%d/.gnupg-sockets/S.gpg-agent /%d/.gnupg-sockets/S.gpg-agent.extra - - Host * - ForwardAgent no - Compression no - ServerAliveInterval 0 - ServerAliveCountMax 3 - HashKnownHosts no - UserKnownHostsFile ~/.ssh/known_hosts - ControlMaster no - ControlPath ~/.ssh/master-%r@%n:%p - ControlPersist no - + file."ws/devshells".source = inputs.devshells; + file.".ssh/config".text = " Host github.com HostName github.com User git - ''; - - file."Quickemu/nixos-console.conf".text = '' - #!/run/current-system/sw/bin/quickemu --vm - guest_os="linux" - disk_img="nixos-console/disk.qcow2" - disk_size="96G" - iso="nixos-console/nixos.iso" - ''; - file."Quickemu/nixos-desktop.conf".text = '' - #!/run/current-system/sw/bin/quickemu --vm - guest_os="linux" - disk_img="nixos-desktop/disk.qcow2" - disk_size="96G" - iso="nixos-desktop/nixos.iso" - ''; - - file.".inputrc".text = '' - "\C-v": "" - set enable-bracketed-paste off - ''; - - file.".config/direnv/direnv.toml".text = '' - [global] - load_dotenv = true - ''; - - file.".gitconfig".text = '' - [user] - name = Greg Burd - email = greg@burd.me - - [color] - ui = auto - diff = auto - status = auto - branch = auto - - [alias] - st = status --short - ci = commit - co = checkout - di = diff - dc = diff --cached - amend = commit --amend - aa = add --all - head = !git l -1 - h = !git head - r = !git --no-pager l -20 - ra = !git r --all - ff = merge --ff-only - pullff = pull --ff-only - l = log --graph --abbrev-commit --date=relative - la = !git l --all - div = divergence - gn = goodness - gnc = goodness --cached - fa = fetch --all - pom = push origin master - files = show --oneline - graph = log --graph --decorate --all - lol = log --graph --decorate --pretty=oneline --abbrev-commit - lola = log --graph --decorate --pretty=oneline --abbrev-commit --all - lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative - sync = pull --rebase - update = merge --ff-only origin/master - mend = commit --amend --no-edit - unadd = reset -- - unedit = checkout -- - unstage = reset HEAD - unrm = checkout -- - unstash = stash pop - lastchange = log -n 1 -p - dag = log --graph --format='format:%C(yellow)%h%C(reset) %C(blue)\"%an\" <%ae>%C(reset) %C(magenta)%cr%C(reset)%C(auto)%d%C(reset)%n%s' --date-order - subdate = submodule update --init --recursive - - [format] - pretty=format:%C(yellow)%h%Creset | %C(green)%ad (%ar)%Creset | %C(blue)%an%Creset | %s - - [push] - default = simple - autoSetupRemote = true - - [branch] - autosetuprebase = always - - [receive] - denyCurrentBranch = warn - - [filter "media"] - clean = git media clean %f - smudge = git media smudge %f - required = true - - # http://nicercode.github.io/blog/2013-04-30-excel-and-line-endings/ - [filter "cr"] - clean = LC_CTYPE=C awk '{printf(\"%s\\n\", $0)}' | LC_CTYPE=C tr '\\r' '\\n' - smudge = tr '\\n' '\\r' - - [diff] - tool = meld - [difftool] - prompt = false - [difftool "meld"] - cmd = meld "$LOCAL" "$REMOTE" - - [merge] - tool = meld - [mergetool "meld"] - # Choose one of these 2 lines (not both!) explained below. - cmd = meld "$LOCAL" "$MERGED" "$REMOTE" --output "$MERGED" - cmd = meld "$LOCAL" "$BASE" "$REMOTE" --output "$MERGED" - - [core] - editor = nvim - # editor = emacs -nw -q - excludesfile = ~/.gitignore_global - pager = less -FMRiX - quotepath = false - - [filter "lfs"] - process = git-lfs filter-process - required = true - clean = git-lfs clean -- %f - smudge = git-lfs smudge -- %f - - [init] - templateDir = /home/gregburd/.git-template - defaultBranch = main - [commit] - # gpgsign = true - ''; - - file.".config/Code/User/settings.json".text = '' + "; + sessionVariables = { + # ... + }; + file.".config/nixpkgs/config.nix".text = '' { - "editor.inlineSuggest.enabled": true, - "editor.fontFamily": "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace", - "editor.fontLigatures": true, - "cSpell.userWords": [ - "Burd", - "Wpedantic", - "Wvariadic" - ], - "files.watcherExclude": { - "**/.bloop": true, - "**/.metals": true, - "**/.ammonite": true - }, - "extensions.experimental.affinity": { - "asvetliakov.vscode-neovim": 1 - }, - "vscode-neovim.neovimExecutablePaths.linux": "/home/gburd/.nix-profile/bin/nvim", + allowUnfree = true; } ''; - file.".config/Code/User/keybindings.json".text = '' - // Place your key bindings in this file to override the defaults - [ - // allow arrow keys to work in the find widget - { - "key": "right", - "command": "-emacs-mcx.isearchExit" - }, - { - "key": "left", - "command": "-emacs-mcx.isearchExit" - }, - { - "key": "up", - "command": "-emacs-mcx.isearchExit" - }, - { - "key": "down", - "command": "-emacs-mcx.isearchExit" - }, - // allow ctrl+f to find next in the find widget - { - "key": "ctrl+f", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - // allow other stuff to functional normally in the find widget - { - "key": "ctrl+b", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - { - "key": "ctrl+p", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - { - "key": "ctrl+n", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - { - "key": "ctrl+a", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - { - "key": "ctrl+e", - "command": "-emacs-mcx.isearchExit", - "when": "editorFocus && findWidgetVisible" - }, - { - "key": "enter", - "command": "-emacs-mcx.isearchExit" - }, - // allow curly quotes and ellipses characters on mac - { - "key": "alt+shift+[", - "command": "-emacs-mcx.backwardParagraph" - }, - { - "key": "alt+shift+]", - "command": "-emacs-mcx.forwardParagraph" - }, - { - "key": "alt+;", - "command": "-editor.action.blockComment", - "when": "editorTextFocus && !config.emacs-mcx.useMetaPrefixMacCmd && !editorReadonly" - }, - { - "key": "alt+;", - "command": "-emacs-mcx.executeCommands", - "when": "editorFocus && findWidgetVisible && !config.emacs-mcx.useMetaPrefixMacCmd" - }, - // stop backward kill word from adding to clipboard - { - "key": "alt+backspace", - "command": "-emacs-mcx.backwardKillWord", - "when": "editorTextFocus && !config.emacs-mcx.useMetaPrefixMacCmd && !editorReadonly" - } - ] - ''; - - file.".config/nvim/init.nvim".source = ./init.nvim; - - # file.".config/sublime-text-2/Local/License.sublime_license".text = - # config.sops.secrets.sublime-licenses.text.path; - - # file.".config/sublime-merge/Local/License.sublime_license".text = - # config.sops.secrets.sublime-licenses.merge.path; - - # A Modern Unix experience - # https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/ - packages = with pkgs; [ - asciinema # Terminal recorder - black # Code format Python - bmon # Modern Unix `iftop` - breezy # Terminal bzr client - butler # Terminal Itch.io API client - chafa # Terminal image viewer - chroma # Code syntax highlighter - clinfo # Terminal OpenCL info - curlie # Terminal HTTP client - dconf2nix # Nix code from Dconf files - debootstrap # Terminal Debian installer - diffr # Modern Unix `diff` - difftastic # Modern Unix `diff` - dogdns # Modern Unix `dig` - dua # Modern Unix `du` - duf # Modern Unix `df` - du-dust # Modern Unix `du` - entr # Modern Unix `watch` - fast-cli # Terminal fast.com - fd # Modern Unix `find` - glow # Terminal Markdown renderer - gping # Modern Unix `ping` - hexyl # Modern Unix `hexedit` - httpie # Terminal HTTP client - hyperfine # Terminal benchmarking - iperf3 # Terminal network benchmarking - iw # Terminal WiFi info - jpegoptim # Terminal JPEG optimizer - jiq # Modern Unix `jq` - lazygit # Terminal Git client - libva-utils # Terminal VAAPI info - lurk # Modern Unix `strace` - mdp # Terminal Markdown presenter - #moar # Modern Unix `less` - mtr # Modern Unix `traceroute` - netdiscover # Modern Unix `arp` - nethogs # Modern Unix `iftop` - nixpkgs-review # Nix code review - nodePackages.prettier # Code format - nurl # Nix URL fetcher - nyancat # Terminal rainbow spewing feline - speedtest-go # Terminal speedtest.net - optipng # Terminal PNG optimizer - procs # Modern Unix `ps` - python310Packages.gpustat # Terminal GPU info - quilt # Terminal patch manager - ripgrep # Modern Unix `grep` - rustfmt # Code format Rust - shellcheck # Code lint Shell - shfmt # Code format Shell - tldr # Modern Unix `man` - tokei # Modern Unix `wc` for code - vdpauinfo # Terminal VDPAU info - wavemon # Terminal WiFi monitor - yq-go # Terminal `jq` for YAML - - _1password - _1password-gui - cfssl - gnumake - cmake - autoconf - libtool - m4 - perl - pkg-config - python3 - gcc - gdb - dig - emacs - file - git-credential-1password - htop - openssl - plocate - ripgrep - tig - tree - lsof - unstable.flyctl - unstable.minio-client - unstable.element-desktop - erlang - rebar3 - elixir - ]; - sessionVariables = { - # PAGER = "moar"; - }; - - # http://rski.github.io/2021/09/05/nix-debugging.html - # https://github.com/nix-community/home-manager/commit/0056a5aea1a7b68bdacb7b829c325a1d4a3c4259 - enableDebugInfo = true; + packages = with pkgs; [ ]; }; + programs = { - bash = { - shellAliases = { - pubip = "curl -s ifconfig.me/ip"; # "curl -s https://api.ipify.org"; - speedtest = "speedtest-go"; - vi = "nvim"; - vim = "nvim"; - }; - }; fish = { - shellAliases = { - #diff = "diffr"; - #fast = "fast -u"; - #glow = "glow --pager"; - pubip = "curl -s ifconfig.me/ip"; # "curl -s https://api.ipify.org"; - speedtest = "speedtest-go"; - vi = "nvim"; - vim = "nvim"; - }; + enable = true; + interactiveShellInit = '' + set fish_cursor_default block blink + set fish_cursor_insert line blink + set fish_cursor_replace_one underscore blink + set fish_cursor_visual block + set -U fish_color_autosuggestion brblack + set -U fish_color_cancel -r + set -U fish_color_command green + set -U fish_color_comment brblack + set -U fish_color_cwd brgreen + set -U fish_color_cwd_root brred + set -U fish_color_end brmagenta + set -U fish_color_error red + set -U fish_color_escape brcyan + set -U fish_color_history_current --bold + set -U fish_color_host normal + set -U fish_color_match --background=brblue + set -U fish_color_normal normal + set -U fish_color_operator cyan + set -U fish_color_param blue + set -U fish_color_quote yellow + set -U fish_color_redirection magenta + set -U fish_color_search_match bryellow '--background=brblack' + set -U fish_color_selection white --bold '--background=brblack' + set -U fish_color_status red + set -U fish_color_user brwhite + set -U fish_color_valid_path --underline + set -U fish_pager_color_completion normal + set -U fish_pager_color_description yellow + set -U fish_pager_color_prefix white --bold --underline + set -U fish_pager_color_progress brwhite '--background=cyan' + ''; + + shellAliases = + let + # determines directory path of symbolic link + sh = target: "nix develop $(readlink -f ~/ws/devshells)#${target} --command \$SHELL"; + in + { + "sh:c" = sh "c"; + "sh:python" = sh "python"; + }; + }; + + git = { + userEmail = lib.mkDefault "greg@burd.me"; + userName = lib.mkDefault "Greg Burd"; }; }; - systemd.user.tmpfiles.rules = [ - "d ${config.home.homeDirectory}/ws 0755 ${username} users - -" - "d ${config.home.homeDirectory}/Dropbox 0755 ${username} users - -" - # "d ${config.home.homeDirectory}/Quickemu/nixos-console 0755 ${username} users - -" - # "d ${config.home.homeDirectory}/Quickemu/nixos-desktop 0755 ${username} users - -" - "d ${config.home.homeDirectory}/bin 0755 ${username} users - -" - "d ${config.home.homeDirectory}/Studio/OBS/config/obs-studio/ 0755 ${username} users - -" - # "d ${config.home.homeDirectory}/Syncthing 0755 ${username} users - -" - "d ${config.home.homeDirectory}/Websites 0755 ${username} users - -" - "L+ ${config.home.homeDirectory}/.config/obs-studio/ - - - - ${config.home.homeDirectory}/Studio/OBS/config/obs-studio/" - ]; - } diff --git a/home-manager/_mixins/users/gburd/hosts/floki.nix b/home-manager/_mixins/users/gburd/hosts/floki.nix index a658311..947ebcc 100644 --- a/home-manager/_mixins/users/gburd/hosts/floki.nix +++ b/home-manager/_mixins/users/gburd/hosts/floki.nix @@ -1,8 +1,108 @@ -{ lib, ... }: +{ lib, pkgs, ... }: with lib.hm.gvariant; { imports = [ ../../../desktop/vorta.nix + ../../../desktop/sublime.nix + ../../../desktop/sublime-merge.nix ]; dconf.settings = { }; + + home = { + persistence = { + "/persist/home/gburd" = { + directories = [ + "Documents" + "Downloads" + "Pictures" + "Videos" + ".local/bin" + ".config" + ]; + allowOther = true; + }; + }; + + file.".inputrc".text = '' + "\C-v": "" + set enable-bracketed-paste off + ''; + + file.".config/direnv/direnv.toml".text = '' + [global] + load_dotenv = true + ''; + + file.".config/Code/User/settings.json".text = '' + { + "editor.inlineSuggest.enabled": true, + "editor.fontFamily": "'FiraCode Nerd Font Mono', 'Droid Sans Mono', 'monospace', monospace", + "editor.fontLigatures": true, + "cSpell.userWords": [ + "Burd", + "Wpedantic", + "Wvariadic" + ], + "files.watcherExclude": { + "**/.bloop": true, + "**/.metals": true, + "**/.ammonite": true + }, + "extensions.experimental.affinity": { + "asvetliakov.vscode-neovim": 1 + }, + "vscode-neovim.neovimExecutablePaths.linux": "/home/gburd/.nix-profile/bin/nvim", + } + ''; + + # file.".config/Code/User/keybindings.json".text = '' + # // Place your key bindings in this file to override the defaults + # [ + # ] + # ''; + + # file.".config/sublime-text-2/Local/License.sublime_license".text = + # config.sops.secrets.sublime-licenses.text.path; + + # file.".config/sublime-merge/Local/License.sublime_license".text = + # config.sops.secrets.sublime-licenses.merge.path; + + packages = with pkgs; [ + # TODO: Move some of these into ../../../desktop/.nix files + _1password + _1password-gui + cfssl + gnumake + cmake + autoconf + libtool + m4 + perl + pkg-config + python3 + gcc + gdb + dig + emacs + file + git-credential-1password + htop + openssl + plocate + ripgrep + tig + tree + lsof + unstable.flyctl + unstable.minio-client + unstable.element-desktop + erlang + rebar3 + elixir + ]; + + # http://rski.github.io/2021/09/05/nix-debugging.html + # https://github.com/nix-community/home-manager/commit/0056a5aea1a7b68bdacb7b829c325a1d4a3c4259 + enableDebugInfo = true; + }; } diff --git a/home-manager/_mixins/users/gburd/ssh.pub b/home-manager/_mixins/users/gburd/ssh.pub deleted file mode 100644 index 7c07b31..0000000 --- a/home-manager/_mixins/users/gburd/ssh.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGSNy/vMr2Zk9pvfjQnxiU9F8CGQJwCiXDxPecKG9/q+ Greg Burd - 2023-01-23 diff --git a/home-manager/_mixins/users/gburd/symas-ssh.pub b/home-manager/_mixins/users/gburd/symas-ssh.pub deleted file mode 100644 index 310ba2f..0000000 --- a/home-manager/_mixins/users/gburd/symas-ssh.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDPvS6pE5Y8Yc3YnKpKinjVKyziqnb7JZJGonDKnZi3I Greg Burd - 2023-08-03 diff --git a/home-manager/_mixins/users/gburd/systems/darwin.nix b/home-manager/_mixins/users/gburd/systems/darwin.nix new file mode 100644 index 0000000..958608a --- /dev/null +++ b/home-manager/_mixins/users/gburd/systems/darwin.nix @@ -0,0 +1 @@ +_: { } diff --git a/home-manager/_mixins/users/gburd/systems/linux.nix b/home-manager/_mixins/users/gburd/systems/linux.nix new file mode 100644 index 0000000..2dac31a --- /dev/null +++ b/home-manager/_mixins/users/gburd/systems/linux.nix @@ -0,0 +1,38 @@ +{ username, ... }: { + imports = [ + ../../../desktop/audio-recorder.nix + ../../../desktop/celluloid.nix + ../../../desktop/dconf-editor.nix + ../../../desktop/gnome-sound-recorder.nix + ../../../desktop/tilix.nix + ../../../desktop/emote.nix + ]; + + home = { + file."Quickemu/nixos-console.conf".text = '' + #!/run/current-system/sw/bin/quickemu --vm + guest_os="linux" + disk_img="nixos-console/disk.qcow2" + disk_size="96G" + iso="nixos-console/nixos.iso" + ''; + file."Quickemu/nixos-desktop.conf".text = '' + #!/run/current-system/sw/bin/quickemu --vm + guest_os="linux" + disk_img="nixos-desktop/disk.qcow2" + disk_size="96G" + iso="nixos-desktop/nixos.iso" + ''; + file."Quickemu/nixos-nuc.conf".text = '' + #!/run/current-system/sw/bin/quickemu --vm + guest_os="linux" + disk_img="nixos-nuc/disk.qcow2" + disk_size="96G" + iso="nixos-nuc/nixos.iso" + ''; + }; + + systemd.user.tmpfiles.rules = [ + "d /home/${username}/ws 0755 ${username} users - -" + ]; +} diff --git a/home-manager/_mixins/users/nixos/default.nix b/home-manager/_mixins/users/nixos/default.nix new file mode 100644 index 0000000..f5476b8 --- /dev/null +++ b/home-manager/_mixins/users/nixos/default.nix @@ -0,0 +1,3 @@ +_: { + home.file.".face".source = ./face.png; +} diff --git a/home-manager/default.nix b/home-manager/default.nix index 67015bd..6df8f36 100644 --- a/home-manager/default.nix +++ b/home-manager/default.nix @@ -1,4 +1,4 @@ -{ config, desktop, hostname, inputs, lib, outputs, pkgs, stateVersion, username, ... }: +{ config, desktop, lib, inputs, outputs, pkgs, stateVersion, username, ... }: let inherit (pkgs.stdenv) isDarwin; in @@ -7,7 +7,7 @@ in # Only import user specific configuration if they have bespoke settings imports = [ # If you want to use modules your own flake exports (from modules/home-manager): - outputs.homeManagerModules.pass-secret-service + # outputs.homeManagerModules.example # Or modules exported from other flakes (such as nix-colors): # inputs.nix-colors.homeManagerModules.default @@ -15,19 +15,15 @@ in # You can also split up your configuration and import pieces of it here: ./_mixins/console ] - ++ lib.optional (builtins.isPath (./. + "/_mixins/users/${username}")) ./_mixins/users/${username} - ++ lib.optional (builtins.pathExists (./. + "/_mixins/users/${username}/hosts/${hostname}.nix")) ./_mixins/users/${username}/hosts/${hostname}.nix - ++ lib.optional (desktop != null) ./_mixins/desktop; + ++ lib.optional (builtins.isString desktop) ./_mixins/desktop + ++ lib.optional (builtins.isPath (./. + "/_mixins/users/${username}")) ./_mixins/users/${username}; home = { - activation.report-changes = config.lib.dag.entryAnywhere '' - ${pkgs.nvd}/bin/nvd diff $oldGenPath $newGenPath - ''; + # activation.report-changes = if isDarwin then "" else config.lib.dag.entryAnywhere '' + # ${pkgs.nvd}/bin/nvd diff $oldGenPath $newGenPath + # ''; homeDirectory = if isDarwin then "/Users/${username}" else "/home/${username}"; sessionPath = [ "$HOME/.local/bin" ]; - sessionVariables = { - FLAKE = "$HOME/ws/nix-config"; - }; inherit stateVersion; inherit username; }; @@ -41,6 +37,7 @@ in outputs.overlays.unstable-packages # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default inputs.agenix.overlays.default # Or define it inline, for example: @@ -60,11 +57,7 @@ in }; nix = { - # This will add each flake input as a registry - # To make nix3 commands consistent with your flake - registry = lib.mapAttrs (_: value: { flake = value; }) inputs; - - package = pkgs.unstable.nix; + package = lib.mkDefault pkgs.unstable.nix; settings = { auto-optimise-store = true; experimental-features = [ "nix-command" "flakes" ]; @@ -75,4 +68,3 @@ in }; }; } - diff --git a/hydra.nix b/hydra.nix deleted file mode 100644 index c0c264f..0000000 --- a/hydra.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ inputs, outputs }: -let - inherit (inputs.nixpkgs.lib) filterAttrs mapAttrs elem; - - notBroken = pkg: !(pkg.meta.broken or false); - hasPlatform = sys: pkg: elem sys (pkg.meta.platforms or [ ]); - filterValidPkgs = sys: filterAttrs (_: pkg: hasPlatform sys pkg && notBroken pkg); - getCfg = _: cfg: cfg.config.system.build.toplevel; -in -{ - pkgs = mapAttrs filterValidPkgs outputs.packages; - hosts = mapAttrs getCfg outputs.nixosConfigurations; -} diff --git a/lib/default.nix b/lib/default.nix index 58c69c4..53a7c91 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,13 @@ -{ inputs, outputs, stateVersion, ... }: +{ self, inputs, outputs, stateVersion, ... }: let - helpers = import ./helpers.nix { inherit inputs outputs stateVersion; }; + helpers = import ./helpers.nix { inherit self inputs outputs stateVersion; }; in { - inherit (helpers) mkHome; - inherit (helpers) mkHost; - inherit (helpers) forAllSystems; + inherit (helpers) + mkHome + mkHost + mkDarwin + mkRawImage + mkSdImage + forAllSystems; } diff --git a/lib/helpers.nix b/lib/helpers.nix index fe89a72..5464b23 100644 --- a/lib/helpers.nix +++ b/lib/helpers.nix @@ -1,29 +1,105 @@ -{ inputs, outputs, stateVersion, ... }: { +{ self, inputs, outputs, stateVersion, ... }: +let + sshMatrix = import ./ssh-matrix.nix { }; +in +{ # Helper function for generating home-manager configs mkHome = { hostname, username, desktop ? null, platform ? "x86_64-linux" }: inputs.home-manager.lib.homeManagerConfiguration { pkgs = inputs.nixpkgs.legacyPackages.${platform}; extraSpecialArgs = { - inherit inputs outputs desktop hostname platform username stateVersion; + inherit inputs outputs desktop hostname platform username stateVersion sshMatrix; }; modules = [ ../home-manager ]; }; # Helper function for generating host configs - mkHost = { hostname, username, desktop ? null, installer ? null, platform ? "x86_64-linux" }: inputs.nixpkgs.lib.nixosSystem { + # - installer: can be one of the following: + # - "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix" + # - "/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares.nix" + mkHost = { hostname, username, systemType, desktop ? null, installer ? null }: inputs.nixpkgs.lib.nixosSystem { specialArgs = { - inherit inputs outputs desktop hostname platform username stateVersion; + inherit inputs outputs desktop hostname username stateVersion systemType sshMatrix; }; modules = [ ../nixos inputs.agenix.nixosModules.default + # TODO: enable when services.displayManager is fixed + #inputs.chaotic.nixosModules.default ] ++ (inputs.nixpkgs.lib.optionals (installer != null) [ installer ]); }; + mkDarwin = { hostname, username, stateVersion ? 4, platform ? "aarch64-darwin" }: inputs.nix-darwin.lib.darwinSystem { + specialArgs = { + inherit self inputs outputs hostname username platform stateVersion sshMatrix; + }; + modules = [ + ../darwin + inputs.home-manager.darwinModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + } + ]; + }; + + mkSdImage = { hostname, username, platform ? "armv7l-linux" }: inputs.nixos-generators.nixosGenerate { + specialArgs = { + inherit self inputs outputs hostname username platform stateVersion sshMatrix; + }; + + system = platform; + format = + if platform == "armv7l-linux" + then "sd-armv7l-installer" + else "sd-aarch64-installer"; + + # pkgs = inputs.nixpkgs.legacyPackages."${platform}"; + # lib = inputs.nixpkgs.legacyPackages."${platform}".lib; + + modules = [ + ../nixos + inputs.agenix.nixosModules.default + ]; + }; + + mkRawImage = { hostname, username, systemType, desktop ? null, platform ? "x86_64-linux" }: inputs.nixos-generators.nixosGenerate { + specialArgs = { + inherit self inputs outputs desktop hostname username stateVersion systemType sshMatrix; + }; + + system = platform; + format = + if platform == "x86_64-linux" + then "raw-efi" + else "raw"; + + # pkgs = inputs.nixpkgs.legacyPackages."${platform}"; + # lib = inputs.nixpkgs.legacyPackages."${platform}".lib; + + modules = [ + ../nixos + inputs.agenix.nixosModules.default + { + boot.kernelParams = [ "console=tty0" ]; # enable physical display tty, not serial port + } + ]; + }; + + mkDroid = { hostname, username, platform ? "aarch64-linux" }: inputs.nix-on-droid.lib.nixOnDroidConfiguration { + specialArgs = { + inherit self inputs outputs hostname username platform stateVersion sshMatrix; + }; + modules = [ + ../android + ]; + }; + forAllSystems = inputs.nixpkgs.lib.genAttrs [ - "aarch64-linux" - "i686-linux" - "x86_64-linux" - "aarch64-darwin" - "x86_64-darwin" + "armv7l-linux" # 32-bit ARM Linux + "aarch64-linux" # 64-bit ARM Linux + "i686-linux" # 32-bit x86 Linux + "x86_64-linux" # 64-bit x86 Linux + "aarch64-darwin" # 64-bit ARM Darwin + "x86_64-darwin" # 64-bit x86 Darwin ]; } diff --git a/lib/ssh-matrix.nix b/lib/ssh-matrix.nix new file mode 100644 index 0000000..3855f1a --- /dev/null +++ b/lib/ssh-matrix.nix @@ -0,0 +1,58 @@ +_: +let + parseFriendlyKey = builtins.replaceStrings [ "\n" ] [ "" ]; +in +rec { + # user@host matrix + systems = { + floki.gburd = parseFriendlyKey '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGSNy/vMr2Zk9pvfjQnxiU9F8CGQ + JwCiXDxPecKG9/q+ Greg Burd - 2023-01-23 + ''; + + symas.gburd = parseFriendlyKey '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDPvS6pE5Y8Yc3YnKpKinjVKyziq + nb7JZJGonDKnZi3I Greg Burd - 2023-08-03 + ''; + + floki = { + host = parseFriendlyKey '' + ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKG7dVoHbOjQ/i45ATeli7mYLl1b + Q8zBKbmg5t9xi1Yl root@nixos + ''; + root = parseFriendlyKey '' + ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC8hXaBle8TPkKPa2vKcmfH66y+ + iW5YZn68COvLSdcstXZPOxErGcfp9oTS/HJdUctEVLygEAfVSTQst0q9xpyAqSyE + t8VqJiHXUZEwFs3erGT8yF+6EF6FueMqGynAUXNkGz9XKv02/w66AWWGekgc1B8A + VK0+aqeTES5PPlynUDpZIAhDm9C2zR5IgsUT68vxfodz0Srfjx6tXNwBShfIToky + ZznUOz9QVvN6bqaczYm2RxhuWyp2qVLUFSL2ksQErb2cq57Q5B7y+DIh5yJaELSs + Ghdzb+UAC/SsLYKRIJMCaT69XL8BogHdiTV4WPK0E5d3Xs6hBm5mHeawIRIKw0rv + xJG/Dtq2q7GwGQPHY8kgvvZBJYm9o9wExeWi0fz5ZzxtfMldZk1Exd1TDouXIrhz + jodAlL06s5h2QLMv3sDnn7AlfVyPcDE4qhAl5KLBO1/uD/RLG52Zw3jj+8B4UwHy + 4YxQbqFkk0t9TvASEY19REN6N6x+OPoHHWiJ5CCwik2QqY7cXoiQYqSQT8uhgqsc + xxt0Lfj+JScESoHsi8o4FNoIvuDu5V0jTG6Qou+UOU6KGRHpwokYgwnH5b+o29ce + 3WbujcLiSXsmu2+gP1231usgUfEz/uiutowROngAys8ivY3Zdoyu7qyWdZhie/e5 + BAPmRo042eWMzBWQbQ== root@nixos + ''; + }; + + # pixel6a = { + # nix-on-droid = parseFriendlyKey '' + # ''; + # }; + + # # NUC servers + # nuc0.host = "ssh-ed25519 ABBAC3NzaC1lZDI1NTE5AAAAIHkgTzsmgHcVE12Sc9EYPP29Ek8d++RKZCIVEGEmWJc9 nuc0.int.burd.dev"; + }; + + # logical groups + groups = { + privileged_users = with systems; [ + floki.gburd + symas.gburd + floki.host + floki.root + # pixel6a.nix-on-droid + ]; + }; +} diff --git a/nixos/_mixins/console/auth0.nix b/nixos/_mixins/console/auth0.nix new file mode 100644 index 0000000..aba8d06 --- /dev/null +++ b/nixos/_mixins/console/auth0.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + auth0 + ]; +} diff --git a/nixos/_mixins/console/direnv.nix b/nixos/_mixins/console/direnv.nix new file mode 100644 index 0000000..56a301d --- /dev/null +++ b/nixos/_mixins/console/direnv.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + direnv + ]; +} diff --git a/nixos/_mixins/console/helix.nix b/nixos/_mixins/console/helix.nix new file mode 100644 index 0000000..717eedb --- /dev/null +++ b/nixos/_mixins/console/helix.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + helix + ]; +} diff --git a/nixos/_mixins/console/kubectl.nix b/nixos/_mixins/console/kubectl.nix new file mode 100644 index 0000000..c6ad86e --- /dev/null +++ b/nixos/_mixins/console/kubectl.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + kubectl + ]; +} diff --git a/nixos/_mixins/desktop/beeper.nix b/nixos/_mixins/desktop/beeper.nix new file mode 100644 index 0000000..17ab4a9 --- /dev/null +++ b/nixos/_mixins/desktop/beeper.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + beeper + ]; +} diff --git a/nixos/_mixins/desktop/bitwarden.nix b/nixos/_mixins/desktop/bitwarden.nix new file mode 100644 index 0000000..89f0715 --- /dev/null +++ b/nixos/_mixins/desktop/bitwarden.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + bitwarden + ]; +} diff --git a/nixos/_mixins/desktop/brave.nix b/nixos/_mixins/desktop/brave.nix new file mode 100644 index 0000000..b16d228 --- /dev/null +++ b/nixos/_mixins/desktop/brave.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + brave + ]; +} diff --git a/nixos/_mixins/desktop/cinny.nix b/nixos/_mixins/desktop/cinny.nix new file mode 100644 index 0000000..e76e4d6 --- /dev/null +++ b/nixos/_mixins/desktop/cinny.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + cinny-desktop + ]; +} diff --git a/nixos/_mixins/desktop/cosmic.nix b/nixos/_mixins/desktop/cosmic.nix new file mode 100644 index 0000000..29338ae --- /dev/null +++ b/nixos/_mixins/desktop/cosmic.nix @@ -0,0 +1,21 @@ +{ pkgs, ... }: +{ + imports = [ + ../services/xdg-portal.nix + ]; + + # Enable the X11 windowing system. + services.xserver.enable = false; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + + # Enable udev rules + services.udev.packages = with pkgs.unstable; [ gnome.cosmic-settings-daemon ]; + + environment.systemPackages = with pkgs.unstable; [ + gnomeExtensions.appindicator + gnome3.gnome-tweaks + ]; +} diff --git a/nixos/_mixins/desktop/daw.nix b/nixos/_mixins/desktop/daw.nix new file mode 100644 index 0000000..9e4c7d7 --- /dev/null +++ b/nixos/_mixins/desktop/daw.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + ardour + hydrogen + tenacity + ]; +} diff --git a/nixos/_mixins/desktop/default.nix b/nixos/_mixins/desktop/default.nix index 1100970..edfd7fe 100644 --- a/nixos/_mixins/desktop/default.nix +++ b/nixos/_mixins/desktop/default.nix @@ -5,26 +5,25 @@ ++ lib.optional (builtins.pathExists (./. + "/${desktop}.nix")) ./${desktop}.nix; boot = { - kernelParams = [ - "loglevel=3" - "mitigations=off" - "quiet" - "rd.udev.log_level=3" - "systemd.show_status=auto" - "udev.log_level=3" - "vt.global_cursor_default=0" - ]; + kernelParams = [ "quiet" "vt.global_cursor_default=0" "mitigations=off" ]; + # "loglevel=3" "rd.udev.log_level=3" "systemd.show_status=auto" "udev.log_level=3" plymouth.enable = true; - consoleLogLevel = 0; - initrd.verbose = false; + #consoleLogLevel = 0; + #initrd.verbose = false; }; + # AppImage support & X11 automation + environment.systemPackages = with pkgs; [ + appimage-run + wmctrl + xdotool + ydotool + ]; + hardware = { opengl = { enable = true; - extraPackages = with pkgs; [ amdvlk ]; driSupport = true; - driSupport32Bit = true; }; }; @@ -34,16 +33,16 @@ services.xserver.excludePackages = [ pkgs.xterm ]; services.xserver.desktopManager.xterm.enable = false; - systemd.services.disable-wifi-powersave = { - wantedBy = [ "multi-user.target" ]; - path = [ pkgs.iw ]; - script = '' - iw dev wlp0s20f3 set power_save off - ''; - }; + # systemd.services.disable-wifi-powersave = { + # wantedBy = [ "multi-user.target" ]; + # path = [ pkgs.iw ]; + # script = '' + # iw dev wlp0s20f3 set power_save off + # ''; + # }; - xdg.portal = { - enable = true; - xdgOpenUsePortal = true; - }; + # xdg.portal = { + # enable = true; + # xdgOpenUsePortal = true; + # }; } diff --git a/nixos/_mixins/desktop/discord.nix b/nixos/_mixins/desktop/discord.nix new file mode 100644 index 0000000..fd8105b --- /dev/null +++ b/nixos/_mixins/desktop/discord.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + discord-krisp + ]; +} diff --git a/nixos/_mixins/desktop/element.nix b/nixos/_mixins/desktop/element.nix new file mode 100644 index 0000000..27a0100 --- /dev/null +++ b/nixos/_mixins/desktop/element.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + element-desktop + ]; +} diff --git a/nixos/_mixins/desktop/emacs.nix b/nixos/_mixins/desktop/emacs.nix new file mode 100644 index 0000000..d5a94bf --- /dev/null +++ b/nixos/_mixins/desktop/emacs.nix @@ -0,0 +1,5 @@ +_: { + environment.systemPackages = [ + emacs + ]; +} diff --git a/nixos/_mixins/desktop/ente.nix b/nixos/_mixins/desktop/ente.nix new file mode 100644 index 0000000..b5dac57 --- /dev/null +++ b/nixos/_mixins/desktop/ente.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + ente-photos-desktop + ]; + + boot.kernelModules = [ "fuse" ]; +} diff --git a/nixos/_mixins/desktop/fractal.nix b/nixos/_mixins/desktop/fractal.nix new file mode 100644 index 0000000..2b2dc52 --- /dev/null +++ b/nixos/_mixins/desktop/fractal.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = [ + pkgs.unstable.fractal + ]; +} diff --git a/nixos/_mixins/desktop/gnome.nix b/nixos/_mixins/desktop/gnome.nix new file mode 100644 index 0000000..408964d --- /dev/null +++ b/nixos/_mixins/desktop/gnome.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +{ + imports = [ + ../services/xdg-portal.nix + ]; + + # Enable the graphical windowing system. + # NOTE: xserver is a legacy naming convention, DEs may still use Wayland over X11 + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.desktopManager.gnome.enable = true; + + services.xserver.displayManager.gdm.enable = true; + + # TODO: Disable Wayland (issues with Electron app rendering)? + services.xserver.displayManager.gdm.wayland = true; + + # Enable udev rules + services.udev.packages = with pkgs.unstable; [ gnome.gnome-settings-daemon ]; + + environment.systemPackages = with pkgs.unstable; [ + gnomeExtensions.appindicator + gnome3.gnome-tweaks + ]; +} diff --git a/nixos/_mixins/desktop/google-chrome.nix b/nixos/_mixins/desktop/google-chrome.nix new file mode 100644 index 0000000..0161894 --- /dev/null +++ b/nixos/_mixins/desktop/google-chrome.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + google-chrome + ]; +} diff --git a/nixos/_mixins/desktop/hyprland.nix b/nixos/_mixins/desktop/hyprland.nix new file mode 100644 index 0000000..07040ed --- /dev/null +++ b/nixos/_mixins/desktop/hyprland.nix @@ -0,0 +1,3 @@ +_: { + programs.hyprland.enable = true; +} diff --git a/nixos/_mixins/desktop/i3.nix b/nixos/_mixins/desktop/i3.nix new file mode 100644 index 0000000..fc7e1ff --- /dev/null +++ b/nixos/_mixins/desktop/i3.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + # links /libexec from derivations to /run/current-system/sw + environment.pathsToLink = [ "/libexec" ]; + + services.xserver = { + enable = true; + + desktopManager = { + xterm.enable = false; + }; + + displayManager = { + defaultSession = "none+i3"; + }; + + windowManager.i3 = with pkgs; { + enable = true; + package = i3-gaps; + extraPackages = [ + rofi + i3lock + i3blocks + i3status + ]; + }; + }; +} diff --git a/nixos/_mixins/desktop/jetbrains-toolbox.nix b/nixos/_mixins/desktop/jetbrains-toolbox.nix new file mode 100644 index 0000000..0f337d7 --- /dev/null +++ b/nixos/_mixins/desktop/jetbrains-toolbox.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + jetbrains-toolbox + ]; +} diff --git a/nixos/_mixins/desktop/kde6.nix b/nixos/_mixins/desktop/kde6.nix new file mode 100644 index 0000000..6b63d75 --- /dev/null +++ b/nixos/_mixins/desktop/kde6.nix @@ -0,0 +1,15 @@ +_: { + services.xserver = { + enable = true; + + displayManager = { + defaultSession = "plasma"; + sddm = { + enable = true; + wayland.enable = true; + }; + }; + + desktopManager.plasma6.enable = true; + }; +} diff --git a/nixos/_mixins/desktop/logseq.nix b/nixos/_mixins/desktop/logseq.nix new file mode 100644 index 0000000..bea34a5 --- /dev/null +++ b/nixos/_mixins/desktop/logseq.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + logseq + ]; + + # required due to outdated version of Electron used for Logseq + nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ]; +} diff --git a/nixos/_mixins/desktop/lutris.nix b/nixos/_mixins/desktop/lutris.nix new file mode 100644 index 0000000..dcda62f --- /dev/null +++ b/nixos/_mixins/desktop/lutris.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + lutris + wineWowPackages.stable + winetricks + ]; +} diff --git a/nixos/_mixins/desktop/mate-apps.nix b/nixos/_mixins/desktop/mate-apps.nix index f4872ec..7b1a2fb 100644 --- a/nixos/_mixins/desktop/mate-apps.nix +++ b/nixos/_mixins/desktop/mate-apps.nix @@ -6,6 +6,7 @@ # Add some packages to complete the MATE desktop environment.systemPackages = with pkgs; [ + celluloid gnome.gucharmap gnome-firmware gthumb diff --git a/nixos/_mixins/desktop/mate.nix b/nixos/_mixins/desktop/mate.nix index ee0dfa2..47a4cae 100644 --- a/nixos/_mixins/desktop/mate.nix +++ b/nixos/_mixins/desktop/mate.nix @@ -83,4 +83,5 @@ }; }; }; + xdg.portal.extraPortals = [ xdg-desktop-portal-gtk ]; } diff --git a/nixos/_mixins/desktop/microsoft-edge.nix b/nixos/_mixins/desktop/microsoft-edge.nix new file mode 100644 index 0000000..6dd9f44 --- /dev/null +++ b/nixos/_mixins/desktop/microsoft-edge.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + microsoft-edge + ]; +} diff --git a/nixos/_mixins/desktop/obs-studio.nix b/nixos/_mixins/desktop/obs-studio.nix index 24548db..5b0626d 100644 --- a/nixos/_mixins/desktop/obs-studio.nix +++ b/nixos/_mixins/desktop/obs-studio.nix @@ -6,6 +6,9 @@ ''; environment.systemPackages = [ + pkgs.bc + pkgs.google-fonts + pkgs.libnotify (pkgs.unstable.wrapOBS { plugins = with pkgs.unstable.obs-studio-plugins; [ obs-3d-effect @@ -19,7 +22,7 @@ obs-rgb-levels-filter obs-text-pthread obs-scale-to-sound - # TODO: advanced-scene-switcher https://github.com/NixOS/nixpkgs/issues/287254 + advanced-scene-switcher obs-shaderfilter obs-source-clone obs-source-record diff --git a/nixos/_mixins/desktop/opera.nix b/nixos/_mixins/desktop/opera.nix new file mode 100644 index 0000000..a4c4c71 --- /dev/null +++ b/nixos/_mixins/desktop/opera.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + opera + ]; +} diff --git a/nixos/_mixins/desktop/pantheon-apps.nix b/nixos/_mixins/desktop/pantheon-apps.nix index 9c79460..80393f9 100644 --- a/nixos/_mixins/desktop/pantheon-apps.nix +++ b/nixos/_mixins/desktop/pantheon-apps.nix @@ -7,6 +7,7 @@ # Add additional apps and include Yaru for syntax highlighting environment.systemPackages = with pkgs; [ appeditor + celluloid gthumb formatter usbimager diff --git a/nixos/_mixins/desktop/pantheon.nix b/nixos/_mixins/desktop/pantheon.nix index 18b4aed..b7c2fec 100644 --- a/nixos/_mixins/desktop/pantheon.nix +++ b/nixos/_mixins/desktop/pantheon.nix @@ -1,9 +1,10 @@ # NOTE: This is the minimum Pantheon, included in the live .iso image -# For actuall installs pantheon-apps.nix is also included +# For actual installs pantheon-apps.nix is also included { pkgs, ... }: { imports = [ ./qt-style.nix - # ../services/networkmanager.nix + ../services/networkmanager.nix + ../services/xdg-portal.nix ]; # Exclude the elementary apps I don't use diff --git a/nixos/_mixins/desktop/simple-scan.nix b/nixos/_mixins/desktop/simple-scan.nix new file mode 100644 index 0000000..4009517 --- /dev/null +++ b/nixos/_mixins/desktop/simple-scan.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + gnome.simple-scan + ]; +} diff --git a/nixos/_mixins/desktop/spotify.nix b/nixos/_mixins/desktop/spotify.nix new file mode 100644 index 0000000..d6f2a97 --- /dev/null +++ b/nixos/_mixins/desktop/spotify.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + imports = [ + ../services/unfree.nix + ]; + + environment.systemPackages = with pkgs; [ spotify ]; +} diff --git a/nixos/_mixins/desktop/tilix.nix b/nixos/_mixins/desktop/tilix.nix new file mode 100644 index 0000000..84611a0 --- /dev/null +++ b/nixos/_mixins/desktop/tilix.nix @@ -0,0 +1,5 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + tilix + ]; +} diff --git a/nixos/_mixins/desktop/vivaldi.nix b/nixos/_mixins/desktop/vivaldi.nix new file mode 100644 index 0000000..0aff605 --- /dev/null +++ b/nixos/_mixins/desktop/vivaldi.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs.unstable; [ + vivaldi + vivaldi-ffmpeg-codecs + ]; +} diff --git a/nixos/_mixins/desktop/vscode.nix b/nixos/_mixins/desktop/vscode.nix index f7bda19..1ac0935 100644 --- a/nixos/_mixins/desktop/vscode.nix +++ b/nixos/_mixins/desktop/vscode.nix @@ -1,146 +1,369 @@ -# https://github.com/NixOS/nixpkgs/blob/nixos-22.11/pkgs/applications/editors/vscode/extensions/update_installed_exts.sh#L34 -# SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip") -{ pkgs, ... }: { +args@{ pkgs, lib, ... }: +let + codeServer = if builtins.hasAttr "codeServer" args then args.codeServer else { enable = false; }; + + languages = if builtins.hasAttr "languages" args then args.languages else { }; + + getLangOr = key: default: !!(if builtins.hasAttr key languages then languages [ key ] else default); + + getListIf = isEnabled: list: if isEnabled then list else [ ]; + + # NOTE: regenerate or update using the script in this directory + ext = { + bash-debug = { + name = "bash-debug"; + publisher = "rogalmic"; + version = "0.3.9"; + sha256 = "0n7lyl8gxrpc26scffbrfczdj0n9bcil9z83m4kzmz7k5dj59hbz"; + }; + bash-ide-vscode = { + name = "bash-ide-vscode"; + publisher = "mads-hartmann"; + version = "1.41.0"; + sha256 = "0gc4fk9j202xgahj1jy9p20fqxkfbldy4d0gbir5x3i7hq2ahml2"; + }; + cmake-tools = { + name = "cmake-tools"; + publisher = "ms-vscode"; + version = "1.18.39"; + sha256 = "16wywsx5md3zkaj42vnp8bjpvv5pp4bwm9ll3gxbb0jhs1dwz7fc"; + }; + code-spell-checker = { + name = "code-spell-checker"; + publisher = "streetsidesoftware"; + version = "3.0.1"; + sha256 = "0i76gf7zr0j4dr02zmxwfphk6yy8rvlj9rzq3k8pvnlfzkmh9ri9"; + }; + copilot = { + name = "copilot"; + publisher = "github"; + version = "1.194.886"; + sha256 = "0qvsij109i1n89xl6clr4010r6q71pk4xhsyrzr1nyqggqwqhhpn"; + }; + cpptools = { + name = "cpptools"; + publisher = "ms-vscode"; + version = "1.20.5"; + sha256 = "1j1a8ni5gihpw7zi8c6pg0l2n9yqbk369s3mywgz7dj8ykx7q8xl"; + }; + cpptools-extension-pack = { + name = "cpptools-extension-pack"; + publisher = "ms-vscode"; + version = "1.3.0"; + sha256 = "11fk26siccnfxhbb92z6r20mfbl9b3hhp5zsvpn2jmh24vn96x5c"; + }; + debian-vscode = { + name = "debian-vscode"; + publisher = "dawidd6"; + version = "0.1.2"; + sha256 = "0vzqwbd1qck9m0ip6vg995xz3x15x68jfly1f5zp1dpmaw8rmc0f"; + }; + editorconfig = { + name = "editorconfig"; + publisher = "editorconfig"; + version = "0.16.4"; + sha256 = "0fa4h9hk1xq6j3zfxvf483sbb4bd17fjl5cdm3rll7z9kaigdqwg"; + }; + font-switcher = { + name = "font-switcher"; + publisher = "evan-buss"; + version = "4.1.0"; + sha256 = "1ijn55n6866hagrpaccjb1fc36xmjw5sclydgq8pkvyn1xyd8i9a"; + }; + gitlens = { + name = "gitlens"; + publisher = "eamodio"; + version = "2024.5.2305"; + sha256 = "1i24zbrf8d35mmc3ajyah8fxwdkjvz89c88i4iac4y3ahd5kpdzf"; + }; + go = { + name = "go"; + publisher = "golang"; + version = "0.41.4"; + sha256 = "03gxgcvjk5plzkk7gjsrrck1kszzbzswkbcr33m3qlkyz4iw9nly"; + }; + grammarly = { + name = "grammarly"; + publisher = "znck"; + version = "0.25.0"; + sha256 = "048bahfaha3i6sz1b5jkyhfd2aiwgpkmyy2i7hlzc45g1289827z"; + }; + language-hugo-vscode = { + name = "language-hugo-vscode"; + publisher = "budparr"; + version = "1.3.1"; + sha256 = "16bchjx895jg0avgbg2s13kij1i8h2rma2vbks4w6vy00bz7rnpm"; + }; + linux-desktop-file = { + name = "linux-desktop-file"; + publisher = "nico-castell"; + version = "0.0.21"; + sha256 = "0d2pfby72qczljzw1dk2rsqkqharl2sbq3g31zylz0rx73cvxb72"; + }; + makefile-tools = { + name = "makefile-tools"; + publisher = "ms-vscode"; + version = "0.10.7"; + sha256 = "148c15friprfj1bwcalz3divrjnq283pgz9984aklznkb3fzas06"; + }; + markdown-all-in-one = { + name = "markdown-all-in-one"; + publisher = "yzhang"; + version = "3.6.2"; + sha256 = "1n9d3qh7vypcsfygfr5rif9krhykbmbcgf41mcjwgjrf899f11h4"; + }; + nix-ide = { + name = "nix-ide"; + publisher = "jnoortheen"; + version = "0.3.1"; + sha256 = "1cpfckh6zg8byi6x1llkdls24w9b0fvxx4qybi9zfcy5gc60r6nk"; + }; + non-breaking-space-highlighter = { + name = "non-breaking-space-highlighter"; + publisher = "viktorzetterstrom"; + version = "0.0.3"; + sha256 = "1v7x973bbywqdpkslvwn5nh2fpxiq82cq4d9g7g0y2vzac2r3s5p"; + }; + partial-diff = { + name = "partial-diff"; + publisher = "ryu1kn"; + version = "1.4.3"; + sha256 = "0x3lkvna4dagr7s99yykji3x517cxk5kp7ydmqa6jb4bzzsv1s6h"; + }; + prettier-vscode = { + name = "prettier-vscode"; + publisher = "esbenp"; + version = "10.4.0"; + sha256 = "1iy7i0yxnhizz40llnc1dk9q8kk98rz6ki830sq7zj3ak9qp9vzk"; + }; + pubspec-assist = { + name = "pubspec-assist"; + publisher = "jeroen-meijer"; + version = "2.3.2"; + sha256 = "1zdv8i6i4hka536i52qbqpmghs6jyn22vgzxp7jfnvxvx9nirjgq"; + }; + python = { + name = "python"; + publisher = "ms-python"; + version = "2024.7.11371014"; + sha256 = "0s21jdpdcwy7pnmzlqk9l8h71yh7wg1idhj6zgqk91xa06dhq060"; + }; + remote-ssh-edit = { + name = "remote-ssh-edit"; + publisher = "ms-vscode-remote"; + version = "0.47.2"; + sha256 = "1hp6gjh4xp2m1xlm1jsdzxw9d8frkiidhph6nvl24d0h8z34w49g"; + }; + rust-analyzer = { + name = "rust-analyzer"; + publisher = "rust-lang"; + version = "0.3.1386"; + sha256 = "qttgUVpoYNEg2+ArYxnEHwM4AbChQiB6/JW46+cq7/w="; + }; + shellcheck = { + name = "shellcheck"; + publisher = "timonwong"; + version = "0.37.1"; + sha256 = "sha256-JSS0GY76+C5xmkQ0PNjt2Nu/uTUkfiUqmPL51r64tl0="; + }; + simple-rst = { + name = "simple-rst"; + publisher = "trond-snekvik"; + version = "1.5.4"; + sha256 = "1js1489nd9fycvpgh39mwzpbqm28qi4gzi68443v3vhw3dsg4wjv"; + }; + systemd-unit-file = { + name = "systemd-unit-file"; + publisher = "coolbear"; + version = "1.0.6"; + sha256 = "0sc0zsdnxi4wfdlmaqwb6k2qc21dgwx6ipvri36x7agk7m8m4736"; + }; + vala = { + name = "vala"; + publisher = "prince781"; + version = "1.0.8"; + sha256 = "sha256-IuIb7vLNiE3rzVHOsjInaYLzNYORbwabQq0bfaPLlqc="; + }; + vscode-docker = { + name = "vscode-docker"; + publisher = "ms-azuretools"; + version = "1.29.1"; + sha256 = "0zba6g0cw2h42gfvrlx0x2axlj61hkrfjfg5kyd14fqzi4n9jmxs"; + }; + vscode-front-matter = { + name = "vscode-front-matter"; + publisher = "eliostruyf"; + version = "8.4.0"; + sha256 = "sha256-L0PbZ4HxJAlxkwVcZe+kBGS87yzg0pZl89PU0aUVYzY="; + }; + vscode-github-actions = { + name = "vscode-github-actions"; + publisher = "github"; + version = "0.26.2"; + sha256 = "16kp1yxs798jp8ffqq3ixm3pyz4f3wgdkdyjpjy94ppqp4aklixh"; + }; + vscode-icons = { + name = "vscode-icons"; + publisher = "vscode-icons-team"; + version = "12.7.0"; + sha256 = "1w30gd0chf2c26a9c426ghs7gmss9dk9yzlrab51ydwhfkkd4hxb"; + }; + vscode-mdx = { + name = "vscode-mdx"; + publisher = "unifiedjs"; + version = "1.8.6"; + sha256 = "177yjm8dhjjgmwww00sqi0fk1clajkdyy2nypi8413xv6cm14c71"; + }; + vscode-mdx-preview = { + name = "vscode-mdx-preview"; + publisher = "xyc"; + version = "0.3.3"; + sha256 = "1i65l6xrzh3if4x3bj012rrdk6lwyrmlpgdqml4p53048nm09b1q"; + }; + vscode-neovim = { + name = "vscode-neovim"; + publisher = "asvetliakov"; + version = "1.12.0"; + sha256 = "09xyb2i1va0yq45ymk20v9cxjnc02xlfvm1rm8cialq19xl3h0m2"; + }; + vscode-power-mode = { + name = "vscode-power-mode"; + publisher = "hoovercj"; + version = "3.0.2"; + sha256 = "sha256-ZE+Dlq0mwyzr4nWL9v+JG00Gllj2dYwL2r9jUPQ8umQ="; + }; + vscode-pylance = { + name = "vscode-pylance"; + publisher = "ms-python"; + version = "2024.5.101"; + sha256 = "0yp0dlq2q9yvv5vhpxfmpbrdgcy61i9r1ilknhni29nlg86mqbbv"; + }; + vscode-yaml = { + name = "vscode-yaml"; + publisher = "redhat"; + version = "1.14.0"; + sha256 = "0pww9qndd2vsizsibjsvscz9fbfx8srrj67x4vhmwr581q674944"; + }; + vsliveshare = { + name = "vsliveshare"; + publisher = "ms-vsliveshare"; + version = "1.0.5918"; + sha256 = "1m4mpy6irj3vzjw6mzmjjp6appgf000zfhmkjwxw65sl4wmjckaf"; + }; + xml = { + name = "xml"; + publisher = "dotjoshjohnson"; + version = "2.5.1"; + sha256 = "1v4x6yhzny1f8f4jzm4g7vqmqg5bqchyx4n25mkgvw2xp6yls037"; + }; + }; + + + g = { + ai = getLangOr "ai" false; + cpp = getLangOr "cpp" true; + diff = getLangOr "diff" true; + docker = getLangOr "docker" true; + editorconfig = getLangOr "editorconfig" true; + elm = getLangOr "elm" false; + fun = getLangOr "fun" false; + github = getLangOr "github" false; + gitlens = getLangOr "gitlens" false; + go = getLangOr "go" false; + hugo = getLangOr "hugo" false; + icons = getLangOr "icons" true; + js = getLangOr "js" true; + linux = getLangOr "linux" false; + nix = getLangOr "nix" true; + php = getLangOr "php" false; + prisma = getLangOr "prisma" true; + python = getLangOr "python" true; + rust = getLangOr "rust" false; + ssh = getLangOr "ssh" false; + text = getLangOr "text" true; + vala = getLangOr "vala" false; + xml = getLangOr "xml" true; + yaml = getLangOr "yaml" true; + }; +in +{ + imports = lib.optional codeServer.enable ../services/vscode-server.nix + ; + environment.systemPackages = with pkgs; [ (vscode-with-extensions.override { - inherit (unstable) vscode; - vscodeExtensions = [ - unstable.vscode-extensions.asvetliakov.vscode-neovim - unstable.vscode-extensions.coolbear.systemd-unit-file - unstable.vscode-extensions.dotjoshjohnson.xml - unstable.vscode-extensions.eamodio.gitlens - unstable.vscode-extensions.editorconfig.editorconfig - unstable.vscode-extensions.esbenp.prettier-vscode - unstable.vscode-extensions.github.copilot - unstable.vscode-extensions.github.vscode-github-actions - unstable.vscode-extensions.golang.go - unstable.vscode-extensions.jnoortheen.nix-ide - unstable.vscode-extensions.mads-hartmann.bash-ide-vscode - unstable.vscode-extensions.ms-azuretools.vscode-docker - unstable.vscode-extensions.ms-python.python - unstable.vscode-extensions.ms-python.vscode-pylance - unstable.vscode-extensions.ms-vscode.cmake-tools - unstable.vscode-extensions.ms-vscode.cpptools - unstable.vscode-extensions.ms-vscode.cpptools-extension-pack - unstable.vscode-extensions.ms-vscode.makefile-tools - unstable.vscode-extensions.ms-vsliveshare.vsliveshare - unstable.vscode-extensions.redhat.vscode-yaml - unstable.vscode-extensions.ryu1kn.partial-diff - unstable.vscode-extensions.scala-lang.scala - unstable.vscode-extensions.scalameta.metals - unstable.vscode-extensions.streetsidesoftware.code-spell-checker - unstable.vscode-extensions.timonwong.shellcheck - unstable.vscode-extensions.tuttieee.emacs-mcx - unstable.vscode-extensions.vscode-icons-team.vscode-icons - unstable.vscode-extensions.yzhang.markdown-all-in-one - ] ++ pkgs.unstable.vscode-utils.extensionsFromVscodeMarketplace [ - { - name = "bash-debug"; - publisher = "rogalmic"; - version = "0.3.9"; - sha256 = "sha256-f8FUZCvz/PonqQP9RCNbyQLZPnN5Oce0Eezm/hD19Fg="; - } - { - name = "beardedicons"; - publisher = "beardedbear"; - version = "1.13.2"; - sha256 = "sha256-PpIut/yhUNK1eTPRvVXONt06TOXpoGgmd6lrhFdADRQ"; - } - { - name = "beardedtheme"; - publisher = "beardedbear"; - version = "8.3.2"; - sha256 = "sha256-TwHuoXme0o6EeciA1lxhs5vmhGlDvaWlH8tjVmuSQH8"; - } - { - name = "debian-vscode"; - publisher = "dawidd6"; - version = "0.1.2"; - sha256 = "sha256-DrCaEVf1tnB/ccFTJ5HpJfTxe0npbXMjqGkyHNri+G8="; - } - { - name = "font-switcher"; - publisher = "evan-buss"; - version = "4.1.0"; - sha256 = "sha256-KkXUfA/W73kRfs1TpguXtZvBXFiSMXXzU9AYZGwpVsY="; - } - { - name = "grammarly"; - publisher = "znck"; - version = "0.23.15"; - sha256 = "sha256-/LjLL8IQwQ0ghh5YoDWQxcPM33FCjPeg3cFb1Qa/cb0="; - } - { - name = "language-hugo-vscode"; - publisher = "budparr"; - version = "1.3.1"; - sha256 = "sha256-9dp8/gLAb8OJnmsLVbOAKAYZ5whavPW2Ak+WhLqEbJk="; - } - { - name = "linux-desktop-file"; - publisher = "nico-castell"; - version = "0.0.21"; - sha256 = "sha256-4qy+2Tg9g0/9D+MNvLSgWUE8sc5itsC/pJ9hcfxyVzQ="; - } - { - name = "non-breaking-space-highlighter"; - publisher = "viktorzetterstrom"; - version = "0.0.3"; - sha256 = "sha256-t+iRBVN/Cw/eeakRzATCsV8noC2Wb6rnbZj7tcZJ/ew="; - } - # { - # name = "nix-extension-pack"; - # publisher = "pinage404"; - # version = "3.0.0"; - # sha256 = "sha256-"; - # } - { - name = "pubspec-assist"; - publisher = "jeroen-meijer"; - version = "2.3.2"; - sha256 = "sha256-+Mkcbeq7b+vkuf2/LYT10mj46sULixLNKGpCEk1Eu/0="; - } - { - name = "simple-rst"; - publisher = "trond-snekvik"; - version = "1.5.3"; - sha256 = "sha256-0gPqckwzDptpzzg1tP4I9WQfrXlflO+G0KcAK5pEie8="; - } - { - name = "vala"; - publisher = "prince781"; - version = "1.0.8"; - sha256 = "sha256-IuIb7vLNiE3rzVHOsjInaYLzNYORbwabQq0bfaPLlqc="; - } - { - name = "vscode-front-matter"; - publisher = "eliostruyf"; - version = "8.4.0"; - sha256 = "sha256-L0PbZ4HxJAlxkwVcZe+kBGS87yzg0pZl89PU0aUVYzY="; - } - { - name = "vscode-mdx"; - publisher = "unifiedjs"; - version = "1.4.0"; - sha256 = "sha256-qqqq0QKTR0ZCLdPltsnQh5eTqGOh9fV1OSOZMjj4xXg="; - } - { - name = "vscode-mdx-preview"; - publisher = "xyc"; - version = "0.3.3"; - sha256 = "sha256-OKwEqkUEjHIJrbi9S2v2nJrZchYByDU6cXHAn7uhxcQ="; - } - { - name = "vscode-power-mode"; - publisher = "hoovercj"; - version = "3.0.2"; - sha256 = "sha256-ZE+Dlq0mwyzr4nWL9v+JG00Gllj2dYwL2r9jUPQ8umQ="; - } - ]; + inherit (trunk) vscode; + vscodeExtensions = with unstable.vscode-extensions; + # globally enabled extensions + getListIf g.cpp [ ms-vscode.cpptools ms-vscode.cpptools-extension-pack ms-vscode.cmake-tools ms-vscode.makefile-tools ] + ++ getListIf g.diff [ ryu1kn.partial-diff ] + ++ getListIf g.docker [ ms-azuretools.vscode-docker ] + ++ getListIf g.editorconfig [ editorconfig.editorconfig ] + ++ getListIf g.elm [ elmtooling.elm-ls-vscode ] + ++ getListIf g.github [ github.vscode-github-actions github.copilot ] + ++ getListIf g.gitlens [ eamodio.gitlens ] + ++ getListIf g.go [ golang.go ] + ++ getListIf g.icons [ vscode-icons-team.vscode-icons ] + ++ getListIf g.js [ esbenp.prettier-vscode ] + ++ getListIf g.linux [ coolbear.systemd-unit-file timonwong.shellcheck mads-hartmann.bash-ide-vscode ] + ++ getListIf g.nix [ bbenoist.nix jnoortheen.nix-ide ] + ++ getListIf g.php [ bmewburn.vscode-intelephense-client ] + ++ getListIf g.prisma [ prisma.prisma ] + ++ getListIf g.python [ ms-python.python ms-python.vscode-pylance ] + ++ getListIf g.ssh [ ms-vscode-remote.remote-ssh ] + ++ getListIf g.text [ streetsidesoftware.code-spell-checker yzhang.markdown-all-in-one ] + ++ getListIf g.xml [ dotjoshjohnson.xml ] + ++ getListIf g.yaml [ redhat.vscode-yaml ] + + # The most simple way to calculate a package's SHA256 is to simply + # copy over an invalid SHA256 and the nixos-rebuild will fail, + # with output for the specified and actual hash values. Or, + # SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip") + # see: https://t.ly/Akd1I + ++ (pkgs.unstable.vscode-utils.extensionsFromVscodeMarketplace + # globally enabled extensions + [ + ext.non-breaking-space-highlighter + ext.vscode-neovim + # TODO: the following is a work-around for the option-based + # method below which doesn't seem to work at the moment. + ext.bash-debug + ext.gitlens + ext.copilot + ext.vscode-github-actions + ext.bash-ide-vscode + ext.shellcheck + ext.grammarly + ] + ++ getListIf g.ai [ ext.copilot ] + ++ getListIf g.cpp [ ] + ++ getListIf g.diff [ ] + ++ getListIf g.docker [ ] + ++ getListIf g.editorconfig [ ] + ++ getListIf g.elm [ ] + ++ getListIf g.fun [ ext.vscode-power-mode ] + ++ getListIf g.github [ ] + ++ getListIf g.gitlens [ ] + ++ getListIf g.go [ ] + ++ getListIf g.hugo [ ext.language-hugo-vscode ] + ++ getListIf g.icons [ ] + ++ getListIf g.js [ ] + ++ getListIf g.linux [ ext.linux-desktop-file ext.bash-debug ] + ++ getListIf g.nix [ ] + ++ getListIf g.php [ ] + ++ getListIf g.python [ ] + ++ getListIf g.rust [ ext.rust-analyzer ] + ++ getListIf g.ssh [ ext.remote-ssh-edit ] + # TODO: Determine root cause of manifest issues + # ++ getListIf g.text [ext.simple-rst ext.vscode-mdx ext.vscode-mdx-preview] + ++ getListIf g.xml [ ] + ++ getListIf g.yaml [ ] + ) + ; }) ]; - services.vscode-server.enable = true; # May require the service to be enable/started for the user # - systemctl --user enable auto-fix-vscode-server.service --now } +# unstable.vscode-extensions.ms-vsliveshare.vsliveshare diff --git a/nixos/_mixins/desktop/vscode_update_installed.sh b/nixos/_mixins/desktop/vscode_update_installed.sh new file mode 100755 index 0000000..1317ed3 --- /dev/null +++ b/nixos/_mixins/desktop/vscode_update_installed.sh @@ -0,0 +1,77 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p curl jq unzip + +# https://github.com/NixOS/nixpkgs/blob/42d815d1026e57f7e6f178de5a280c14f7aba1a5/pkgs/misc/vscode-extensions/update_installed_exts.sh + +set -eu -o pipefail + +# Helper to just fail with a message and non-zero exit code. +function fail() { + echo "$1" >&2 + exit 1 +} + +# Helper to clean up after ourself if we're killed by SIGINT +function clean_up() { + TDIR="${TMPDIR:-/tmp}" + echo "Script killed, cleaning up tmpdirs: $TDIR/vscode_exts_*" >&2 + rm -Rf "$TDIR/vscode_exts_*" +} + +function get_vsixpkg() { + N="$1.$2" + + # Create a tempdir for the extension download + EXTTMP=$(mktemp -d -t vscode_exts_XXXXXXXX) + + URL="https://$1.gallery.vsassets.io/_apis/public/gallery/publisher/$1/extension/$2/latest/assetbyname/Microsoft.VisualStudio.Services.VSIXPackage" + + # Quietly but delicately curl down the file, blowing up at the first sign of trouble. + curl --silent --show-error --fail -X GET -o "$EXTTMP/$N.zip" "$URL" + # Unpack the file we need to stdout then pull out the version + VER=$(jq -r '.version' <(unzip -qc "$EXTTMP/$N.zip" "extension/package.json")) + # Calculate the SHA + SHA=$(nix-hash --flat --base32 --type sha256 "$EXTTMP/$N.zip") + + # Clean up. + rm -Rf "$EXTTMP" + # I don't like 'rm -Rf' lurking in my scripts but this seems appropriate + + cat <<-EOF + $2 = { + name = "$2"; + publisher = "$1"; + version = "$VER"; + sha256 = "$SHA"; + }; +EOF +} + +# See if can find our code binary somewhere. +if [ $# -ne 0 ]; then + CODE=$1 +else + CODE=$(command -v code) +fi + +if [ -z "$CODE" ]; then + # Not much point continuing. + fail "VSCode executable not found" +fi + +# Try to be a good citizen and clean up after ourselves if we're killed. +trap clean_up SIGINT + +# Begin the printing of the nix expression that will house the list of extensions. +printf 'ext = {\n' + +# Note that we are only looking to update extensions that are already installed. +for i in $($CODE --list-extensions | sort -t'.' -k2) +do + OWNER=$(echo "$i" | cut -d. -f1) + EXT=$(echo "$i" | cut -d. -f2) + + get_vsixpkg "$OWNER" "$EXT" +done +# Close off the nix expression. +printf '};\n' diff --git a/nixos/_mixins/hardware/disable-nm-wait.nix b/nixos/_mixins/hardware/disable-nm-wait.nix new file mode 100644 index 0000000..da8c55c --- /dev/null +++ b/nixos/_mixins/hardware/disable-nm-wait.nix @@ -0,0 +1,4 @@ +{ lib, ... }: { + systemd.services.NetworkManager-wait-online.enable = lib.mkForce false; + systemd.services.systemd-networkd-wait-online.enable = lib.mkForce false; +} diff --git a/nixos/_mixins/hardware/gpu.nix b/nixos/_mixins/hardware/gpu.nix deleted file mode 100644 index 1b1d9be..0000000 --- a/nixos/_mixins/hardware/gpu.nix +++ /dev/null @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; - [ - clinfo - libva-utils - python311Packages.gpustat - vdpauinfo - ] ++ (if lib.elem "nvidia" config.services.xserver.videoDrivers then - [ - nvtop - ] - else - [ - nvtop-amd - ]); -} diff --git a/nixos/_mixins/hardware/grub-legacy-boot.nix b/nixos/_mixins/hardware/grub-legacy-boot.nix new file mode 100644 index 0000000..52f7e57 --- /dev/null +++ b/nixos/_mixins/hardware/grub-legacy-boot.nix @@ -0,0 +1,6 @@ +_: { + boot.loader.grub = { + enable = true; + efiSupport = false; + }; +} diff --git a/nixos/_mixins/hardware/gtx-1080ti.nix b/nixos/_mixins/hardware/gtx-1080ti.nix new file mode 100644 index 0000000..282db38 --- /dev/null +++ b/nixos/_mixins/hardware/gtx-1080ti.nix @@ -0,0 +1,49 @@ +{ pkgs, config, ... }: +let + vulkanDriverFiles = [ + "${config.hardware.nvidia.package}/share/vulkan/icd.d/nvidia_icd.x86_64.json" + "${config.hardware.nvidia.package.lib32}/share/vulkan/icd.d/nvidia_icd.i686.json" + ]; +in +{ + environment = { + systemPackages = with pkgs; [ vulkan-tools nvtop ]; + + variables = { + VK_DRIVER_FILES = builtins.concatStringsSep ":" vulkanDriverFiles; + }; + }; + + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware = { + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.stable; + + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + powerManagement.enable = false; + + # Only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + open = false; + + nvidiaSettings = true; + }; + + opengl = { + enable = true; + inherit (config.hardware.nvidia) package; + driSupport = true; + driSupport32Bit = true; + }; + + pulseaudio.support32Bit = true; + }; + + virtualisation.docker.enableNvidia = true; +} diff --git a/nixos/_mixins/hardware/intel.accelerated-video-playback.nix b/nixos/_mixins/hardware/intel.accelerated-video-playback.nix new file mode 100644 index 0000000..583f6ed --- /dev/null +++ b/nixos/_mixins/hardware/intel.accelerated-video-playback.nix @@ -0,0 +1,17 @@ +{ pkgs, config, ... }: +{ + nixpkgs.config.packageOverrides = pkgs: { + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + }; + hardware.opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + intel-compute-runtime + ]; + }; + environment.sessionVariables = { LIBVA_DRIVER_NAME = "iHD"; }; +} diff --git a/nixos/_mixins/hardware/ramdisk.nix b/nixos/_mixins/hardware/ramdisk.nix new file mode 100644 index 0000000..48b1daf --- /dev/null +++ b/nixos/_mixins/hardware/ramdisk.nix @@ -0,0 +1,3 @@ +_: { + boot.kernelParams = [ "copytoram" ]; +} diff --git a/nixos/_mixins/hardware/roccat.nix b/nixos/_mixins/hardware/roccat.nix new file mode 100644 index 0000000..71bcd37 --- /dev/null +++ b/nixos/_mixins/hardware/roccat.nix @@ -0,0 +1,17 @@ +{ pkgs, username, ... }: +let + hidrawAccessGroup = "plugdev"; +in +{ + environment.systemPackages = with pkgs; [ + roccat-tools + ]; + + services.udev.extraRules = '' + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0660", GROUP="${hidrawAccessGroup}" + ''; + + users.groups.${hidrawAccessGroup} = { }; + + users.users.${username}.extraGroups = [ hidrawAccessGroup ]; +} diff --git a/nixos/_mixins/hardware/rtx-3080ti.nix b/nixos/_mixins/hardware/rtx-3080ti.nix new file mode 100644 index 0000000..d863949 --- /dev/null +++ b/nixos/_mixins/hardware/rtx-3080ti.nix @@ -0,0 +1,49 @@ +{ pkgs, config, ... }: +let + vulkanDriverFiles = [ + "${config.hardware.nvidia.package}/share/vulkan/icd.d/nvidia_icd.x86_64.json" + "${config.hardware.nvidia.package.lib32}/share/vulkan/icd.d/nvidia_icd.i686.json" + ]; +in +{ + environment = { + systemPackages = with pkgs; [ vulkan-tools nvtop ]; + + variables = { + VK_DRIVER_FILES = builtins.concatStringsSep ":" vulkanDriverFiles; + }; + }; + + services.xserver.videoDrivers = [ "nvidia" ]; + + hardware = { + nvidia = { + package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta; + + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + powerManagement.enable = false; + + # Only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + open = false; + + nvidiaSettings = true; + }; + + opengl = { + enable = true; + inherit (config.hardware.nvidia) package; + driSupport = true; + driSupport32Bit = true; + }; + + pulseaudio.support32Bit = true; + }; + + virtualisation.docker.enableNvidia = true; +} diff --git a/nixos/_mixins/network-shares/ds418-nfs.nix b/nixos/_mixins/network-shares/ds418-nfs.nix new file mode 100644 index 0000000..7d82b9b --- /dev/null +++ b/nixos/_mixins/network-shares/ds418-nfs.nix @@ -0,0 +1,27 @@ +{ pkgs, ... }: { + # more info in https://nixos.wiki/wiki/NFS + + services.rpcbind.enable = true; # needed for NFS + + boot.kernelModules = [ "nfsd" ]; + + environment.systemPackages = with pkgs; [ nfs-utils ]; + + # systemd.mounts = [{ + # type = "nfs"; + # mountConfig = { + # Options = "noatime"; + # }; + # what = "nas-ds418-00:/"; + # where = "/mnt/nas-ds418-00"; + # }]; + + # systemd.automounts = [{ + # wantedBy = [ "multi-user.target" ]; + # wants = [ "nfs-client.target" ]; + # automountConfig = { + # TimeoutIdleSec = "600"; + # }; + # where = "/mnt/nas-ds418-00"; + # }]; +} diff --git a/nixos/_mixins/network-shares/ds418-smb.nix b/nixos/_mixins/network-shares/ds418-smb.nix new file mode 100644 index 0000000..366d00a --- /dev/null +++ b/nixos/_mixins/network-shares/ds418-smb.nix @@ -0,0 +1,26 @@ +_: +let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; +in +{ + # Mounts the secrets file + age.secrets.ds418-smb-conf = { + file = ../../../secrets/network-shares/ds418/smb.conf.age; + owner = "root"; + group = "root"; + mode = "400"; + }; + + # For mount.cifs, required since domain name resolution is needed + environment.systemPackages = [ pkgs.cifs-utils ]; + fileSystems."/mnt/ds418" = { + device = "//nas-ds418-00/homes/Tom"; + fsType = "cifs"; + options = [ "${automount_opts},credentials=${config.age.secrets.ds418-smb-conf.path}" ]; + }; + + # ensure the agenix file is mounted successfully + depends = [ config.age.secrets.ds418-smb-conf.path ]; + + # TODO: Utilize systemd.mounts instead for better service dependency detection? +} diff --git a/nixos/_mixins/servers/nuc-base.nix b/nixos/_mixins/servers/nuc-base.nix new file mode 100644 index 0000000..7f1072d --- /dev/null +++ b/nixos/_mixins/servers/nuc-base.nix @@ -0,0 +1,48 @@ +{ inputs, lib, pkgs, ... }: +{ + imports = [ + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-intel + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-ssd + ../../_mixins/hardware/disable-nm-wait.nix + ../../_mixins/hardware/systemd-boot.nix + ../../_mixins/services/tailscale.nix + ../../_mixins/virt + ]; + + # based on nixos-generators raw + raw-efi formats, see linked references + fileSystems = { + # https://github.com/nix-community/nixos-generators/blob/c1590ae68664e11c1acd03ec76c193a5c151a657/formats/raw.nix#L9 + "/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; + # https://github.com/nix-community/nixos-generators/blob/c1590ae68664e11c1acd03ec76c193a5c151a657/formats/raw-efi.nix#L20 + "/boot" = { + device = "/dev/disk/by-label/ESP"; + fsType = "vfat"; + }; + }; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "uas" ]; + kernelModules = [ "kvm-intel" ]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_5_15; + }; + + # ensure we aren't defaulting to NetworkManager with DHCP on + networking.useDHCP = false; + systemd.network.enable = true; + systemd.network.networks."10-lan" = { + matchConfig.Name = "enp2s0"; + networkConfig = { + # Address must be provided via systemd.network.networks."10-lan".networkConfig.Address + Gateway = "192.168.40.1"; + DNS = "192.168.40.1"; + }; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/_mixins/services/blocky.nix b/nixos/_mixins/services/blocky.nix new file mode 100644 index 0000000..fba1573 --- /dev/null +++ b/nixos/_mixins/services/blocky.nix @@ -0,0 +1,50 @@ +_: +let + fullBlocklistProjectTrackerList = { + Abuse = [ "https://blocklistproject.github.io/Lists/abuse.txt" ]; + Ads = [ "https://blocklistproject.github.io/Lists/ads.txt" ]; + Crypto = [ "https://blocklistproject.github.io/Lists/crypto.txt" ]; + Drugs = [ "https://blocklistproject.github.io/Lists/drugs.txt" ]; + Everything = [ "https://blocklistproject.github.io/Lists/everything.txt" ]; + Facebook = [ "https://blocklistproject.github.io/Lists/facebook.txt" ]; + Fraud = [ "https://blocklistproject.github.io/Lists/fraud.txt" ]; + Gambling = [ "https://blocklistproject.github.io/Lists/gambling.txt" ]; + Malware = [ "https://blocklistproject.github.io/Lists/malware.txt" ]; + Phishing = [ "https://blocklistproject.github.io/Lists/phishing.txt" ]; + Piracy = [ "https://blocklistproject.github.io/Lists/piracy.txt" ]; + Porn = [ "https://blocklistproject.github.io/Lists/porn.txt" ]; + Ransomware = [ "https://blocklistproject.github.io/Lists/ransomware.txt" ]; + Redirect = [ "https://blocklistproject.github.io/Lists/redirect.txt" ]; + Scam = [ "https://blocklistproject.github.io/Lists/scam.txt" ]; + TikTok = [ "https://blocklistproject.github.io/Lists/tiktok.txt" ]; + Torrent = [ "https://blocklistproject.github.io/Lists/torrent.txt" ]; + Tracking = [ "https://blocklistproject.github.io/Lists/tracking.txt" ]; + }; +in +{ + services.blocky = { + enable = true; + settings = rec { + port = 53; # Standard DNS port + upstream.default = [ + # Using Cloudflare's DNS over HTTPS server for resolving queries. + "https://one.one.one.one/dns-query" + ]; + # For initially solving DoH/DoT Requests when no system Resolver is available. + bootstrapDns = { + upstream = "https://one.one.one.one/dns-query"; + ips = [ "1.1.1.1" "1.0.0.1" ]; + }; + # Enable Blocking of certain domains. + blocking = { + blackLists = { + inherit (fullBlocklistProjectTrackerList) Abuse Ads Crypto Drugs Fraud Gambling Malware Phishing Ransomware Scam Torrent Tracking; + }; + }; + # Configure what block categories are used + clientGroupsBlock = { + default = builtins.attrNames blocking.blackLists; + }; + }; + }; +} diff --git a/nixos/_mixins/services/firewall.nix b/nixos/_mixins/services/firewall.nix index 46027b3..90c763f 100644 --- a/nixos/_mixins/services/firewall.nix +++ b/nixos/_mixins/services/firewall.nix @@ -3,7 +3,7 @@ let # Firewall configuration variable for syncthing syncthing = { hosts = [ - "floki" + # "hostname" ]; tcpPorts = [ 22000 ]; udpPorts = [ 22000 21027 ]; @@ -13,10 +13,8 @@ in networking = { firewall = { enable = true; - allowedTCPPorts = [ ] - ++ lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.tcpPorts; - allowedUDPPorts = [ ] - ++ lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.udpPorts; + allowedTCPPorts = lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.tcpPorts; + allowedUDPPorts = lib.optionals (builtins.elem hostname syncthing.hosts) syncthing.udpPorts; }; }; } diff --git a/nixos/_mixins/services/fwupd.nix b/nixos/_mixins/services/fwupd.nix new file mode 100644 index 0000000..a327f04 --- /dev/null +++ b/nixos/_mixins/services/fwupd.nix @@ -0,0 +1,3 @@ +_: { + services.fwupd.enable = true; +} diff --git a/nixos/_mixins/services/homepage.nix b/nixos/_mixins/services/homepage.nix deleted file mode 100644 index 810b243..0000000 --- a/nixos/_mixins/services/homepage.nix +++ /dev/null @@ -1,39 +0,0 @@ -{ inputs, pkgs, ... }: -let - homepage-bookmarks = pkgs.writeTextFile { - name = "bookmarks.yaml"; - executable = false; - destination = "/var/lib/private/homepage-dashboard/bookmarks.yaml"; - text = '' - --- - # For configuration options and examples, please see: - # https://gethomepage.dev/en/configs/bookmarks - - - Developer: - - Github: - - abbr: GH - href: https://github.com/ - - - Social: - - Twitter: - - abbr: X - href: https://twitter.com/ - - - Entertainment: - - YouTube: - - abbr: YT - href: https://youtube.com/ - ''; - }; -in -{ - imports = [ "${inputs.nixpkgs-unstable}/nixos/modules/services/misc/homepage-dashboard.nix" ]; - - services.homepage-dashboard = { - enable = true; - package = pkgs.unstable.homepage-dashboard; - openFirewall = true; - }; - - environment.systemPackages = [ homepage-bookmarks ]; -} diff --git a/nixos/_mixins/services/jellyfin.compose.yaml b/nixos/_mixins/services/jellyfin.compose.yaml new file mode 100644 index 0000000..055c440 --- /dev/null +++ b/nixos/_mixins/services/jellyfin.compose.yaml @@ -0,0 +1,18 @@ +version: '3.5' +services: + jellyfin: + image: docker.io/jellyfin/jellyfin + container_name: jellyfin + user: root:root + # network_mode: 'host' + ports: + - 8096:8096 + volumes: + - /opt/jellyfin/config:/config + - /opt/jellyfin/cache:/cache + - /storage/hdds/plex:/media + # - /path/to/media2:/media2:ro + restart: 'unless-stopped' + # Optional - alternative address used for autodiscovery + environment: + - JELLYFIN_PublishedServerUrl=http://blck0.tail9c8a7.ts.net \ No newline at end of file diff --git a/nixos/_mixins/services/jellyfin.nix b/nixos/_mixins/services/jellyfin.nix new file mode 100644 index 0000000..0390162 --- /dev/null +++ b/nixos/_mixins/services/jellyfin.nix @@ -0,0 +1,26 @@ +{ pkgs, ... }: +let + jellyUserGroup = "jellyfin"; +in +{ + users.users."${jellyUserGroup}" = { + description = "Jellyfin Server"; + group = jellyUserGroup; + isSystemUser = true; + isNormalUser = false; + }; + users.groups."${jellyUserGroup}" = { }; + + services.jellyfin = { + enable = true; + openFirewall = true; + user = jellyUserGroup; + group = jellyUserGroup; + }; + + environment.systemPackages = with pkgs; [ + jellyfin + jellyfin-web + jellyfin-ffmpeg + ]; +} diff --git a/nixos/_mixins/services/netbird-autoconnect.nix b/nixos/_mixins/services/netbird-autoconnect.nix new file mode 100644 index 0000000..def7506 --- /dev/null +++ b/nixos/_mixins/services/netbird-autoconnect.nix @@ -0,0 +1,41 @@ +{ config, pkgs, ... }: +{ + imports = [ ./netbird.nix ]; + + # Mounts the secrets file + age.secrets.netbird-token = { + file = ../../../secrets/services/netbird/token.age; + owner = "root"; + group = "root"; + mode = "600"; + }; + + systemd.services.netbird-autoconnect = { + description = "Automatic connection to Netbird"; + + # make sure netbird is running before trying to connect to netbird + after = [ "network-pre.target" "netbird.service" ]; + wants = [ "network-pre.target" "netbird.service" "run-agenix.d.mount" ]; + wantedBy = [ "multi-user.target" ]; + + # set this service as a oneshot job + serviceConfig.Type = "oneshot"; + + # have the job run this shell script + script = with pkgs; '' + # wait for netbird to settle + sleep 2 + + # check if we are already authenticated to netbird + set +e + ${netbird}/bin/netbird status | grep -e LoginFailed + if [ $? -gt 0 ]; then # if so, then do nothing + exit 0 + fi + set -e + + # otherwise authenticate with netbird + ${netbird}/bin/netbird up -k "$(cat "${config.age.secrets.netbird-token.path}")" + ''; + }; +} diff --git a/nixos/_mixins/services/netbird.nix b/nixos/_mixins/services/netbird.nix new file mode 100644 index 0000000..2e65013 --- /dev/null +++ b/nixos/_mixins/services/netbird.nix @@ -0,0 +1,13 @@ +{ pkgs, lib, desktop, ... }: { + environment.systemPackages = lib.optionals (desktop != null) [ + pkgs.netbird-ui + ]; + + services.netbird.enable = true; + + networking = { + firewall = { + # trustedInterfaces = [ "tailscale0" ]; + }; + }; +} diff --git a/nixos/_mixins/services/networkmanager.nix b/nixos/_mixins/services/networkmanager.nix index 8dda87e..06b7fd4 100644 --- a/nixos/_mixins/services/networkmanager.nix +++ b/nixos/_mixins/services/networkmanager.nix @@ -1,17 +1,12 @@ -{ pkgs, ... }: +_: { networking = { networkmanager = { enable = true; - # Use AdGuard Public DNS with ad/tracker blocking - # - https://adguard-dns.io/en/public-dns.html - insertNameservers = [ "94.140.14.14" "94.140.15.15" ]; wifi = { backend = "iwd"; - powersave = false; }; }; - wireless.iwd.package = pkgs.unstable.iwd; }; # Workaround https://github.com/NixOS/nixpkgs/issues/180175 systemd.services.NetworkManager-wait-online.enable = false; diff --git a/nixos/_mixins/services/nextcloud.nix b/nixos/_mixins/services/nextcloud.nix new file mode 100644 index 0000000..8ffbcd4 --- /dev/null +++ b/nixos/_mixins/services/nextcloud.nix @@ -0,0 +1,56 @@ +# Reference: https://carjorvaz.com/posts/the-holy-grail-nextcloud-setup-made-easy-by-nixos/ + +{ config, lib, pkgs, ... }: +let + fqdn = "onlyoffice.${config.domainName}"; +in +{ + services = { + nginx.virtualHosts."${fqdn}" = { + forceSSL = true; + enableACME = true; + }; + + nextcloud = { + enable = true; + hostName = fqdn; + + # Need to manually increment with every major upgrade. + package = pkgs.nextcloud28; + + # Let NixOS install and configure the database automatically. + database.createLocally = true; + + # Let NixOS install and configure Redis caching automatically. + configureRedis = true; + + # Increase the maximum file upload size to avoid problems uploading videos. + maxUploadSize = lib.mkDefault "16G"; + https = true; + enableBrokenCiphersForSSE = false; + + autoUpdateApps.enable = true; + extraAppsEnable = true; + extraApps = with config.services.nextcloud.package.packages.apps; { + # List of apps we want to install and are already packaged in + # https://github.com/NixOS/nixpkgs/blob/master/pkgs/servers/nextcloud/packages/nextcloud-apps.json + inherit calendar contacts mail notes onlyoffice tasks; + + # Custom app installation example. + # cookbook = pkgs.fetchNextcloudApp rec { + # url = + # "https://github.com/nextcloud/cookbook/releases/download/v0.10.2/Cookbook-0.10.2.tar.gz"; + # sha256 = "sha256-XgBwUr26qW6wvqhrnhhhhcN4wkI+eXDHnNSm1HDbP6M="; + # }; + }; + + config = { + overwriteProtocol = "https"; + defaultPhoneRegion = "PT"; + dbtype = "pgsql"; + adminuser = "admin"; + adminpassFile = "/path/to/nextcloud-admin-pass"; + }; + }; + }; +} diff --git a/nixos/_mixins/services/nixified-ai.nix b/nixos/_mixins/services/nixified-ai.nix new file mode 100644 index 0000000..2640b0e --- /dev/null +++ b/nixos/_mixins/services/nixified-ai.nix @@ -0,0 +1,6 @@ +_: { + nix.settings = { + trusted-substituters = [ "https://ai.cachix.org" ]; + trusted-public-keys = [ "ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc=" ]; + }; +} diff --git a/nixos/_mixins/services/nordvpn.nix b/nixos/_mixins/services/nordvpn.nix new file mode 100644 index 0000000..e4f23d6 --- /dev/null +++ b/nixos/_mixins/services/nordvpn.nix @@ -0,0 +1,6 @@ +{ config, ... }: { + chaotic.nordvpn.enable = true; + + networking.firewall.allowedTCPPorts = if config.networking.firewall.enable then [ 443 ] else [ ]; + networking.firewall.allowedUDPPorts = if config.networking.firewall.enable then [ 1194 ] else [ ]; +} diff --git a/nixos/_mixins/services/onlyoffice.nix b/nixos/_mixins/services/onlyoffice.nix new file mode 100644 index 0000000..1bbbe01 --- /dev/null +++ b/nixos/_mixins/services/onlyoffice.nix @@ -0,0 +1,19 @@ +# Reference: https://carjorvaz.com/posts/the-holy-grail-nextcloud-setup-made-easy-by-nixos/ + +{ config, ... }: +let + fqdn = "onlyoffice.${config.domainName}"; +in +{ + services = { + nginx.virtualHosts."${fqdn}" = { + forceSSL = true; + enableACME = true; + }; + + onlyoffice = { + enable = true; + hostname = fqdn; + }; + }; +} diff --git a/nixos/_mixins/services/openrazer.nix b/nixos/_mixins/services/openrazer.nix index 64ad665..60f9382 100644 --- a/nixos/_mixins/services/openrazer.nix +++ b/nixos/_mixins/services/openrazer.nix @@ -1,6 +1,6 @@ -{ desktop, pkgs, username, ... }: +{ pkgs, username, ... }: { - environment.systemPackages = with pkgs; [ ] ++ lib.optionals (desktop != null) [ + environment.systemPackages = with pkgs; [ polychromatic ]; diff --git a/nixos/_mixins/services/openssh.nix b/nixos/_mixins/services/openssh.nix index 61d36ef..0dc77da 100644 --- a/nixos/_mixins/services/openssh.nix +++ b/nixos/_mixins/services/openssh.nix @@ -1,8 +1,5 @@ -{ outputs, lib, config, ... }: +{ lib, config, ... }: let - hosts = outputs.nixosConfigurations; - pubKey = host: ../../${host}/ssh_host_ed25519_key.pub; - # Sops needs acess to the keys before the persist dirs are even mounted; so # just persisting the keys won't work, we must point at /persist hasOptinPersistence = config.environment.persistence ? "/persist"; @@ -29,24 +26,13 @@ in enable = true; whitelist = [ # TODO - "192.168.7.0/24" + "192.168.40.0/24" + "10.0.0.0/8" + "100.0.0.0/8" ]; }; }; - programs.ssh = { - # Each hosts public key - knownHosts = builtins.mapAttrs - (name: _: { - publicKeyFile = pubKey name; - # extraHostNames = - # (lib.optional (name == hostName) "localhost") ++ # Alias for localhost if it's the same host - # (lib.optionals (name == gitHost) [ "burd.me" "git.burd.me" ]); - }) - hosts; - startAgent = true; - }; - networking.firewall.allowedTCPPorts = [ 22 ]; # Passwordless sudo when SSH'ing with keys diff --git a/nixos/_mixins/services/pipewire.nix b/nixos/_mixins/services/pipewire.nix index 1555981..11ffc1b 100644 --- a/nixos/_mixins/services/pipewire.nix +++ b/nixos/_mixins/services/pipewire.nix @@ -7,8 +7,9 @@ ] ++ lib.optionals (desktop != null) [ pavucontrol ]; - - hardware.pulseaudio.enable = false; + hardware = { + pulseaudio.enable = lib.mkForce false; + }; security.rtkit.enable = true; services = { pipewire = { diff --git a/nixos/_mixins/services/sane.nix b/nixos/_mixins/services/sane.nix index fa9a206..a9ca82e 100644 --- a/nixos/_mixins/services/sane.nix +++ b/nixos/_mixins/services/sane.nix @@ -1,7 +1,5 @@ { desktop, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ ] ++ lib.optionals (desktop != null) [ - gnome.simple-scan - ]; + imports = lib.optional (builtins.isString desktop) ../desktop/simple-scan.nix; hardware = { sane = { diff --git a/nixos/_mixins/services/t510-dvd-nbd-mount.nix b/nixos/_mixins/services/t510-dvd-nbd-mount.nix new file mode 100644 index 0000000..aa0acf8 --- /dev/null +++ b/nixos/_mixins/services/t510-dvd-nbd-mount.nix @@ -0,0 +1,22 @@ +{ pkgs, ... }: +{ + boot.kernelModules = [ "nbd" ]; + + environment.systemPackages = with pkgs; [ nbd ]; + + systemd.services.t510-dvd-nbd-mount = { + description = "Automatic network mounting via NBD of T510 DVD drive"; + + # make sure tailscale is running before trying to connect to tailscale + after = [ "network-pre.target" "tailscale.service" ]; + wants = [ "network-pre.target" "tailscale.service" ]; + wantedBy = [ "multi-user.target" ]; + + serviceConfig = { + Type = "oneshot"; + ExecStart = "${pkgs.nbd}/bin/nbd-client -N dvd-drive t510 10809 /dev/nbd0"; + ExecStop = "${pkgs.nbd}/bin/nbd-client -d /dev/sr0"; + RemainAfterExit = "yes"; + }; + }; +} diff --git a/nixos/_mixins/services/tailscale-autoconnect.nix b/nixos/_mixins/services/tailscale-autoconnect.nix new file mode 100644 index 0000000..2de8971 --- /dev/null +++ b/nixos/_mixins/services/tailscale-autoconnect.nix @@ -0,0 +1,39 @@ +{ config, pkgs, ... }: +{ + imports = [ ./tailscale.nix ]; + + # Mounts the secrets file + age.secrets.tailscale-token = { + file = ../../../secrets/services/tailscale/token.age; + owner = "root"; + group = "root"; + mode = "600"; + }; + + systemd.services.tailscale-autoconnect = { + description = "Automatic connection to Tailscale"; + + # make sure tailscale is running before trying to connect to tailscale + after = [ "network-pre.target" "tailscale.service" ]; + wants = [ "network-pre.target" "tailscale.service" "run-agenix.d.mount" ]; + wantedBy = [ "multi-user.target" ]; + + # set this service as a oneshot job + serviceConfig.Type = "oneshot"; + + # have the job run this shell script + script = with pkgs; '' + # wait for tailscaled to settle + sleep 2 + + # check if we are already authenticated to tailscale + status="$(${tailscale}/bin/tailscale status -json | ${jq}/bin/jq -r .BackendState)" + if [ $status = "Running" ]; then # if so, then do nothing + exit 0 + fi + + # otherwise authenticate with tailscale + ${tailscale}/bin/tailscale up -authkey "$(cat "${config.age.secrets.tailscale-token.path}")" + ''; + }; +} diff --git a/nixos/_mixins/services/tailscale.nix b/nixos/_mixins/services/tailscale.nix index 3945838..9cba4f3 100644 --- a/nixos/_mixins/services/tailscale.nix +++ b/nixos/_mixins/services/tailscale.nix @@ -1,5 +1,8 @@ -{ config, ... }: { +{ config, pkgs, ... }: { + environment.systemPackages = with pkgs; [ tailscale ]; + services.tailscale.enable = true; + networking = { firewall = { checkReversePath = "loose"; diff --git a/nixos/_mixins/services/unfree.nix b/nixos/_mixins/services/unfree.nix new file mode 100644 index 0000000..68fef81 --- /dev/null +++ b/nixos/_mixins/services/unfree.nix @@ -0,0 +1,3 @@ +{ lib ? { mkForce = x: x; }, ... }: { + nixpkgs.config.allowUnfree = lib.mkForce true; +} diff --git a/nixos/_mixins/services/vscode-server.nix b/nixos/_mixins/services/vscode-server.nix new file mode 100644 index 0000000..66eb84c --- /dev/null +++ b/nixos/_mixins/services/vscode-server.nix @@ -0,0 +1,7 @@ +{ inputs, ... }: { + imports = [ + inputs.vscode-server.nixosModules.default + ]; + + services.vscode-server.enable = true; +} diff --git a/nixos/_mixins/services/xdg-portal.nix b/nixos/_mixins/services/xdg-portal.nix new file mode 100644 index 0000000..eeb7f25 --- /dev/null +++ b/nixos/_mixins/services/xdg-portal.nix @@ -0,0 +1,6 @@ +_: { + xdg.portal = { + enable = true; + xdgOpenUsePortal = true; + }; +} diff --git a/nixos/_mixins/services/yubikey.nix b/nixos/_mixins/services/yubikey.nix new file mode 100644 index 0000000..8649038 --- /dev/null +++ b/nixos/_mixins/services/yubikey.nix @@ -0,0 +1,8 @@ +_: +{ + # enables Yubikey + security.pam.services = { + login.u2fAuth = true; + sudo.u2fAuth = true; + }; +} diff --git a/nixos/_mixins/users/_gburd/default.nix b/nixos/_mixins/users/_gburd/default.nix index 08b78b3..57c786b 100644 --- a/nixos/_mixins/users/_gburd/default.nix +++ b/nixos/_mixins/users/_gburd/default.nix @@ -1,4 +1,4 @@ -{ config, desktop, hostname, inputs, lib, pkgs, ... }: +{ config, desktop, inputs, lib, pkgs, ... }: let ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; in @@ -27,8 +27,7 @@ in #unstable.google-chrome ]; - services = { - }; + services = { }; users.users.gburd = { extraGroups = [ diff --git a/nixos/_mixins/users/gburd/default.nix b/nixos/_mixins/users/gburd/default.nix index 4b4a7ee..231b763 100644 --- a/nixos/_mixins/users/gburd/default.nix +++ b/nixos/_mixins/users/gburd/default.nix @@ -1,61 +1,18 @@ -{ config, desktop, hostname, inputs, lib, pkgs, ... }: +{ config, desktop, lib, pkgs, sshMatrix, ... }: let - ifTheyExist = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; + ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; in { - imports = [ - inputs.vscode-server.nixosModules.default - ] ++ lib.optionals (desktop != null) [ - ../../desktop/chromium.nix - ../../desktop/chromium-extensions.nix - ../../desktop/obs-studio.nix - ../../desktop/vscode.nix - ../../desktop/${desktop}-apps.nix - ]; + # Only include desktop components if one is supplied. + imports = lib.optional (builtins.isString desktop) ./desktop.nix; environment.systemPackages = with pkgs; [ - aria2 - croc - rclone - curl - #yadm # Terminal dot file manager - zsync - ] ++ lib.optionals (desktop != null) [ - appimage-run - authy - chatterino2 - gimp-with-plugins - gnome.gnome-clocks - irccloud - inkscape - #libreoffice - pick-colour-picker - wmctrl - xdotool - ydotool - zoom-us - - # Fast moving apps use the unstable branch - unstable.discord - unstable.google-chrome - unstable.vivaldi - unstable.vivaldi-ffmpeg-codecs + yadm # Terminal dot file manager + neovim ]; - services = { - aria2 = { - enable = true; - openPorts = true; - rpcSecret = "${hostname}"; - }; - croc = { - enable = true; - pass = "${hostname}"; - openFirewall = true; - }; - }; - users.users.gburd = { + description = "Greg Burd"; extraGroups = [ "audio" "input" @@ -63,25 +20,18 @@ in "users" "video" "wheel" - ] ++ ifTheyExist [ - "deluge" + ] + ++ ifExists [ "docker" - "git" - "i2c" - "libvirtd" - "network" "podman" - "wireshark" ]; + # mkpasswd -m sha-512 + # TODO: hashedPasswordFile = config.sops.secrets.gburd-password.path; + hashedPassword = "$6$RDOZHdTwt.BuOR4C$fYDkyb3yppbgX0ewPbsKabS2u9W.wyrRJONQPtugrO/gBJCzsWkfVIVYOAj07Qar1yqeYJBlBkYSFAgGe5ssw."; homeMode = "0755"; isNormalUser = true; - hashedPassword = "$6$RDOZHdTwt.BuOR4C$fYDkyb3yppbgX0ewPbsKabS2u9W.wyrRJONQPtugrO/gBJCzsWkfVIVYOAj07Qar1yqeYJBlBkYSFAgGe5ssw."; - # TODO: hashedPasswordFile = config.sops.secrets.gburd-password.path; - openssh.authorizedKeys.keys = [ - (builtins.readFile ../../../../home-manager/_mixins/users/gburd/ssh.pub) - (builtins.readFile ../../../../home-manager/_mixins/users/gburd/symas-ssh.pub) - ]; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; packages = [ pkgs.home-manager ]; shell = pkgs.fish; }; diff --git a/nixos/_mixins/users/gburd/desktop.nix b/nixos/_mixins/users/gburd/desktop.nix new file mode 100644 index 0000000..fe07438 --- /dev/null +++ b/nixos/_mixins/users/gburd/desktop.nix @@ -0,0 +1,32 @@ +{ desktop, pkgs, lib, ... }: { + imports = [ + ../../desktop/chromium.nix + ../../desktop/chromium-extensions.nix + ../../desktop/firefox.nix + ../../desktop/google-chrome.nix + ../../desktop/lutris.nix + ../../desktop/spotify.nix + ../../desktop/tilix.nix + ../../desktop/vscode.nix + ../../desktop/jetbrains-toolbox.nix + ] + ++ lib.optional (builtins.pathExists (../.. + "/desktop/${desktop}.nix")) ../../desktop/${desktop}.nix + ++ lib.optional (builtins.pathExists (../.. + "/desktop/${desktop}-apps.nix")) ../../desktop/${desktop}-apps.nix; + + environment.systemPackages = with pkgs; [ + authy + audio-recorder + gimp-with-plugins + gnome.gnome-clocks + gnome.dconf-editor + gnome.gnome-sound-recorder + inkscape + irccloud + libreoffice + meld + pick-colour-picker + slack + neovide + zoom-us + ]; +} diff --git a/nixos/_mixins/users/nixos/default.nix b/nixos/_mixins/users/nixos/default.nix index d624aa4..1a8df03 100644 --- a/nixos/_mixins/users/nixos/default.nix +++ b/nixos/_mixins/users/nixos/default.nix @@ -1,4 +1,4 @@ -{ config, desktop, lib, pkgs, username, ... }: +{ config, desktop, lib, pkgs, sshMatrix, username, ... }: let ifExists = groups: builtins.filter (group: builtins.hasAttr group config.users.groups) groups; install-system = pkgs.writeScriptBin "install-system" '' @@ -8,6 +8,7 @@ let TARGET_HOST="''${1:-}" TARGET_USER="''${2:-gburd}" + TARGET_TYPE="''${3:-}" if [ "$(id -u)" -eq 0 ]; then echo "ERROR! $(basename "$0") should be run as a regular user" @@ -34,14 +35,23 @@ let exit 1 fi - if [ ! -e "nixos/$TARGET_HOST/disks.nix" ]; then - echo "ERROR! $(basename "$0") could not find the required nixos/$TARGET_HOST/disks.nix" + if [[ -z "$TARGET_TYPE" ]]; then + echo "ERROR! $(basename "$0") requires a type as the third argument" + echo " The following types are available" + ls -1 nixos/ | grep -v -E "nixos|root|_mixins" + exit 1 + fi + + TARGET_HOST_ROOT="nixos/$TARGET_TYPE/$TARGET_HOST" + + if [ ! -e "$TARGET_HOST_ROOT/disks.nix" ]; then + echo "ERROR! $(basename "$0") could not find the required $TARGET_HOST_ROOT/disks.nix" exit 1 fi # Check if the machine we're provisioning expects a keyfile to unlock a disk. # If it does, generate a new key, and write to a known location. - if grep -q "data.keyfile" "nixos/$TARGET_HOST/disks.nix"; then + if grep -q "data.keyfile" "$TARGET_HOST_ROOT/disks.nix"; then echo -n "$(head -c32 /dev/random | base64)" > /tmp/data.keyfile fi @@ -59,13 +69,20 @@ let --no-write-lock-file \ -- \ --mode zap_create_mount \ - "nixos/$TARGET_HOST/disks.nix" + "$TARGET_HOST_ROOT/disks.nix" sudo nixos-install --no-root-password --flake ".#$TARGET_HOST" + if [[ "$TARGET_USER" == "root" ]]; then + TARGET_USER_HOME="/mnt/root" + else + TARGET_USER_HOME="/mnt/home/$TARGET_USER" + fi + # Rsync nix-config to the target install and set the remote origin to SSH. - rsync -a --delete "$HOME/ws/" "/mnt/home/$TARGET_USER/gburd/" - pushd "/mnt/home/$TARGET_USER/gburd/nix-config" + mkdir -p "$TARGET_USER_HOME" + rsync -a --delete "$HOME/ws/" "$TARGET_USER_HOME/ws/" + pushd "$TARGET_USER_HOME/ws/nix-config" git remote set-url origin git@github.com:gburd/nix-config.git popd @@ -80,7 +97,10 @@ let in { # Only include desktop components if one is supplied. - imports = [ ] ++ lib.optional (desktop != null) ./desktop.nix; + imports = lib.optional (builtins.isString desktop) ./desktop.nix; + + # TODO: Determine cause of error in + # nix.registry.nixpkgs.to.path config.users.users.nixos = { description = "NixOS"; @@ -95,11 +115,18 @@ in "docker" "podman" ]; + group = "nixos"; + isNormalUser = true; homeMode = "0755"; - openssh.authorizedKeys.keys = [ (builtins.readFile ../../../home/gburd/ssh.pub) ]; + + # mkpasswd -m sha-512 + hashedPassword = "$6$Dq4WmzyLjQUTyXT1$0Ll5rZ0R33qfGnEmAOZQuh.6udRN19luImYAmqsCKxfV14yHQ8vt9B/pf945..r1jTmlu7wfAXSe7kfoBm9jK0"; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + packages = [ pkgs.home-manager ]; shell = pkgs.fish; }; + config.users.groups.nixos = { }; config.system.stateVersion = lib.mkForce lib.trivial.release; config.environment.systemPackages = [ install-system ]; diff --git a/nixos/_mixins/users/pxe/default.nix b/nixos/_mixins/users/pxe/default.nix new file mode 100644 index 0000000..adc9f5e --- /dev/null +++ b/nixos/_mixins/users/pxe/default.nix @@ -0,0 +1,8 @@ +{ sshMatrix, ... }: +{ + users.users.pxe = { + # mkpasswd -m sha-512 + hashedPassword = "$6$P.52FPzkhqEhwBXH$YAdjuSoboOkgQs6y5JBKOyknQ8Hb.hgsfTPv8ehuI9oyTUbgCp8fD2TsqpDQM8qanmounKKitrcFg4b7aY7Ap0"; + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + }; +} diff --git a/nixos/_mixins/users/root/default.nix b/nixos/_mixins/users/root/default.nix index 3588718..3f5112b 100644 --- a/nixos/_mixins/users/root/default.nix +++ b/nixos/_mixins/users/root/default.nix @@ -1,7 +1,10 @@ -_: +{ lib, ... }: { users.users.root = { - hashedPassword = null; - openssh.authorizedKeys.keys = [ (builtins.readFile ../../../../home-manager/_mixins/users/gburd/ssh.pub) ]; + # mkpasswd -m sha-512 + hashedPassword = "$6$Dq4WmzyLjQUTyXT1$0Ll5rZ0R33qfGnEmAOZQuh.6udRN19luImYAmqsCKxfV14yHQ8vt9B/pf945..r1jTmlu7wfAXSe7kfoBm9jK0"; + openssh.authorizedKeys.keys = [ ]; }; + + services.openssh.settings.PermitRootLogin = lib.mkDefault "no"; } diff --git a/nixos/_mixins/virt/default.nix b/nixos/_mixins/virt/default.nix index 5d07da1..38e3b3c 100644 --- a/nixos/_mixins/virt/default.nix +++ b/nixos/_mixins/virt/default.nix @@ -1,23 +1,11 @@ -{ config, desktop, lib, pkgs, ... }: { - environment.systemPackages = with pkgs; [ - fuse-overlayfs - ] ++ lib.optionals (desktop != null) [ - unstable.quickemu - unstable.quickgui - xorg.xhost - ]; - - virtualisation = { - containers.enable = true; - containers.storage.settings = { - storage = { - driver = "overlay"; - runroot = "/run/containers/storage"; - graphroot = "/var/lib/containers/storage"; - rootless_storage_path = "/tmp/containers-$USER"; - options.overlay.mountopt = "nodev,metacopy=on,acltype=posixacl"; - }; - }; - }; - +{ desktop, lib, ... }: +{ + imports = + [ + ./docker.nix + # ./podman.nix + ] + ++ lib.optional (builtins.isString desktop) ./desktop.nix; + # TODO: Make containerization tools dynamic + # ++ lib.optional (builtins.isString containerization) ./${containerization}.nix; } diff --git a/nixos/_mixins/virt/desktop.nix b/nixos/_mixins/virt/desktop.nix new file mode 100644 index 0000000..6a78090 --- /dev/null +++ b/nixos/_mixins/virt/desktop.nix @@ -0,0 +1,8 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + unstable.quickemu + # for running X11 apps in distrobox + xorg.xhost + ]; +} diff --git a/nixos/_mixins/virt/docker.nix b/nixos/_mixins/virt/docker.nix index 41073e3..79e84f1 100644 --- a/nixos/_mixins/virt/docker.nix +++ b/nixos/_mixins/virt/docker.nix @@ -1,14 +1,18 @@ -{ pkgs, lib, config, ... }: { +{ desktop, lib, pkgs, ... }: +{ + imports = lib.optional (builtins.isString desktop) ./desktop.nix; - # https://nixos.wiki/wiki/Docker - environment.systemPackages = with pkgs; [ docker-compose ]; + #https://nixos.wiki/wiki/Docker + environment.systemPackages = with pkgs; [ + docker-compose + ]; - virtualisation.docker = { - enable = true; - # rootless = { TODO + virtualisation = { + docker.enable = true; + docker.storageDriver = lib.mkDefault "overlay2"; + # docker.rootless = { TODO # enable = true; # setSocketVariable = true; # }; }; - } diff --git a/nixos/_mixins/virt/podman.nix b/nixos/_mixins/virt/podman.nix index 0fe2c76..3cf592b 100644 --- a/nixos/_mixins/virt/podman.nix +++ b/nixos/_mixins/virt/podman.nix @@ -1,34 +1,38 @@ { config, desktop, lib, pkgs, ... }: -let - dockerEnabled = config.virtualisation.docker.enable; -in +#let +# dockerEnabled = config.virtualisation.docker.enable; +#in { + imports = lib.optional (builtins.isString desktop) ./desktop.nix; - # https://nixos.wiki/wiki/Podman + #https://nixos.wiki/wiki/Podman environment.systemPackages = with pkgs; [ - unstable.distrobox + buildah + distrobox + fuse-overlayfs podman-compose podman-tui - ] ++ lib.optionals (desktop != null) [ - unstable.pods - podman-desktop ]; - virtualisation.podman = { - enable = true; - dockerCompat = !dockerEnabled; - dockerSocket.enable = !dockerEnabled; - defaultNetwork.settings.dns_enabled = true; - enableNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers; + virtualisation = { + podman = { + defaultNetwork.settings = { + dns_enabled = true; + }; + dockerCompat = true; #!dockerEnabled; + #dockerSocket.enable = !dockerEnabled; + enable = true; + enableNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers; + }; }; - virtualisation.oci-containers.backend = lib.mkIf (!dockerEnabled) "podman"; + # virtualisation.oci-containers.backend = lib.mkIf (!dockerEnabled) "podman"; - environment.extraInit = lib.mkIf (!dockerEnabled) - '' - if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then - export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock" - fi - ''; + # environment.extraInit = lib.mkIf (!dockerEnabled) + # '' + # if [ -z "$DOCKER_HOST" -a -n "$XDG_RUNTIME_DIR" ]; then + # export DOCKER_HOST="unix://$XDG_RUNTIME_DIR/podman/podman.sock" + # fi + # ''; } diff --git a/nixos/default.nix b/nixos/default.nix index 8e38112..929bd05 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,24 +1,19 @@ -{ config, desktop, hostname, inputs, lib, modulesPath, outputs, pkgs, platform, stateVersion, username, ... }: -let - # Only enable auto upgrade if current config came from a clean tree - # This avoids accidental auto-upgrades when working locally. - isClean = inputs.self ? rev; -in -{ +{ config, desktop, hostname, inputs, lib, modulesPath, outputs, pkgs, stateVersion, systemType, username, ... }: { imports = [ inputs.disko.nixosModules.disko (modulesPath + "/installer/scan/not-detected.nix") - ./${hostname} + ./${systemType}/${hostname} ./_mixins/sops.nix ./_mixins/optin-persistence.nix ./_mixins/services/firewall.nix + ./_mixins/services/fwupd.nix ./_mixins/services/kmscon.nix ./_mixins/services/openssh.nix ./_mixins/services/smartmon.nix ./_mixins/users/root ] - ++ lib.optional (builtins.pathExists (./. + "/_mixins/users/${username}")) ./_mixins/users/${username} - ++ lib.optional (desktop != null) ./_mixins/desktop; + ++ lib.optional (builtins.isString username) ./_mixins/users/${username} + ++ lib.optional (builtins.isString desktop) ./_mixins/desktop; boot = { consoleLogLevel = 0; @@ -40,10 +35,11 @@ in }; console = { - packages = with pkgs; [ terminus_font ]; font = "${pkgs.terminus_font}/share/consolefonts/ter-132n.psf.gz"; useXkbConfig = true; # use xkbOptions, in this case swap caps-lock and ctrl, in tty. earlySetup = true; + keyMap = "us"; + packages = with pkgs; [ terminus_font ]; }; i18n = { @@ -85,15 +81,18 @@ in ]; documentation.enable = true; + documentation.nixos.enable = false; documentation.man.enable = true; + documentation.info.enable = false; + documentation.doc.enable = false; environment = { # Eject nano and perl from the system defaultPackages = with pkgs; lib.mkForce [ gitMinimal home-manager - micro rsync + vim ]; systemPackages = with pkgs; [ agenix @@ -102,12 +101,11 @@ in unzip usbutils wget -# inputs.fh.packages.${platform}.default ]; variables = { - EDITOR = "vi"; - SYSTEMD_EDITOR = "vi"; - VISUAL = "vi"; + EDITOR = "vim"; + SYSTEMD_EDITOR = "vim"; + VISUAL = "vim"; }; enableAllTerminfo = true; }; @@ -118,9 +116,9 @@ in (nerdfonts.override { fonts = [ "FiraCode" "SourceCodePro" "UbuntuMono" ]; }) fira fira-go - joypixels + joypixels # Emojis liberation_ttf - noto-fonts-emoji + noto-fonts-emoji # Emojis source-serif ubuntu_font_family work-sans @@ -152,11 +150,7 @@ in # Use passed hostname to configure basic networking networking = { - extraHosts = '' - 192.168.7.1 router eero - ''; hostName = hostname; - domain = "burd.me"; useDHCP = lib.mkDefault true; }; @@ -169,8 +163,10 @@ in outputs.overlays.additions outputs.overlays.modifications outputs.overlays.unstable-packages + outputs.overlays.trunk-packages # You can also add overlays exported from other flakes: + # neovim-nightly-overlay.overlays.default inputs.agenix.overlays.default # Or define it inline, for example: @@ -206,7 +202,6 @@ in optimise.automatic = true; package = pkgs.unstable.nix; settings = { - trusted-users = [ "root" "@wheel" ]; auto-optimise-store = true; experimental-features = [ "nix-command" "flakes" ]; system-features = [ "kvm" "big-parallel" "nixos-test" ]; @@ -215,6 +210,8 @@ in keep-outputs = true; keep-derivations = true; + trusted-users = [ username "root" "@wheel" ]; + warn-dirty = false; }; }; @@ -256,18 +253,32 @@ in set -U fish_pager_color_progress brwhite '--background=cyan' ''; shellAbbrs = { - nix-gc = "sudo nix-collect-garbage --delete-older-than 10d && nix-collect-garbage --delete-older-than 10d"; - rebuild-all = "sudo nixos-rebuild switch --flake $HOME/ws/nix-config && home-manager switch -b backup --flake $HOME/ws/nix-config"; + nix-gc = "sudo nix-collect-garbage --delete-older-than 28d"; + + rebuild-all = "sudo nix-collect-garbage --delete-older-than 28d && sudo nixos-rebuild switch --flake $HOME/ws/nix-config && home-manager switch -b backup --flake $HOME/ws/nix-config"; rebuild-home = "home-manager switch -b backup --flake $HOME/ws/nix-config"; rebuild-host = "sudo nixos-rebuild switch --flake $HOME/ws/nix-config"; - rebuild-lock = "pushd $HOME/ws/nix-config && nix flake update && popd"; + rebuild-lock = "pushd $HOME/ws/nix-config && nix flake lock --recreate-lock-file && popd"; + + modify-secret = "agenix -i ~/.ssh/id_rsa -e"; # the path relative to /secrets must be passed without `./` + rebuild-iso-console = "sudo true && pushd $HOME/ws/nix-config && nix build .#nixosConfigurations.iso-console.config.system.build.isoImage && set ISO (head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) && sudo cp result/iso/$ISO ~/Quickemu/nixos-console/nixos.iso && popd"; + test-iso-console = "pushd ~/Quickemu/ && quickemu --vm nixos-console.conf --ssh-port 54321 && popd"; + rebuild-iso-desktop = "sudo true && pushd $HOME/ws/nix-config && nix build .#nixosConfigurations.iso-desktop.config.system.build.isoImage && set ISO (head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) && sudo cp result/iso/$ISO ~/Quickemu/nixos-desktop/nixos.iso && popd"; - rebuild-iso-gpd-edp = "sudo true && pushd $HOME/ws/nix-config && nix build .#nixosConfigurations.iso-gpd-edp.config.system.build.isoImage && set ISO (head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) && sudo cp result/iso/$ISO ~/Quickemu/nixos-gpd-edp.iso && popd"; - rebuild-iso-gpd-dsi = "sudo true && pushd $HOME/ws/nix-config && nix build .#nixosConfigurations.iso-gpd-dsi.config.system.build.isoImage && set ISO (head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) && sudo cp result/iso/$ISO ~/Quickemu/nixos-gpd-dsi.iso && popd"; + test-iso-desktop = "pushd ~/Quickemu/ && quickemu --vm nixos-desktop.conf --ssh-port 54321 && popd"; + + rebuild-iso-nuc = "sudo true && pushd $HOME/ws/nix-config && nix build .#nixosConfigurations.iso-nuc.config.system.build.isoImage && set ISO (head -n1 result/nix-support/hydra-build-products | cut -d'/' -f6) && sudo cp result/iso/$ISO ~/Quickemu/nixos-nuc/nixos.iso && popd"; + test-iso-nuc = "pushd ~/Quickemu/ && quickemu --vm nixos-nuc.conf --ssh-port 54321 && popd"; }; shellAliases = { - nano = "micro"; + moon = "curl -s wttr.in/Moon"; + nano = "vim"; + open = "xdg-open"; + pubip = "curl -s ifconfig.me/ip"; + #pubip = "curl -s https://api.ipify.org"; + wttr = "curl -s wttr.in && curl -s v2.wttr.in"; + wttr-bas = "curl -s wttr.in/Cambridge,%20MA && curl -s v2.wttr.in/Cambridge,%20MA"; }; }; }; @@ -285,27 +296,5 @@ in ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" ''; }; - - system.autoUpgrade = { - enable = isClean; - dates = "hourly"; - flags = [ - "--refresh" - ]; - flake = "git://github.com/gburd/nix-config?ref=release-${hostname}"; - }; - - # Only run if current config (self) is older than the new one. - systemd.services.nixos-upgrade = lib.mkIf config.system.autoUpgrade.enable { - serviceConfig.ExecCondition = lib.getExe ( - pkgs.writeShellScriptBin "check-date" '' - lastModified() { - nix flake metadata "$1" --refresh --json | ${lib.getExe pkgs.jq} '.lastModified' - } - test "$(lastModified "${config.system.autoUpgrade.flake}")" -gt "$(lastModified "self")" - '' - ); - }; - system.stateVersion = stateVersion; } diff --git a/nixos/floki/default.nix b/nixos/floki/default.nix deleted file mode 100644 index c8c71f5..0000000 --- a/nixos/floki/default.nix +++ /dev/null @@ -1,71 +0,0 @@ -{ inputs, lib, pkgs, platform, ... }: -{ - imports = [ - inputs.nixos-hardware.nixosModules.common-cpu-intel - #inputs.nixos-hardware.nixosModules.common-gpu-nvidia - inputs.nixos-hardware.nixosModules.common-pc - inputs.nixos-hardware.nixosModules.common-pc-ssd - (import ./disks.nix) - ../_mixins/hardware/gpu.nix - - ../_mixins/hardware/systemd-boot.nix - ../_mixins/services/bluetooth.nix - ../_mixins/services/pipewire.nix - ../_mixins/virt - ../_mixins/virt/docker.nix - ../_mixins/virt/podman.nix - ]; - - boot = { - initrd = { - availableKernelModules = [ - "ahci" - "nvme" - "rtsx_pci_sdmmc" - "sd_mod" - "thunderbolt" - "usb_storage" - "xhci_pci" - ]; - }; - - kernelModules = [ "kvm-intel" ]; # TODO: "nvidia" - kernelPackages = pkgs.linuxPackages_latest; - }; - - console.keyMap = lib.mkForce "us"; - services.kmscon.extraConfig = lib.mkForce '' - font-size=12 - xkb-layout=us - ''; - services.xserver.layout = lib.mkForce "us"; - services.xserver.xkbOptions = "ctrl:swapcaps"; - - environment.systemPackages = with pkgs; [ - nvtop-amd - man-pages - man-pages-posix - ]; - - networking.hostName = "floki"; - powerManagement.powertop.enable = true; - powerManagement.cpuFreqGovernor = "powersave"; - - documentation.nixos.enable = true; - documentation.doc.enable = false; - documentation.info.enable = true; - documentation.dev.enable = true; - documentation.man.generateCaches = true; - - # Lid settings - services.logind = { - lidSwitch = "suspend"; - lidSwitchExternalPower = "lock"; - }; - - virtualisation.docker.storageDriver = "btrfs"; -# virtualisation.podman.storageDriver = "btrfs"; - - nixpkgs.hostPlatform = lib.mkDefault "${platform}"; - -} diff --git a/nixos/iso/iso-console/default.nix b/nixos/iso/iso-console/default.nix new file mode 100644 index 0000000..74a48c0 --- /dev/null +++ b/nixos/iso/iso-console/default.nix @@ -0,0 +1,6 @@ +{ lib, ... }: +{ + console.keyMap = lib.mkForce "us"; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/iso/iso-desktop/default.nix b/nixos/iso/iso-desktop/default.nix new file mode 100644 index 0000000..5589c62 --- /dev/null +++ b/nixos/iso/iso-desktop/default.nix @@ -0,0 +1,4 @@ +{ lib, ... }: +{ + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/iso/iso-gpd-dsi/default.nix b/nixos/iso/iso-gpd-dsi/default.nix new file mode 100644 index 0000000..e9bdfa2 --- /dev/null +++ b/nixos/iso/iso-gpd-dsi/default.nix @@ -0,0 +1,11 @@ +{ lib, ... }: +{ + # Pocket, Pocket 3, MicroPC, Win 3, TopJoy Falcon + imports = [ + ../_mixins/services/bluetooth.nix + ../_mixins/services/pipewire.nix + ../_mixins/hardware/gpd-dsi.nix + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/iso/iso-gpd-edp/default.nix b/nixos/iso/iso-gpd-edp/default.nix new file mode 100644 index 0000000..c9c4da3 --- /dev/null +++ b/nixos/iso/iso-gpd-edp/default.nix @@ -0,0 +1,11 @@ +{ lib, ... }: +{ + # Pocket 2, Win 2, Win Max + imports = [ + ../_mixins/services/bluetooth.nix + ../_mixins/services/pipewire.nix + ../_mixins/hardware/gpd-edp.nix + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/iso/iso-nuc/default.nix b/nixos/iso/iso-nuc/default.nix new file mode 100644 index 0000000..32c5414 --- /dev/null +++ b/nixos/iso/iso-nuc/default.nix @@ -0,0 +1,11 @@ +{ lib, pkgs, ... }: +{ + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + + users.users.root = { + openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + }; + +} diff --git a/nixos/iso/iso-tk1/default.nix b/nixos/iso/iso-tk1/default.nix new file mode 100644 index 0000000..ef89247 --- /dev/null +++ b/nixos/iso/iso-tk1/default.nix @@ -0,0 +1,5 @@ +{ lib, ... }: +{ + nixpkgs.hostPlatform = lib.mkDefault "arm7l-linux"; + nixpkgs.crossSystem.system = "armv7l-linux"; +} diff --git a/nixos/iso/iso-win-max/default.nix b/nixos/iso/iso-win-max/default.nix new file mode 100644 index 0000000..f12957c --- /dev/null +++ b/nixos/iso/iso-win-max/default.nix @@ -0,0 +1,10 @@ +{ lib, ... }: +{ + imports = [ + ../_mixins/services/bluetooth.nix + ../_mixins/services/pipewire.nix + ../_mixins/hardware/gpd-win-max.nix + ]; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/sd-card/default.nix b/nixos/sd-card/default.nix new file mode 100644 index 0000000..b4c04c3 --- /dev/null +++ b/nixos/sd-card/default.nix @@ -0,0 +1,17 @@ +{ ... }: { + nixpkgs.hostPlatform.system = "aarch64-linux"; + nixpkgs.buildPlatform.system = "x86_64-linux"; + + imports = [ + + ]; + + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + users.users.root = { + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDPvS6pE5Y8Yc3YnKpKinjVKyziqnb7JZJGonDKnZi3I Greg Burd - 2023-08-03" + ]; + }; + + system.stateVersion = "23.11"; +} diff --git a/nixos/server/NUC.md b/nixos/server/NUC.md new file mode 100644 index 0000000..da9e22b --- /dev/null +++ b/nixos/server/NUC.md @@ -0,0 +1,12 @@ +|Name |Memory|Tags |IP Address |MAC Address | +|------|------|-------|--------------|-----------------| +|NUC 00|2 GB |pxe,dns|192.168.40.200|f4:4d:30:61:9b:19| +|NUC 01|2 GB |pxe,dns|192.168.40.201|f4:4d:30:62:4c:26| +|NUC 02|4 GB | |192.168.40.202|f4:4d:30:61:99:ab| +|NUC 03|4 GB | |192.168.40.203|f4:4d:30:61:8c:cf| +|NUC 04|8 GB | |192.168.40.204|f4:4d:30:61:99:ad| +|NUC 05|8 GB | |192.168.40.205|f4:4d:30:61:8a:9d| +|NUC 06|8 GB | |192.168.40.206|f4:4d:30:62:4a:76| +|NUC 07|8 GB | |192.168.40.207|f4:4d:30:62:4a:43| +|NUC 08|8 GB | |192.168.40.208|f4:4d:30:61:9a:e0| +|NUC 09|8 GB | |192.168.40.209|f4:4d:30:61:99:ed| diff --git a/nixos/server/nuc-init/default.nix b/nixos/server/nuc-init/default.nix new file mode 100644 index 0000000..e65e5e7 --- /dev/null +++ b/nixos/server/nuc-init/default.nix @@ -0,0 +1,99 @@ +# Gigabyte GB-BXCEH-2955 (Celeron 2955U: Haswell) + +{ inputs, lib, pkgs, sshMatrix, ... }: +let + mkNetwork = mac: ipSuffix: { + matchConfig.MACAddress = mac; + networkConfig = { + Address = "192.168.40.${ipSuffix}/24"; + Gateway = "192.168.40.1"; + DNS = "192.168.40.1"; + }; + }; + + auto-install-system = pkgs.writeScriptBin "auto-install-system" '' + macAddr="$(${pkgs.iproute2}/bin/ip address show enp3s0 | grep link/ether | awk '{print $2}')" + switch $macAddress + case "f4:4d:30:61:9b:19" + hostname="nuc0" + case "f4:4d:30:62:4c:26" + hostname="nuc1" + case "f4:4d:30:61:99:ab" + hostname="nuc2" + case "f4:4d:30:61:8c:cf" + hostname="nuc3" + case "f4:4d:30:61:99:ad" + hostname="nuc4" + case "f4:4d:30:61:8a:9d" + hostname="nuc5" + case "f4:4d:30:62:4a:76" + hostname="nuc6" + case "f4:4d:30:62:4a:43" + hostname="nuc7" + case "f4:4d:30:61:9a:e0" + hostname="nuc8" + case "f4:4d:30:61:99:ed" + hostname="nuc9" + case '*' + hostname="" + end + + if [ -z "$hostname" ] + echo "No hostname determined. auto-install-system will exit now. + exit 1 + fi + + if [ ! -d "$HOME/ws/nix-config/.git" ]; then + git clone https://github.com/gburd/nix-config.git "$HOME/ws/nix-config" + fi + + cd "$HOME/ws/nix-config" + + nixos-rebuild --flake .#$hostname + ''; +in +{ + imports = [ + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-intel + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-ssd + ../../_mixins/hardware/systemd-boot.nix + ]; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "uas" ]; + kernelModules = [ "kvm-intel" ]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_5_15; + }; + + # ensure we aren't defaulting to NetworkManager with DHCP on + networking.useDHCP = false; + + systemd.network = { + enable = true; + networks = { + "10-lan-200" = mkNetwork "F4:4D:30:61:9B:19" "200"; + "10-lan-201" = mkNetwork "F4:4D:30:62:4C:26" "201"; + "10-lan-202" = mkNetwork "F4:4D:30:61:99:AB" "202"; + "10-lan-203" = mkNetwork "F4:4D:30:61:8C:CF" "203"; + "10-lan-204" = mkNetwork "F4:4D:30:61:99:AD" "204"; + "10-lan-205" = mkNetwork "F4:4D:30:61:8A:9D" "205"; + "10-lan-206" = mkNetwork "F4:4D:30:62:4A:76" "206"; + "10-lan-207" = mkNetwork "F4:4D:30:62:4A:43" "207"; + "10-lan-208" = mkNetwork "F4:4D:30:61:9A:E0" "208"; + "10-lan-209" = mkNetwork "F4:4D:30:61:99:ED" "209"; + }; + }; + + config.environment.systemPackages = [ auto-install-system ]; + + programs.fish.interactiveShellInit = '' + auto-install-system + ''; + + # allow remote deployments via root user + users.users.root.openssh.authorizedKeys.keys = sshMatrix.groups.privileged_users; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/server/nuc0/default.nix b/nixos/server/nuc0/default.nix new file mode 100644 index 0000000..1d86bfa --- /dev/null +++ b/nixos/server/nuc0/default.nix @@ -0,0 +1,14 @@ +# Host: Intel Corporation NUC5PPYB +# CPU: Intel Pentium N3700 (4) @ 2.400GHz +# GPU: Intel Atom/Celeron/Pentium Processor x5-E8000/J3xxx/N3xxx +# Memory: 7877MiB + +{ ... }: +{ + imports = [ + # base NUC configuration + ../../_mixins/servers/nuc-base.nix + ]; + + systemd.network.networks."10-lan".networkConfig.Address = "192.168.40.209/24"; +} diff --git a/nixos/server/pxe-server/default.nix b/nixos/server/pxe-server/default.nix new file mode 100644 index 0000000..98fb5f2 --- /dev/null +++ b/nixos/server/pxe-server/default.nix @@ -0,0 +1,140 @@ +{ inputs, lib, pkgs, ... }: +let + dnsHostName = "ossus.net"; + internalDnsHostName = "int.${dnsHostName}"; + virtNetIface = "enu1u1"; +in +{ + imports = [ + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-intel + inputs.nixos-hardware.nixosModules.common-pcfish + inputs.nixos-hardware.nixosModules.common-pc-ssd + (import ./disks.nix { }) + ../_mixins/hardware/systemd-boot.nix + ../_mixins/services/bluetooth.nix + ../_mixins/users/gburd + ../_mixins/users/pxe + ../_mixins/virt + ]; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "uas" ]; + kernelModules = [ "kvm-intel" ]; + kernelPackages = lib.mkDefault pkgs.linuxPackages_5_15; + # loader.grub.enable = false; + # loader.generic-extlinux-compatible.enable = true; + }; + + # Use passed hostname to configure basic networking + networking = { + defaultGateway = "192.168.40.1"; + interfaces.enp3s0.ipv4.addresses = [{ + address = "192.168.40.200"; + prefixLength = 24; + }]; + nameservers = [ "192.168.40.1" ]; + useDHCP = true; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + + # --- NETWORK --- # + networking.hostName = "dns"; # Define your hostname. + services.resolved.enable = false; + + environment.systemPackages = with pkgs; [ + wget + parted + ]; + + services.dnsmasq = { + enable = true; + settings = { + server = [ + "1.1.1.1" + "9.9.9.9" + ]; + dhcp-authoritative = false; + domain-needed = true; + domain = "${internalDnsHostName}"; + local = "/${internalDnsHostName}"; + bogus-priv = true; + rebind-domain-ok = "/plex.direct/"; + + # DHCP OPTIONS (SUCH AS PXE, DNS SERVER, GATEWAY, ETC) + dhcp-option = [ + "${virtNetIface}.10,3,10.50.10.1" + "${virtNetIface}.10,6,10.50.10.2" + "${virtNetIface}.20,3,10.50.20.1" + "${virtNetIface}.20,6,10.50.20.2" + "${virtNetIface}.30,3,10.50.30.1" + "${virtNetIface}.30,6,10.50.30.2" + "${virtNetIface}.40,3,10.50.40.1" + "${virtNetIface}.40,6,10.50.40.2" + ]; + + # DHCP RANGES + dhcp-range = [ + "${virtNetIface}.10,10.50.10.200,10.50.10.254,255.255.255.0,8h" + ]; + + # STATIC HOST MAPPINGS ("MAC_ADDRESS,IP_ADDRESS,HOSTNAME") + dhcp-host = [ + "f4:4d:30:61:9b:19,192.168.40.200" # NUC 00 + "f4:4d:30:62:4c:26,192.168.40.201" # NUC 01 + "f4:4d:30:61:99:ab,192.168.40.202" # NUC 02 + "f4:4d:30:61:8c:cf,192.168.40.203" # NUC 03 + "f4:4d:30:61:99:ad,192.168.40.204" # NUC 04 + "f4:4d:30:61:8a:9d,192.168.40.205" # NUC 05 + "f4:4d:30:62:4a:76,192.168.40.206" # NUC 06 + "f4:4d:30:62:4a:43,192.168.40.207" # NUC 07 + "f4:4d:30:61:9a:e0,192.168.40.208" # NUC 08 + "f4:4d:30:61:99:ed,192.168.40.209" # NUC 09 + + "00:04:4b:49:19:32,192.168.40.210" # TK1 00 + "00:04:4b:5a:f2:75,192.168.40.211" # TK1 01 + "00:04:4b:5a:ef:dc,192.168.40.212" # TK1 02 + #00:04:4b:xx:xx:xx,192.168.40.213 # TK1 03 + #00:04:4b:xx:xx:xx,192.168.40.213 # TK1 04 + ]; + + # DNS OVERRIDES + address = [ + # "/cloud.${dnsHostName}/10.50.10.10" + # "/photos.${dnsHostName}/10.50.10.10" + # "/id.${dnsHostName}/10.50.10.10" + # "/vault.${dnsHostName}/10.50.10.10" + # "/overseerr.${dnsHostName}/10.50.10.10" + # "/media.${internalDnsHostName}/10.50.10.10" + # "/${dnsHostName}/10.50.10.10" + # "/matrix.${dnsHostName}/10.50.10.10" + # "/syncv3.${dnsHostName}/10.50.10.10" + # "/cctv.${internalDnsHostName}/10.50.10.10" + # "/archive.${internalDnsHostName}/10.50.10.10" + ]; + }; + }; + + services.netdata.enable = true; + + # Open ports in the firewall. + #networking.firewall.allowedTCPPorts = [ + # 22 + # 80 + # 443 + # 19999 + #]; + #networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It's perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "23.11"; # Did you read the comment? +} diff --git a/nixos/server/pxe-server/disks.nix b/nixos/server/pxe-server/disks.nix new file mode 100644 index 0000000..3bcd235 --- /dev/null +++ b/nixos/server/pxe-server/disks.nix @@ -0,0 +1,29 @@ +{ disks ? [ "/dev/sda" ], ... }: { + disko.devices = { + disk = { + sda = { + device = builtins.elemAt disks 0; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + size = "1M"; + # for grub MBR + type = "EF02"; + }; + root = { + size = "100%"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; + }; +} + diff --git a/nixos/server/skull/default.nix b/nixos/server/skull/default.nix new file mode 100644 index 0000000..fdcd531 --- /dev/null +++ b/nixos/server/skull/default.nix @@ -0,0 +1,59 @@ +# Intel Skull Canyon NUC6i7KYK +{ inputs, lib, ... }: +{ + imports = [ + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-intel + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-ssd + (import ./disks.nix { }) + ../_mixins/hardware/systemd-boot.nix + ../_mixins/services/bluetooth.nix + ../_mixins/services/maestral.nix + ../_mixins/services/zerotier.nix + ../_mixins/virt + ]; + + # disko does manage mounting of / /boot /home, but I want to mount by-partlabel + fileSystems."/" = lib.mkForce { + device = "/dev/disk/by-partlabel/root"; + fsType = "xfs"; + options = [ "defaults" "relatime" "nodiratime" ]; + }; + + fileSystems."/boot" = lib.mkForce { + device = "/dev/disk/by-partlabel/ESP"; + fsType = "vfat"; + }; + + fileSystems."/home" = lib.mkForce { + device = "/dev/disk/by-partlabel/home"; + fsType = "xfs"; + options = [ "defaults" "relatime" "nodiratime" ]; + }; + + swapDevices = [{ + device = "/swap"; + size = 2048; + }]; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "nvme" "usbhid" "uas" "sd_mod" ]; + kernelModules = [ "kvm-intel" ]; + }; + + # Use passed hostname to configure basic networking + networking = { + defaultGateway = "192.168.2.1"; + interfaces.eno1.ipv4.addresses = [{ + address = "192.168.2.17"; + prefixLength = 24; + }]; + nameservers = [ "192.168.2.1" ]; + useDHCP = lib.mkForce false; + }; + + services.hardware.bolt.enable = true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/server/skull/disks.nix b/nixos/server/skull/disks.nix new file mode 100644 index 0000000..160f9f6 --- /dev/null +++ b/nixos/server/skull/disks.nix @@ -0,0 +1,65 @@ +{ disks ? [ "/dev/nvme0n1" "/dev/nvme1n1" ], ... }: +let + defaultXfsOpts = [ "defaults" "relatime" "nodiratime" ]; +in +{ + disko.devices = { + disk = { + nvme0 = { + type = "disk"; + device = builtins.elemAt disks 0; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + name = "ESP"; + start = "0%"; + end = "550MiB"; + bootable = true; + flags = [ "esp" ]; + fs-type = "fat32"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + name = "root"; + start = "550MiB"; + end = "100%"; + content = { + type = "filesystem"; + # Overwirte the existing filesystem + extraArgs = [ "-f" ]; + format = "xfs"; + mountpoint = "/"; + mountOptions = defaultXfsOpts; + }; + }]; + }; + }; + nvme1 = { + type = "disk"; + device = builtins.elemAt disks 1; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + name = "home"; + start = "0%"; + end = "100%"; + content = { + type = "filesystem"; + # Overwirte the existing filesystem + extraArgs = [ "-f" ]; + format = "xfs"; + mountpoint = "/home"; + mountOptions = defaultXfsOpts; + }; + }]; + }; + }; + }; + }; +} diff --git a/nixos/workstation/floki/default.nix b/nixos/workstation/floki/default.nix new file mode 100644 index 0000000..3141cbf --- /dev/null +++ b/nixos/workstation/floki/default.nix @@ -0,0 +1,107 @@ +# Motherboard: LENOVO 21DE001EUS ver: SDK0T76528 WIN ssn: W1CG27P023B +# CPU: 12th Gen Intel(R) Core(TM) i9-12900H +# GPU: NVIDIA GeForce RTX 3080 Ti +# RAM: 32GB DDR5 +# SATA: WD_BLACK SN850X 4TB (624331WD) SSD + +{ inputs, lib, pkgs, ... }: +{ + imports = [ + (import ./disks.nix) + #./hardware-configuration.nix + + inputs.nixos-hardware.nixosModules.common-cpu-intel + inputs.nixos-hardware.nixosModules.common-gpu-nvidia + inputs.nixos-hardware.nixosModules.common-pc + inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd + inputs.nixos-hardware.nixosModules.lenovo-thinkpad-x1-extreme-gen4 + + ../../_mixins/desktop/daw.nix + ../../_mixins/desktop/ente.nix + ../../_mixins/desktop/logseq.nix + ../../_mixins/hardware/systemd-boot.nix + ../../_mixins/hardware/disable-nm-wait.nix + # ../../_mixins/hardware/intel.accelerated-video-playback.nix + ../../_mixins/hardware/rtx-3080ti.nix + ../../_mixins/hardware/roccat.nix + ../../_mixins/services/bluetooth.nix + ../../_mixins/services/pipewire.nix + ../../_mixins/virt + ]; + + boot = { + initrd = { + availableKernelModules = [ + "ahci" + "nvme" + "rtsx_pci_sdmmc" + "sd_mod" + "thunderbolt" + "usb_storage" + "xhci_pci" + ]; + }; + + kernelModules = [ "kvm-intel" "nvidia" ]; + kernelPackages = pkgs.linuxPackages_latest; + }; + + # https://nixos.wiki/wiki/Nvidia + hardware.nvidia.prime = { + offload.enable = false; + sync.enable = true; + # nix-shell -p lshw.out --run 'sudo lshw -c display' + intelBusId = "PCI:0:2:0"; # pci@0000:00:02.0 + nvidiaBusId = "PCI:1:0:0"; # pci@0000:01:00.0 + }; + + console.keyMap = lib.mkForce "us"; + services.kmscon.extraConfig = lib.mkForce '' + font-size=12 + xkb-layout=us + ''; + services.xserver.layout = lib.mkForce "us"; + services.xserver.xkbOptions = "ctrl:swapcaps"; + + environment.systemPackages = with pkgs; [ + nvtop-amd + man-pages + man-pages-posix + ]; + + networking.hostName = "floki"; + powerManagement.powertop.enable = true; + powerManagement.cpuFreqGovernor = "powersave"; + + documentation.nixos.enable = lib.mkForce true; + documentation.doc.enable = false; + documentation.info.enable = false; + documentation.dev.enable = true; + documentation.man.generateCaches = true; + + services = { + hardware.openrgb = { + enable = true; + motherboard = "intel"; + package = pkgs.openrgb-with-all-plugins; + }; + # Lid settings + logind = { + lidSwitch = "suspend"; + lidSwitchExternalPower = "lock"; + }; + }; + + virtualisation.docker.storageDriver = "btrfs"; + # virtualisation.podman.storageDriver = "btrfs"; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + + # support for cross-platform NixOS builds + boot.binfmt.emulatedSystems = [ "armv7l-linux" "aarch64-linux" ]; + + # setup and use the fingerprint reader (setup with fprintd-enroll) + services.fprintd.enable = true; + services.fprintd.tod.enable = true; + services.fprintd.tod.driver = pkgs.libfprint-2-tod1-goodix; +} diff --git a/nixos/floki/disks.nix b/nixos/workstation/floki/disks.nix similarity index 100% rename from nixos/floki/disks.nix rename to nixos/workstation/floki/disks.nix diff --git a/nixos/floki/secrets.yaml b/nixos/workstation/floki/secrets.yaml similarity index 100% rename from nixos/floki/secrets.yaml rename to nixos/workstation/floki/secrets.yaml diff --git a/nixos/floki/ssh_host_ed25519_key.pub b/nixos/workstation/floki/ssh_host_ed25519_key.pub similarity index 100% rename from nixos/floki/ssh_host_ed25519_key.pub rename to nixos/workstation/floki/ssh_host_ed25519_key.pub diff --git a/nixos/floki/ssh_host_rsa_key.pub b/nixos/workstation/floki/ssh_host_rsa_key.pub similarity index 100% rename from nixos/floki/ssh_host_rsa_key.pub rename to nixos/workstation/floki/ssh_host_rsa_key.pub diff --git a/nixos/workstation/vm/default.nix b/nixos/workstation/vm/default.nix new file mode 100644 index 0000000..5eb062f --- /dev/null +++ b/nixos/workstation/vm/default.nix @@ -0,0 +1,20 @@ +{ lib, modulesPath, pkgs, ... }: +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + (import ./disks.nix { }) + ../_mixins/hardware/systemd-boot.nix + ../_mixins/services/pipewire.nix + ]; + + swapDevices = [{ + device = "/swap"; + size = 1024; + }]; + + boot = { + initrd.availableKernelModules = [ "xhci_pci" "ohci_pci" "ehci_pci" "virtio_pci" "ahci" "usbhid" "sr_mod" "virtio_blk" ]; + kernelPackages = pkgs.linuxPackages_latest; + }; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} diff --git a/nixos/workstation/vm/disks.nix b/nixos/workstation/vm/disks.nix new file mode 100644 index 0000000..a0f8ac0 --- /dev/null +++ b/nixos/workstation/vm/disks.nix @@ -0,0 +1,50 @@ +{ disks ? [ "/dev/vda" ], ... }: +let + defaultXfsOpts = [ "defaults" "relatime" "nodiratime" ]; +in +{ + disko.devices = { + disk = { + vda = { + type = "disk"; + device = builtins.elemAt disks 0; + content = { + type = "table"; + format = "gpt"; + partitions = [{ + name = "boot"; + start = "0%"; + end = "1M"; + flags = [ "bios_grub" ]; + } + { + name = "ESP"; + start = "1M"; + end = "550MiB"; + bootable = true; + flags = [ "esp" ]; + fs-type = "fat32"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + } + { + name = "root"; + start = "550MiB"; + end = "100%"; + content = { + type = "filesystem"; + # Overwirte the existing filesystem + extraArgs = [ "-f" ]; + format = "xfs"; + mountpoint = "/"; + mountOptions = defaultXfsOpts; + }; + }]; + }; + }; + }; + }; +} diff --git a/nixpkgs.nix b/nixpkgs.nix index 39a480d..e6e07cb 100644 --- a/nixpkgs.nix +++ b/nixpkgs.nix @@ -1,5 +1,5 @@ -# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock -# file Useful to avoid using channels when using legacy nix commands +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# Useful to avoid using channels when using legacy nix commands let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; in import (fetchTarball { diff --git a/overlays/default.nix b/overlays/default.nix index 2966f3e..405ccd2 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,34 +1,57 @@ # This file defines overlays { inputs, ... }: -let - addPatches = pkg: patches: pkg.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or [ ]) ++ patches; - }); -in { - # Add our custom packages from the 'pkgs' directory - additions = final: prev: import ../pkgs { pkgs = final; } // { - formats = prev.formats // import ../pkgs/formats { pkgs = final; }; - vimPlugins = prev.vimPlugins // final.callPackage ../pkgs/vim-plugins { }; - }; + # This one brings our custom packages from the 'pkgs' directory + additions = final: prev: + (import ../pkgs { pkgs = final; }) + // rec { + templateFile = name: template: data: + prev.stdenv.mkDerivation { + name = "${name}"; - # Modify existing packages; change versions, add patches, set compilation - # flags, anything really. + nativeBuildInpts = [ prev.mustache-go ]; + + # Pass Json as file to avoid escaping + passAsFile = [ "jsonData" ]; + jsonData = builtins.toJSON data; + + # Disable phases which are not needed. In particular the unpackPhase will + # fail, if no src attribute is set + phases = [ "buildPhase" "installPhase" ]; + + buildPhase = '' + ${prev.mustache-go}/bin/mustache $jsonDataPath ${template} > file + ''; + + installPhase = '' + cp file $out + chmod +x $out + ''; + }; + + templateFileContent = n: t: d: builtins.readFile "${templateFile n t d}"; + }; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. # https://nixos.wiki/wiki/Overlays + # Example usage modifications = _final: prev: { # example = prev.example.overrideAttrs (oldAttrs: rec { # ... # }); - passExtensions = prev.passExtensions // { - # https://github.com/tadfisher/pass-otp/pull/173 - pass-otp = addPatches prev.passExtensions.pass-otp [ ./pass-otp-fix-completion.patch ]; - }; - - # https://github.com/mdellweg/pass_secret_service/pull/37 - pass-secret-service = addPatches prev.pass-secret-service [ ./pass-secret-service-native.diff ]; + customMaintainer = prev.lib.maintainers.overrideAttrs (oldAttrs: oldAttrs // { + tcarrio = { + email = "tom@carrio.dev"; + github = "tcarrio"; + githubId = 8659099; + name = "Tom Carrio"; + }; + }); }; + # When applied, the unstable nixpkgs set (declared in the flake inputs) will # be accessible through 'pkgs.unstable' unstable-packages = final: _prev: { @@ -37,4 +60,10 @@ in config.allowUnfree = true; }; }; + trunk-packages = final: _prev: { + trunk = import inputs.nixpkgs-trunk { + inherit (final) system; + config.allowUnfree = true; + }; + }; } diff --git a/overlays/pass-otp-fix-completion.patch b/overlays/pass-otp-fix-completion.patch deleted file mode 100644 index 22f342f..0000000 --- a/overlays/pass-otp-fix-completion.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff --git a/pass-otp.bash.completion b/pass-otp.bash.completion -index 419edbd..2af0370 100644 ---- a/pass-otp.bash.completion -+++ b/pass-otp.bash.completion -@@ -24,3 +24,5 @@ __password_store_extension_complete_otp() { - _pass_complete_entries 1 - fi - } -+ -+complete -o filenames -F __password_store_extension_complete_otp pass-otp diff --git a/overlays/pass-secret-service-native.diff b/overlays/pass-secret-service-native.diff deleted file mode 100644 index 96c57d5..0000000 --- a/overlays/pass-secret-service-native.diff +++ /dev/null @@ -1,137 +0,0 @@ -diff --git a/Makefile b/Makefile -index 64222c2..65d4c33 100644 ---- a/Makefile -+++ b/Makefile -@@ -3,6 +3,7 @@ relgnupghome ::= test/.gnupghome - export GNUPGHOME ::= $(projectdir)/$(relgnupghome) - gpg_key_id ::= "8c2a59a7" - relpassstore ::= test/.test-password-store -+pass ::= pypass - export PASSWORD_STORE_DIR ::= $(projectdir)/$(relpassstore) - - .PHONY: all test coverage style clean clean-pycache clean-build -@@ -10,7 +11,7 @@ export PASSWORD_STORE_DIR ::= $(projectdir)/$(relpassstore) - all: style test - - test: | $(relpassstore) -- dbus-run-session -- pytest-3 -v test -+ dbus-run-session -- pytest-3 -v test --asyncio-mode=auto - - coverage: | $(relpassstore) - dbus-run-session -- python3 -m coverage run -m pytest -v test -@@ -28,7 +29,7 @@ $(relgnupghome): test/test_key.asc test/test_ownertrust.txt - - $(relpassstore): | $(relgnupghome) - @echo "===== Preparing password store in $(relpassstore) =====" -- pypass init -p $(relpassstore) $(gpg_key_id) -+ $(pass) init -p $(relpassstore) $(gpg_key_id) - - clean: clean-test-environment clean-pycache clean-build - -diff --git a/pass_secret_service/common/native_pass.py b/pass_secret_service/common/native_pass.py -new file mode 100644 -index 0000000..b1a06aa ---- /dev/null -+++ b/pass_secret_service/common/native_pass.py -@@ -0,0 +1,30 @@ -+import subprocess -+import os -+ -+DEFAULT_PASS = "pass" -+ -+class NativePasswordStore: -+ def __init__(self, use_pass=None, path=None): -+ self.pass_cmd = use_pass or DEFAULT_PASS -+ self.path = path -+ -+ def _pass(self, *args, **kwargs): -+ env = os.environ -+ if self.path is not None: -+ env.update({'PASSWORD_STORE_DIR': self.path}) -+ -+ proc = subprocess.run([self.pass_cmd, *args], -+ check=True, -+ text=True, -+ capture_output=True, -+ env=env, -+ **kwargs -+ ) -+ -+ return proc -+ -+ def get_decrypted_password(self, passname): -+ return self._pass("show", passname).stdout.removesuffix("\n") -+ -+ def insert_password(self, passname, password): -+ self._pass("insert", "--echo", passname, input=password) -diff --git a/pass_secret_service/common/pass_store.py b/pass_secret_service/common/pass_store.py -index c1aa175..4f13438 100644 ---- a/pass_secret_service/common/pass_store.py -+++ b/pass_secret_service/common/pass_store.py -@@ -2,19 +2,30 @@ - import shutil - import uuid - import json --from pypass import PasswordStore - -+try: -+ from pypass import PasswordStore - --# Work around a typo in pypass --if not hasattr(PasswordStore, "get_decrypted_password"): -- PasswordStore.get_decrypted_password = PasswordStore.get_decypted_password -+ # Work around a typo in pypass -+ if not hasattr(PasswordStore, "get_decrypted_password"): -+ PasswordStore.get_decrypted_password = PasswordStore.get_decypted_password -+ -+except ImportError: -+ from .native_pass import NativePasswordStore -+ PasswordStore = NativePasswordStore - - - class PassStore: - PREFIX = "secret_service" - -- def __init__(self, *args, **kwargs): -- self._store = PasswordStore(*args, **kwargs) -+ def __init__(self, *args, use_pass=None, **kwargs): -+ if not use_pass: -+ self._store = PasswordStore(*args, **kwargs) -+ -+ else: -+ from .native_pass import NativePasswordStore -+ self._store = NativePasswordStore(use_pass=use_pass, **kwargs) -+ - self.base_path = os.path.join(self._store.path, self.PREFIX) - if not os.path.exists(self.base_path): - os.makedirs(self.base_path) -diff --git a/pass_secret_service/pass_secret_service.py b/pass_secret_service/pass_secret_service.py -index 8c35db9..7dbcdf0 100755 ---- a/pass_secret_service/pass_secret_service.py -+++ b/pass_secret_service/pass_secret_service.py -@@ -30,10 +30,10 @@ async def register_service(pass_store): - return service - - --def _main(path, verbose): -+def _main(path, pass_, verbose): - if verbose: - logging.basicConfig(level=20) -- pass_store = PassStore(**({"path": path} if path else {})) -+ pass_store = PassStore(use_pass=pass_, **({"path": path} if path else {})) - mainloop = asyncio.get_event_loop() - mainloop.add_signal_handler(signal.SIGTERM, functools.partial(term_loop, mainloop)) - mainloop.add_signal_handler(signal.SIGINT, functools.partial(term_loop, mainloop)) -@@ -51,9 +51,10 @@ def _main(path, verbose): - - @click.command() - @click.option("--path", help="path to the password store (optional)") -+@click.option("-e", "pass_", help="use given pass executable") - @click.option("-v", "--verbose", help="be verbose", is_flag=True, default=False) --def main(path, verbose): -- _main(path, verbose) -+def main(path, pass_, verbose): -+ _main(path, pass_, verbose) - - - if __name__ == "__main__": # pragma: no cover diff --git a/pkgs/auth0.nix b/pkgs/auth0.nix new file mode 100644 index 0000000..8e31cac --- /dev/null +++ b/pkgs/auth0.nix @@ -0,0 +1,27 @@ +{ lib +, buildGoModule +, fetchFromGitHub +}: + +buildGoModule rec { + pname = "auth0-cli"; + version = "1.1.0"; + + src = fetchFromGitHub { + owner = "auth0"; + repo = "auth0-cli"; + rev = "v${version}"; + sha256 = "sha256-jplnGkqhJ5lKAAXNqF7FpbTsmjBz8ephlrgm1e1oTHY="; + }; + + vendorHash = "sha256-T8y7MPFebDU6skfz4Rqo0ElRRaldtfexOl99D7h+orU="; + + doCheck = false; + + meta = with lib; { + description = "Build, manage and test your Auth0 integrations from the command line"; + homepage = "https://github.com/auth0/auth0-cli"; + maintainers = with maintainers; [ tcarrio ]; + license = licenses.mit; + }; +} diff --git a/pkgs/charm-freeze.nix b/pkgs/charm-freeze.nix new file mode 100644 index 0000000..6457801 --- /dev/null +++ b/pkgs/charm-freeze.nix @@ -0,0 +1,26 @@ +{ lib, buildGoModule, fetchFromGitHub }: + +buildGoModule rec { + pname = "charm-freeze"; + version = "0.1.4"; + + src = fetchFromGitHub { + owner = "charmbracelet"; + repo = "freeze"; + rev = "v${version}"; + hash = "sha256-ItcdgQUPrz2hpWS6nDYfnZaCdfocR3QgJTQ4TXzPQOw="; + }; + + vendorHash = "sha256-01tTr5NSyg52KGspYh9Rw98uQld6U+31Fy7jnyBoPx8="; + + ldflags = [ "-s" "-w" "-X=main.Version=${version}" ]; + + meta = with lib; { + description = "A tool to generate images of code and terminal output"; + mainProgram = "freeze"; + homepage = "https://github.com/charmbracelet/freeze"; + changelog = "https://github.com/charmbracelet/freeze/releases/tag/v${version}"; + license = licenses.mit; + maintainers = with maintainers; [ tcarrio ]; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index e5acf1b..ba31194 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,18 +1,10 @@ -{ pkgs ? import { } }: rec { +# Custom packages, that can be defined similarly to ones from nixpkgs +# Build them using 'nix build .#example' or (legacy) 'nix-build -A example' - # Packages with an actual source - rgbdaemon = pkgs.callPackage ./rgbdaemon { }; - shellcolord = pkgs.callPackage ./shellcolord { }; - speedtestpp = pkgs.callPackage ./speedtestpp { }; - qt6gtk2 = pkgs.qt6Packages.callPackage ./qt6gtk2 { }; - - # Personal scripts +{ pkgs ? (import ../nixpkgs.nix) { } }: { + auth0 = pkgs.callPackage ./auth0.nix { }; + ente-photos-desktop = pkgs.callPackage ./ente.nix { }; + charm-freeze = pkgs.callPackage ./charm-freeze.nix { }; nix-inspect = pkgs.callPackage ./nix-inspect { }; - minicava = pkgs.callPackage ./minicava { }; - pass-wofi = pkgs.callPackage ./pass-wofi { }; - primary-xwayland = pkgs.callPackage ./primary-xwayland { }; - wl-mirror-pick = pkgs.callPackage ./wl-mirror-pick { }; - lyrics = pkgs.callPackage ./lyrics { }; - xpo = pkgs.callPackage ./xpo { }; tly = pkgs.callPackage ./tly { }; } diff --git a/pkgs/ente.nix b/pkgs/ente.nix new file mode 100644 index 0000000..68e2702 --- /dev/null +++ b/pkgs/ente.nix @@ -0,0 +1,40 @@ +{ appimageTools, lib, fetchurl }: +let + pname = "ente-photos-desktop"; + version = "1.6.63"; + shortName = "ente"; + name = "${shortName}-${version}"; + + # https://github.com/ente-io/photos-desktop/releases/download/v1.6.63/ente-1.6.63-arm64.AppImage + # https://github.com/ente-io/photos-desktop/releases/download/v1.6.63/ente-1.6.63-x86_64.AppImage + mirror = "https://github.com/ente-io/photos-desktop/releases/download"; + src = fetchurl { + url = "${mirror}/v${version}/${name}-x86_64.AppImage"; + hash = "sha256-K2rNLHtzyh9/y54dz0l58XYnzsjP+qGl6OH9CExR2jU="; + }; + + appimageContents = appimageTools.extractType2 { inherit name src; }; +in +appimageTools.wrapType2 { + inherit name src; + + extraInstallCommands = '' + mv $out/bin/${name} $out/bin/${pname} + + install -m 444 -D ${appimageContents}/${shortName}.desktop $out/share/applications/${pname}.desktop + substituteInPlace $out/share/applications/${pname}.desktop \ + --replace 'Exec=AppRun' "Exec=$out/bin/${pname}" + cp -r ${appimageContents}/usr/share/icons $out/share + ''; + + extraPkgs = pkgs: with pkgs; [ fuse ]; + + meta = with lib; { + description = "Fully open source, End to End Encrypted alternative to Google Photos and Apple Photos"; + mainProgram = "ente-photos-desktop"; + homepage = "https://github.com/ente-io/photos-desktop"; + license = licenses.mit; + maintainers = with maintainer; [ tcarrio ]; + platforms = [ "x86_64-linux" ]; + }; +} diff --git a/pkgs/nbdkit.nix b/pkgs/nbdkit.nix new file mode 100644 index 0000000..480c06e --- /dev/null +++ b/pkgs/nbdkit.nix @@ -0,0 +1,89 @@ +{ lib +, stdenv +, fetchFromGitHub +, autoreconfHook +, gnused +, libbpf +, libcap_ng +, numactl +, openssl +, pkg-config +, procps +, python3 +, unbound +, xdp-tools +, writeScript +, +}: + +stdenv.mkDerivation rec { + pname = "ovn"; + version = "1.37.4"; + + src = fetchFromGitHub { + owner = "nbdkit"; + repo = "nbdkit"; + rev = "v${version}"; + hash = "fe250325dd0dfdb6b5297b4a9905cb564f5c0737"; + }; + + nativeBuildInputs = [ + autoreconfHook + pkg-config + python3 + ]; + + buildInputs = [ + libbpf + libcap_ng + numactl + openssl + unbound + xdp-tools + ]; + + # need to build the ovs submodule first + preConfigure = '' + pushd ovs + ./boot.sh + ./configure + make -j $NIX_BUILD_CORES + popd + ''; + + enableParallelBuilding = true; + + doCheck = true; + + nativeCheckInputs = [ + gnused + procps + ]; + + # https://docs.ovn.org/en/latest/topics/testing.html + preCheck = '' + export TESTSUITEFLAGS="-j$NIX_BUILD_CORES" + # allow rechecks to retry flaky tests + export RECHECK=yes + + # hack to stop tests from trying to read /etc/resolv.conf + export OVS_RESOLV_CONF="$PWD/resolv.conf" + touch $OVS_RESOLV_CONF + ''; + + passthru.updateScript = writeScript "ovs-update.nu" '' + ${./update.nu} ${updateScriptArgs} + ''; + + meta = with lib; { + description = "Open Virtual Network"; + longDescription = '' + OVN (Open Virtual Network) is a series of daemons that translates virtual network configuration into OpenFlow, and installs them into Open vSwitch. + ''; + homepage = "https://github.com/ovn-org/ovn"; + changelog = "https://github.com/ovn-org/ovn/blob/${src.rev}/NEWS"; + license = licenses.asl20; + maintainers = with maintainers; [ adamcstephens ]; + platforms = platforms.linux; + }; +} diff --git a/scripts/flatpak.sh b/scripts/flatpak.sh new file mode 100755 index 0000000..8923522 --- /dev/null +++ b/scripts/flatpak.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Best effort to set the GTK theme for Flatpak apps + +case "${XDG_CURRENT_DESKTOP}" in + Cinnamon|GNOME|Pantheon) + COLOR_SCHEME=$(dconf read /org/gnome/desktop/interface/color-scheme | sed -e "s/'//g") + GTK_THEME=$(dconf read /org/gnome/desktop/interface/gtk-theme | sed -e "s/'//g") + ICON_THEME=$(dconf read /org/gnome/desktop/interface/icon-theme | sed -e "s/'//g") + XCURSOR_THEME=$(dconf read /org/gnome/desktop/interface/cursor-theme | sed -e "s/'//g") + if [ "${COLOR_SCHEME}" == "prefer-dark" ]; then + GTK_THEME="${GTK_THEME}:dark" + fi + ;; + MATE) + GTK_THEME=$(dconf read /org/mate/desktop/interface/gtk-theme | sed -e "s/'//g") + ICON_THEME=$(dconf read /org/mate/desktop/interface/icon-theme | sed -e "s/'//g") + XCURSOR_THEME=$(dconf read /org/mate/desktop/peripherals/mouse/cursor-theme | sed -e "s/'//g") + ;; + *) + GTK_THEME="Adwaita" + ICON_THEME="Adwaita" + XCURSOR_THEME="Adwaita" + ;; +esac + +flatpak override --user --env=GTK_THEME="${GTK_THEME}" +flatpak override --user --env=ICON_THEME="${ICON_THEME}" +flatpak override --user --env=XCURSOR_THEME="${XCURSOR_THEME}" diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..b718612 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +set -euo pipefail + +TARGET_HOST="''${1:-}" +TARGET_USER="''${2:-gburd}" +TARGET_TYPE="''${3:-}" + +if [ "$(id -u)" -eq 0 ]; then + echo "ERROR! $(basename "$0") should be run as a regular user" + exit 1 +fi + +if [ ! -d "$HOME/ws/nix-config/.git" ]; then + git clone https://github.com/gburd/nix-config.git "$HOME/ws/nix-config" +fi + +pushd "$HOME/ws/nix-config" + +if [[ -z "$TARGET_HOST" ]]; then + echo "ERROR! $(basename "$0") requires a hostname as the first argument" + echo " The following hosts are available" + ls -1 nixos/*/default.nix | cut -d'/' -f2 | grep -v iso + exit 1 +fi + +if [[ -z "$TARGET_USER" ]]; then + echo "ERROR! $(basename "$0") requires a username as the second argument" + echo " The following users are available" + ls -1 nixos/_mixins/users/ | grep -v -E "nixos|root" + exit 1 +fi + +if [[ -z "$TARGET_TYPE" ]]; then + echo "ERROR! $(basename "$0") requires a type as the third argument" + echo " The following types are available" + ls -1 nixos/ | grep -v -E "workstation|server" + exit 1 +fi + +if [ ! -e "nixos/$TARGET_HOST/disks.nix" ]; then + echo "ERROR! $(basename "$0") could not find the required nixos/$TARGET_HOST/disks.nix" + exit 1 +fi + +# Check if the machine we're provisioning expects a keyfile to unlock a disk. +# If it does, generate a new key, and write to a known location. +if grep -q "data.keyfile" "nixos/$TARGET_HOST/disks.nix"; then + echo -n "$(head -c32 /dev/random | base64)" > /tmp/data.keyfile +fi + +echo "WARNING! The disks in $TARGET_HOST are about to get wiped" +echo " NixOS will be re-installed" +echo " This is a destructive operation" +echo +read -p "Are you sure? [y/N]" -n 1 -r +echo +if [[ $REPLY =~ ^[Yy]$ ]]; then + sudo true + + sudo nix run github:nix-community/disko \ + --extra-experimental-features "nix-command flakes" \ + --no-write-lock-file \ + -- \ + --mode zap_create_mount \ + "nixos/$TARGET_HOST/disks.nix" + + sudo nixos-install --no-root-password --flake ".#$TARGET_HOST" + + # Rsync nix-config to the target install and set the remote origin to SSH. + rsync -a --delete "$HOME/ws/" "/mnt/home/$TARGET_USER/ws/" + pushd "/mnt/home/$TARGET_USER/ws/nix-config" + git remote set-url origin git@github.com:gburd/nix-config.git + popd + + # If there is a keyfile for a data disk, put copy it to the root partition and + # ensure the permissions are set appropriately. + if [[ -f "/tmp/data.keyfile" ]]; then + sudo cp /tmp/data.keyfile /mnt/etc/data.keyfile + sudo chmod 0400 /mnt/etc/data.keyfile + fi +fi diff --git a/sdcard/rpi2.nix b/sdcard/rpi2.nix new file mode 100644 index 0000000..2345314 --- /dev/null +++ b/sdcard/rpi2.nix @@ -0,0 +1,17 @@ +{ ... }: { + nixpkgs.hostPlatform.system = "aarch64-linux"; + nixpkgs.buildPlatform.system = "x86_64-linux"; + + imports = [ + + ]; + + systemd.services.sshd.wantedBy = pkgs.lib.mkForce [ "multi-user.target" ]; + users.users.root = { + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDe7xvr45OB0rHkLy9EWSxGGe/OpmMqawr90+d/RXTP2F9H/X7DDByLuH1VMNtjYAltnRO4zQW6vod90EptfuiTOl6B1lipg2abkRg8yFe+BWSzgNdtzmaKp0UEA6+EbeQft/zGEaPcibcJT8OFEeGdYeMthq5bXiFowgBgdIaMxNo5wn7SButgvT6Jo9VXyWUbMG/HkIKpNzNP1bfMhYcrGGWVfiu3Lyvulj2lJ4OkbEXMQN+sPE+Ti5rUX07zc0sqAvohRxTwAeSJM7RndD4+rEb/tj8bpHYbvcZwmvmVculh/5+vDnWRXJCjbuj6gMnvn2Njbz7Mu6xRZx+ev4SdXpO5vdvd2BBV08fvrWx3iMAqGNppqS0h4UadtApWkx1TjMMuvyk+SZmAtv8OQ662SauS3pIUpr+o8D7BjS8my1mQP5MMW7M3rvpBJ5TlKf2RecDR43R1MZdKzgtKmTLtlarna30Xt4phDXhpyW7C5L9DruZ9MV1Gc4820juIplmN2/WGcwvLGxu+YMiN7jm26T/2bogr039Bpcb3aPLTTm1dkC4qowcFQ7Eww3QH5ECRg8e8b/BaQgA0CUXOZxDSIH3X3c0LdEUCuXVrCc9bHK8U8XFijbMkosIQabudqPiXBXDsrKDSu0qI//T315EfNeXGCocmM5Ujb2P7a2zZFQ== tom@carrio.dev" + ]; + }; + + system.stateVersion = "23.11"; +} diff --git a/shell.nix b/shell.nix index 89755a0..70c5085 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,10 @@ +# Shell for bootstrapping flake-enabled nix and home-manager +# Enter it through 'nix develop' or (legacy) 'nix-shell' + { pkgs ? (import ./nixpkgs.nix) { overlays = [ ]; } }: { default = pkgs.mkShell { - NIX_CONFIG = "extra-experimental-features = nix-command flakes repl-flake"; + # Enable experimental features without having to specify the argument + NIX_CONFIG = "experimental-features = nix-command flakes repl-flake"; nativeBuildInputs = with pkgs; [ nix home-manager @@ -19,9 +23,9 @@ kubectl ]; }; - services.dbus.packages = [ pkgs.gcr ]; - services.pcscd.enable = true; - programs.gnupg.agent = { + #services.dbus.packages = [ pkgs.gcr ]; + #services.pcscd.enable = true; + services.gnupg.agent = { enable = true; pinentryFlavor = "curses"; enableSSHSupport = true; diff --git a/shells/file-sync/.envrc b/shells/file-sync/.envrc new file mode 100644 index 0000000..a5dbbcb --- /dev/null +++ b/shells/file-sync/.envrc @@ -0,0 +1 @@ +use flake . diff --git a/shells/file-sync/flake.nix b/shells/file-sync/flake.nix new file mode 100644 index 0000000..eb025d4 --- /dev/null +++ b/shells/file-sync/flake.nix @@ -0,0 +1,29 @@ +{ + description = "Nix shell for file sync tools"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-23.11"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = + { nixpkgs + , flake-utils + }: + + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + croc # Terminal file transfer + mktorrent # Terminal torrent creator + rclone # Terminal cloud storage client + s3cmd # Terminal cloud storage client + zsync # Terminal file sync + ]; + }; + }); +}