commit 915beb0bdc3131e92a87044eee620d591b6af6cc Author: Simon Gardling Date: Thu Sep 26 22:23:45 2024 -0400 aaa? diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8e672fe --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +nix/home-manager/secrets/factorio.nix filter=git-agecrypt diff=git-agecrypt +nix/etcnixos/secrets/wifi-passwords.nix filter=git-agecrypt diff=git-agecrypt +nix/etcnixos/secrets/secureboot.tar filter=git-agecrypt diff=git-agecrypt diff --git a/README.md b/README.md new file mode 100644 index 0000000..7b61b12 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# My Dotfiles ✨ +These are my dotfiles for my laptop (which I use [NixOS](https://nixos.org/) on). I'm still working on porting more configs to [home-manager](https://github.com/nix-community/home-manager). + +## Structure +The `nix` folder contains two sub directories, `etcnixos` and `home-manager`. The former is the contents of `/etc/nixos` (hence the name), whereas the latter is the contents of `~/.config/home-manager`. +`justfile` is the [just](https://github.com/casey/just) script I use for updating my nixOS system and syncing the changes with this repo. + +## What do I use? +Browser: Firefox 🦊 (actually Librewolf :p) + +Text Editor: [helix](https://github.com/helix-editor/helix) + +Terminal: [alacritty](https://github.com/alacritty/alacritty) + +Shell: [fish](https://fishshell.com/) with the [pure](https://github.com/pure-fish/pure) prompt + +WM: [niri](https://github.com/YaLTeR/niri) (KDE on my desktop) + +There is more that I'm using, but those are the main ones! Read my configs to get more into the specifics. diff --git a/git-agecrypt.toml b/git-agecrypt.toml new file mode 100644 index 0000000..368d47d --- /dev/null +++ b/git-agecrypt.toml @@ -0,0 +1,13 @@ +[config] +"nix/home-manager/secrets/factorio.nix" = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH", + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJjT5QZ3zRDb+V6Em20EYpSEgPW5e/U+06uQGJdraxi", +] +"nix/etcnixos/secrets/secureboot.tar" = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH", + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJjT5QZ3zRDb+V6Em20EYpSEgPW5e/U+06uQGJdraxi", +] +"nix/etcnixos/secrets/wifi-passwords.nix" = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH", + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJjT5QZ3zRDb+V6Em20EYpSEgPW5e/U+06uQGJdraxi", +] diff --git a/justfile b/justfile new file mode 100644 index 0000000..d15b366 --- /dev/null +++ b/justfile @@ -0,0 +1,21 @@ +update_all: system_update home_update sync_configs + +format_home: + nixfmt ~/.config/home-manager + +format_system: + doas nixfmt /etc/nixos + +system_update: + doas nix flake update /etc/nixos + doas nixos-rebuild boot --impure + +home_update: + nix flake update ~/.config/home-manager + rm -fr ~/.gtkrc-2.0 + home-manager switch --impure + +sync_configs: format_home format_system + rsync -a --delete /etc/nixos/ ~/dotfiles/nix/etcnixos/ + rsync -a --delete ~/.config/home-manager/ ~/dotfiles/nix/home-manager/ + cp ~/justfile ~/dotfiles/ diff --git a/nix/etcnixos/common.nix b/nix/etcnixos/common.nix new file mode 100644 index 0000000..799f352 --- /dev/null +++ b/nix/etcnixos/common.nix @@ -0,0 +1,203 @@ +{ + config, + pkgs, + lib, + username, + system, + hostname, + inputs, + ... +}: +{ + imports = [ ./declarative-nm.nix ]; + + nix = { + #garbage collection and cleanup stuff + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + + #optimize the store + optimise.automatic = true; + + #enable flakes! + settings.experimental-features = [ + "nix-command" + "flakes" + ]; + }; + + #kernel options + boot = { + # kernelPackages = pkgs.linuxPackages_cachyos-lto; + kernelPackages = pkgs.linuxPackages_6_10; + + supportedFilesystems = [ "zfs" ]; + + kernel.sysctl = { + #for profiling + "kernel.perf_event_paranoid" = 1; + "kernel.kptr_restrict" = 0; + + #dmesg shushhhhh + "kernel.printk" = "2 4 1 7"; + }; + + # Bootloader. + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = true; + }; + + initrd = { + compressor = "zstd"; + compressorArgs = [ "-19" ]; + }; + }; + + environment.etc = { + #override default nixos /etc/issue + "issue".text = ""; + }; + + services = { + #fwupd for updating firmware + fwupd = { + enable = true; + extraRemotes = [ "lvfs-testing" ]; + }; + + #auto detect network printers + avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Enable CUPS to print documents. + printing = { + enable = true; + drivers = with pkgs; [ hplip ]; + }; + + #disable fprintd (doesn't compile, idk) + fprintd.enable = false; + + #Making sure mullvad works on boot + mullvad-vpn.enable = true; + }; + + # Set your time zone. + time.timeZone = "America/New_York"; + + security = { + #lets use doas and not sudo! + doas.enable = true; + sudo.enable = false; + # Configure doas + doas.extraRules = [ + { + users = [ "${username}" ]; + keepEnv = true; + persist = true; + } + ]; + }; + + age.identityPaths = [ "/home/${username}/.ssh/id_ed25519" ]; + + age.secrets.primary-password = { + file = ./secrets/primary-password.age; + path = "/etc/secrets/primary-password"; + }; + + #networking + networking = import ./networking.nix { inherit hostname; }; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable Bluetooth + hardware.bluetooth = { + enable = true; + powerOnBoot = true; + + #Enable experimental features for battery % of bluetooth devices + settings.General.Experimental = true; + }; + + #apply gtk themes by enabling dconf + programs.dconf.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; # pipewire >>>>>>> pulseaudio + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + # If you want to use JACK applications, uncomment this + # jack.enable = true; + }; + + # Define my user account (the rest of the configuration if found in `~/.config/home-manager/...`) + users.users.${username} = { + isNormalUser = true; + extraGroups = [ + "networkmanager" + "wheel" + "video" + "camera" + ]; + hashedPasswordFile = config.age.secrets.primary-password.path; + }; + + services.gvfs.enable = true; + programs.gphoto2.enable = true; + + # Enable thermal data + services.thermald.enable = true; + + services.pcscd.enable = true; + programs.gnupg.agent = { + enable = true; + pinentryPackage = pkgs.pinentry-curses; + enableSSHSupport = false; + }; + + #System packages + environment.systemPackages = with pkgs; [ + mullvad-vpn + + #secureboot ctl + sbctl + + dmidecode + + (inputs.agenix.packages.${pkgs.system}.default.override { ageBin = "${pkgs.rage}/bin/rage"; }) + + qemu_full + + git-agecrypt + ]; + + #wayland with electron/chromium applications + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + + system.stateVersion = "24.11"; +} diff --git a/nix/etcnixos/declarative-nm.nix b/nix/etcnixos/declarative-nm.nix new file mode 100644 index 0000000..7fea1a0 --- /dev/null +++ b/nix/etcnixos/declarative-nm.nix @@ -0,0 +1,52 @@ +{ + config, + lib, + pkgs, + ... +}: +with lib; +# from: https://discourse.nixos.org/t/imperative-declarative-wifi-networks-with-wpa-supplicant/12394/6 +let + cfg = config.networking.networkmanager; + + getFileName = stringAsChars (x: if x == " " then "-" else x); + + createWifi = ssid: opt: { + name = "NetworkManager/system-connections/${getFileName ssid}.nmconnection"; + value = { + mode = "0400"; + source = pkgs.writeText "${ssid}.nmconnection" '' + [connection] + id=${ssid} + type=wifi + + [wifi] + ssid=${ssid} + + [wifi-security] + ${optionalString (opt.psk != null) '' + key-mgmt=wpa-psk + psk=${opt.psk}''} + ''; + }; + }; + + keyFiles = mapAttrs' createWifi config.networking.wireless.networks; +in +{ + config = mkIf cfg.enable { + environment.etc = keyFiles; + + systemd.services.NetworkManager-predefined-connections = { + restartTriggers = mapAttrsToList (name: value: value.source) keyFiles; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${pkgs.coreutils}/bin/true"; + ExecReload = "${pkgs.networkmanager}/bin/nmcli connection reload"; + }; + reloadIfChanged = true; + wantedBy = [ "multi-user.target" ]; + }; + }; +} diff --git a/nix/etcnixos/flake.lock b/nix/etcnixos/flake.lock new file mode 100644 index 0000000..c371580 --- /dev/null +++ b/nix/etcnixos/flake.lock @@ -0,0 +1,458 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", + "owner": "ryantm", + "repo": "agenix", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "alvr": { + "locked": { + "lastModified": 1727023213, + "narHash": "sha256-KPghRPcTbqCMktw9ahrtiq7a/seajAyLkEI2GS1x+sg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7c2572e5cf4329ad9fa50d33015aa7be394b4026", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "pull/308097/head", + "repo": "nixpkgs", + "type": "github" + } + }, + "chaotic": { + "inputs": { + "fenix": "fenix", + "flake-schemas": "flake-schemas", + "home-manager": "home-manager_2", + "jovian": "jovian", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727292492, + "narHash": "sha256-vKkVoZJB35xOb1kmAH6i74ziuP0ZGKnzM6+NVi/OhD8=", + "owner": "chaotic-cx", + "repo": "nyx", + "rev": "9b30ea4a39c8c5a2b6a6519f85da38f72b7f29f0", + "type": "github" + }, + "original": { + "owner": "chaotic-cx", + "ref": "nyxpkgs-unstable", + "repo": "nyx", + "type": "github" + } + }, + "crane": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721842668, + "narHash": "sha256-k3oiD2z2AAwBFLa4+xfU+7G5fisRXfkvrMTCJrjZzXo=", + "owner": "ipetkov", + "repo": "crane", + "rev": "529c1a0b1f29f0d78fa3086b8f6a134c71ef3aaf", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "fenix": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1726900127, + "narHash": "sha256-v3r7yJY8YE4HAzD5DXOxLkzj8YZKQ0xuccp9yppGW1U=", + "owner": "nix-community", + "repo": "fenix", + "rev": "18eefba7fd0bf03e115785948758a44125a9fd68", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-schemas": { + "locked": { + "lastModified": 1721999734, + "narHash": "sha256-G5CxYeJVm4lcEtaO87LKzOsVnWeTcHGKbKxNamNWgOw=", + "rev": "0a5c42297d870156d9c57d8f99e476b738dcd982", + "revCount": 75, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.5/0190ef2f-61e0-794b-ba14-e82f225e55e6/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%3D0.1.5.tar.gz" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_2": { + "inputs": { + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726902823, + "narHash": "sha256-Gkc7pwTVLKj4HSvRt8tXNvosl8RS9hrBAEhOjAE0Tt4=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "14929f7089268481d86b83ed31ffd88713dcd415", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "chaotic", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726902390, + "narHash": "sha256-ESAD6AkxsQdV/j5ZBcO4Vg94J7Xd0nfpiEZpJtwSEhg=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "faf4c746c068dd8e41b1fa5f18beeabd34d4064c", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1725379389, + "narHash": "sha256-qS1H/5/20ewJIXmf8FN2A5KTOKKU9elWvCPwdBi1P/U=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "e7bd94e0b5ff3c1e686f2101004ebf4fcea9d871", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lanzaboote", + "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" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1727040444, + "narHash": "sha256-19FNN5QT9Z11ZUMfftRplyNN+2PgcHKb3oq8KMW/hDA=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "d0cb432a9d28218df11cbd77d984a2a46caeb5ac", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "master", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727122398, + "narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": [ + "lanzaboote", + "flake-compat" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1721042469, + "narHash": "sha256-6FPUl7HVtvRHCCBQne7Ylp4p+dpP3P/OYuzjztZ4s70=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "f451c19376071a90d8c58ab1a953c6e9840527fd", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "alvr": "alvr", + "chaotic": "chaotic", + "lanzaboote": "lanzaboote", + "nixos-hardware": "nixos-hardware", + "nixpkgs": "nixpkgs" + } + }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1726443025, + "narHash": "sha256-nCmG4NJpwI0IoIlYlwtDwVA49yuspA2E6OhfCOmiArQ=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "94b526fc86eaa0e90fb4d54a5ba6313aa1e9b269", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1722219664, + "narHash": "sha256-xMOJ+HW4yj6e69PvieohUJ3dBSdgCfvI0nnCEe6/yVc=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "a6fbda5d9a14fb5f7c69b8489d24afeb349c7bb4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/etcnixos/flake.nix b/nix/etcnixos/flake.nix new file mode 100644 index 0000000..5a96564 --- /dev/null +++ b/nix/etcnixos/flake.nix @@ -0,0 +1,78 @@ +{ + description = "A simple NixOS flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + lanzaboote = { + url = "github:nix-community/lanzaboote"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + + alvr.url = "github:NixOS/nixpkgs/pull/308097/head"; + + chaotic = { + url = "github:chaotic-cx/nyx/nyxpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { + self, + nixpkgs, + lanzaboote, + nixos-hardware, + chaotic, + agenix, + ... + }@inputs: + let + username = "primary"; + hostname = nixpkgs.lib.strings.removeSuffix "\n" (builtins.readFile /etc/hostname); + system = "x86_64-linux"; + + # pkgs = import nixpkgs { + # config.replaceStdenv = { pkgs }: pkgs.clangStdenv; + # }; + pkgs = import nixpkgs { + config.allowUnfreePredicate = + pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "steam" + "steam-original" + "steam-run" + ]; + }; + in + { + nixosConfigurations.${hostname} = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs username hostname; + }; + inherit pkgs; + modules = + [ + ./system-${hostname}.nix + chaotic.nixosModules.default + agenix.nixosModules.default + + ] + ++ ( + if ("${hostname}" == "mreow") then # laptop + [ + nixos-hardware.nixosModules.framework-12th-gen-intel + lanzaboote.nixosModules.lanzaboote + ] + else + [ ] + ); + }; + }; +} diff --git a/nix/etcnixos/hardware_desktop.nix b/nix/etcnixos/hardware_desktop.nix new file mode 100644 index 0000000..3f45ceb --- /dev/null +++ b/nix/etcnixos/hardware_desktop.nix @@ -0,0 +1,59 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ + config, + lib, + pkgs, + modulesPath, + ... +}: + +{ + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; + + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usb_storage" + "usbhid" + "sd_mod" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/ff51be5a-b87b-4e6a-9c1d-796ceeaca153"; + fsType = "ext4"; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/3D37-E610"; + fsType = "vfat"; + options = [ + "fmask=0022" + "dmask=0022" + ]; + }; + + fileSystems."/media/steam" = { + device = "/dev/disk/by-uuid/df865fc2-6b26-4689-809b-1615f860507e"; + fsType = "btrfs"; + options = [ "nofail" ]; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nix/etcnixos/hardware_laptop.nix b/nix/etcnixos/hardware_laptop.nix new file mode 100644 index 0000000..17a48a2 --- /dev/null +++ b/nix/etcnixos/hardware_laptop.nix @@ -0,0 +1,53 @@ +{ + config, + lib, + pkgs, + modulesPath, + ... +}: +{ + imports = [ + #if this is removed, then niri doesn't start, TODO! look into wtf this does + (modulesPath + "/installer/scan/not-detected.nix") + ]; + boot.initrd.availableKernelModules = [ + "xhci_pci" + "thunderbolt" + "nvme" + ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/acbd96e3-e7c7-442d-82cc-ce2913a9e90c"; + fsType = "btrfs"; + options = [ + "subvol=@" + "compress=zstd" + "autodefrag" + "noatime" + "space_cache=v2" + "discard" + ]; + }; + + boot.initrd.luks.devices."luks-0f481d5f-528c-4838-bd8a-d2780b4ba234".device = "/dev/disk/by-uuid/0f481d5f-528c-4838-bd8a-d2780b4ba234"; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/4D19-520E"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # Enables DHCP on each ethernet and wireless interface. In case of scripted networking + # (the default) this is the recommended approach. When using systemd-networkd it's + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp166s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/nix/etcnixos/networking.nix b/nix/etcnixos/networking.nix new file mode 100644 index 0000000..f660e51 --- /dev/null +++ b/nix/etcnixos/networking.nix @@ -0,0 +1,19 @@ +{ hostname, ... }: +{ + hostName = "${hostname}"; + + hostId = "cfe0ff46"; + + networkmanager = { + enable = true; + insertNameservers = [ + "1.1.1.1" + "8.8.8.8" + ]; + wifi = { + scanRandMacAddress = true; + }; + }; + + wireless.networks = import ./secrets/wifi-passwords.nix; +} diff --git a/nix/etcnixos/secrets/primary-password.age b/nix/etcnixos/secrets/primary-password.age new file mode 100644 index 0000000..ca3ac41 Binary files /dev/null and b/nix/etcnixos/secrets/primary-password.age differ diff --git a/nix/etcnixos/secrets/secrets.nix b/nix/etcnixos/secrets/secrets.nix new file mode 100644 index 0000000..2aa18e7 --- /dev/null +++ b/nix/etcnixos/secrets/secrets.nix @@ -0,0 +1,16 @@ +let + laptop = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH"; + desktop = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJjT5QZ3zRDb+V6Em20EYpSEgPW5e/U+06uQGJdraxi"; +in +(builtins.listToAttrs ( + map + (f: { + f.publicKeys = [ + laptop + desktop + ]; + }) + [ + "primary-password.age" + ] +)) diff --git a/nix/etcnixos/secrets/secureboot.tar b/nix/etcnixos/secrets/secureboot.tar new file mode 100644 index 0000000..c76e36e Binary files /dev/null and b/nix/etcnixos/secrets/secureboot.tar differ diff --git a/nix/etcnixos/secrets/wifi-passwords.nix b/nix/etcnixos/secrets/wifi-passwords.nix new file mode 100644 index 0000000..8017f66 --- /dev/null +++ b/nix/etcnixos/secrets/wifi-passwords.nix @@ -0,0 +1,22 @@ +{ + #home network + "gw" = { + psk = "cgAsusNetwork"; + }; + + #school network + "FLTech-Guest" = { + psk = "87293453"; + }; + + #redmond airbnb (16839 NE 89th Street) + "16839wifi" = { + #such a bad password + psk = "letmein123"; + }; + + #mobile hotspot + "silli kitty" = { + psk = "2f2ewir8r6k95y4"; + }; +} diff --git a/nix/etcnixos/system-mreow.nix b/nix/etcnixos/system-mreow.nix new file mode 100644 index 0000000..ddfa0ad --- /dev/null +++ b/nix/etcnixos/system-mreow.nix @@ -0,0 +1,125 @@ +{ + config, + pkgs, + lib, + username, + system, + ... +}: +{ + imports = [ + ./common.nix + ./hardware_laptop.nix + ]; + + services.tlp = { + enable = true; + settings = { + CPU_SCALING_GOVERNOR_ON_AC = "performance"; + CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; + + CPU_ENERGY_PERF_POLICY_ON_BAT = "power"; + CPU_ENERGY_PERF_POLICY_ON_AC = "performance"; + + CPU_MIN_PERF_ON_AC = 0; + CPU_MAX_PERF_ON_AC = 100; + CPU_MIN_PERF_ON_BAT = 0; + CPU_MAX_PERF_ON_BAT = 60; + + CPU_BOOST_ON_BAT = 0; + START_CHARGE_THRESH_BAT0 = 90; + STOP_CHARGE_THRESH_BAT0 = 95; + RUNTIME_PM_ON_BAT = "auto"; + }; + }; + + services = { + #using btrfs, so lets scrub! + btrfs.autoScrub = { + enable = true; + interval = "weekly"; + fileSystems = [ "/" ]; + }; + }; + + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd ${pkgs.niri}/bin/niri-session"; + user = "${username}"; + }; + }; + }; + + boot = { + enableContainers = true; + + lanzaboote = { + enable = true; + pkiBundle = "/etc/secureboot"; + }; + + # Bootloader. + loader = { + /* + Lanzaboote currently replaces the systemd-boot module. + This setting is usually set to true in configuration.nix + generated at installation time. So we force it to false + for now. + */ + systemd-boot.enable = lib.mkForce false; + }; + + kernelParams = [ + "mitigations=off" + ]; + }; + + # this is a life saver. + # literally no documentation about this anywhere. + # might be good to write about this... + # https://www.reddit.com/r/NixOS/comments/u0cdpi/tuigreet_with_xmonad_how/ + systemd.services.greetd.serviceConfig = { + Type = "idle"; + StandardInput = "tty"; + StandardOutput = "tty"; + StandardError = "journal"; # Without this errors will spam on screen + # Without these bootlogs will spam on screen + TTYReset = true; + TTYVHangup = true; + TTYVTDisallocate = true; + }; + + # Enable common container config files in /etc/containers + virtualisation = { + containers.enable = true; + podman = { + enable = true; + + # Required for containers under podman-compose to be able to talk to each other. + # defaultNetwork.settings.dns_enabled = true; + }; + }; + + environment.systemPackages = with pkgs; [ + distrobox + ]; + + #weird hack to get swaylock working? idk, if you don't put this here, password entry doesnt work + #if I move to another lock screen program, i will have to replace `swaylock` + security.pam.services.swaylock = { }; + + system.activationScripts = { + "secureboot-keys".text = + let + secureboot_path = "/etc/secureboot"; + in + '' + #!/bin/sh + rm -fr ${secureboot_path} || true + mkdir -p ${secureboot_path} + ${pkgs.gnutar}/bin/tar xf /etc/nixos/secrets/secureboot.tar -C ${secureboot_path} + ''; + }; +} diff --git a/nix/etcnixos/system-nixos.nix b/nix/etcnixos/system-nixos.nix new file mode 100644 index 0000000..5d2971f --- /dev/null +++ b/nix/etcnixos/system-nixos.nix @@ -0,0 +1,148 @@ +{ + config, + pkgs, + lib, + username, + system, + cpu_arch, + inputs, + ... +}: +{ + imports = [ + ./common.nix + ./hardware_desktop.nix + ]; + + boot = { + kernelPatches = [ + #for making ALVR support better :) + { + name = "amdgpu-ignore-ctx-privileges"; + patch = pkgs.fetchpatch { + name = "cap_sys_nice_begone.patch"; + url = "https://github.com/Frogging-Family/community-patches/raw/master/linux61-tkg/cap_sys_nice_begone.mypatch"; + sha256 = "Y3a0+x2xvHsfLax/uwycdJf3xLxvVfkfDVqjkxNaYEo="; + }; + } + ]; + kernelParams = [ + # allow overclocking (I actually underclock but lol) + "amdgpu.ppfeaturemask=0xFFF7FFFF" + ]; + + kernelModules = [ + # kernel module for case fan control + "nct6775" + ]; + }; + + services.xserver.enable = false; + services.desktopManager.plasma6.enable = true; + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + + services.openssh = { + enable = true; + ports = [ 22 ]; + settings = { + PasswordAuthentication = true; + AllowUsers = null; # Allows all users by default. Can be [ "user1" "user2" ] + UseDns = true; + X11Forwarding = false; + PermitRootLogin = "no"; # "yes", "without-password", "prohibit-password", "forced-commands-only", "no" + }; + }; + + systemd.services.no-rgb = + let + no-rgb = pkgs.writeScriptBin "no-rgb" '' + #!/bin/sh + NUM_DEVICES=$(${pkgs.openrgb}/bin/openrgb --noautoconnect --list-devices | grep -E '^[0-9]+: ' | wc -l) + + for i in $(seq 0 $(($NUM_DEVICES - 1))); do + ${pkgs.openrgb}/bin/openrgb --noautoconnect --device $i --mode direct --color 000000 + done + ''; + in + { + description = "disable rgb"; + serviceConfig = { + ExecStart = "${no-rgb}/bin/no-rgb"; + Type = "oneshot"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + services.hardware.openrgb.enable = true; + services.udev.packages = [ pkgs.openrgb ]; + hardware.i2c.enable = true; + + #System packages + environment.systemPackages = with pkgs; [ + openrgb-with-all-plugins + lact + ]; + + programs.alvr = { + enable = true; + package = inputs.alvr.legacyPackages.${pkgs.system}.alvr; + openFirewall = true; + }; + + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + # dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers + }; + + # services.ollama = { + # enable = true; + # acceleration = "rocm"; + # environmentVariables = { + # HCC_AMDGPU_TARGET = "gfx1031"; # used to be necessary, but doesn't seem to anymore + # }; + # rocmOverrideGfx = "10.3.1"; + # }; + + # services.open-webui = { + # enable = true; + # openFirewall = true; + # port = 8082; + # environment = { + # # Disable authentication + # WEBUI_AUTH = "False"; + # PYDANTIC_SKIP_VALIDATING_CORE_SCHEMAS = "True"; + # }; + # }; + + systemd.packages = with pkgs; [ lact ]; + systemd.services.lactd.wantedBy = [ "multi-user.target" ]; + + # control case fans with gpu temperature + # I have case fans attached to my gpu for better cooling + hardware.fancontrol = { + enable = true; + config = + let + select_hwmon = "hwmon/hwmon[[:print:]]*"; + gpu_path = "/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/0000:0a:00.0/0000:0b:00.0/${select_hwmon}"; + mobo_path = "/sys/devices/platform/nct6775.656/${select_hwmon}"; + fan_speed = "${mobo_path}/pwm4"; + + in + '' + INTERVAL=10 + FCTEMPS=${fan_speed}=${gpu_path}/temp1_input + FCFANS= ${fan_speed}=${mobo_path}/fan4_input + MINTEMP=${fan_speed}=40 + MAXTEMP=${fan_speed}=80 + MINSTART=${fan_speed}=150 + MINSTOP=${fan_speed}=0 + MAXPWM=${fan_speed}=255 + ''; + }; +} diff --git a/nix/home-manager/flake.lock b/nix/home-manager/flake.lock new file mode 100644 index 0000000..2966157 --- /dev/null +++ b/nix/home-manager/flake.lock @@ -0,0 +1,400 @@ +{ + "nodes": { + "agenix": { + "inputs": { + "darwin": "darwin", + "home-manager": [ + "home-manager" + ], + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", + "owner": "ryantm", + "repo": "agenix", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, + "binsider": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727190706, + "narHash": "sha256-CUfCWwlZebQyZAQ5bmfmQJhOvc61HgExe1R/U202g2Q=", + "owner": "orhun", + "repo": "binsider", + "rev": "ec8dac79bf7f0d23257a521fc62b2888ebf55b86", + "type": "github" + }, + "original": { + "owner": "orhun", + "repo": "binsider", + "type": "github" + } + }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, + "firefox-mod-theme": { + "flake": false, + "locked": { + "lastModified": 1727035403, + "narHash": "sha256-xkVZOZRGrL5YKEXb0R701F71vGJ+K5BFpugtqPwf4XQ=", + "owner": "datguypiko", + "repo": "Firefox-Mod-Blur", + "rev": "694566afa267fe6d5eb5c97a87e116ba794ea293", + "type": "github" + }, + "original": { + "owner": "datguypiko", + "repo": "Firefox-Mod-Blur", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1726153070, + "narHash": "sha256-HO4zgY0ekfwO5bX0QH/3kJ/h4KvUDFZg8YpkNwIbg1U=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "bcef6817a8b2aa20a5a6dbb19b43e63c5bf8619a", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727383923, + "narHash": "sha256-4/vacp3CwdGoPf8U4e/N8OsGYtO09WTcQK5FqYfJbKs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "ffe2d07e771580a005e675108212597e5b367d2d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "niri": { + "inputs": { + "flake-parts": "flake-parts", + "niri-stable": "niri-stable", + "niri-unstable": "niri-unstable", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable", + "xwayland-satellite-stable": "xwayland-satellite-stable", + "xwayland-satellite-unstable": "xwayland-satellite-unstable" + }, + "locked": { + "lastModified": 1727332193, + "narHash": "sha256-XnjG+n42JjrIj2Ts33Xa+Udg1QDp9N8FHYbvAkYL9qg=", + "owner": "sodiboo", + "repo": "niri-flake", + "rev": "524000b81ba52f9d5a7b2ac78504468014121ebe", + "type": "github" + }, + "original": { + "owner": "sodiboo", + "repo": "niri-flake", + "type": "github" + } + }, + "niri-stable": { + "flake": false, + "locked": { + "lastModified": 1726304152, + "narHash": "sha256-4YDrKMwXGVOBkeaISbxqf24rLuHvO98TnqxWYfgiSeg=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "6a48728ffb1e638839b07f9ab2f06b2adb41dc61", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "ref": "v0.1.9", + "repo": "niri", + "type": "github" + } + }, + "niri-unstable": { + "flake": false, + "locked": { + "lastModified": 1726412705, + "narHash": "sha256-qRqGbvTpGRn3QhvjOyX0Sn/qPT1bLQUSSHz1vlW/7HE=", + "owner": "YaLTeR", + "repo": "niri", + "rev": "6ee5b5afa784c76b1c31c371b59177136e558fa6", + "type": "github" + }, + "original": { + "owner": "YaLTeR", + "repo": "niri", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1727122398, + "narHash": "sha256-o8VBeCWHBxGd4kVMceIayf5GApqTavJbTa44Xcg5Rrk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "30439d93eb8b19861ccbe3e581abf97bdc91b093", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1725233747, + "narHash": "sha256-Ss8QWLXdr2JCBPcYChJhz4xJm+h/xjl4G0c0XlP6a74=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/356624c12086a18f2ea2825fed34523d60ccc4e3.tar.gz" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1727264057, + "narHash": "sha256-KQPI8CTTnB9CrJ7LrmLC4VWbKZfljEPBXOFGZFRpxao=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "759537f06e6999e141588ff1c9be7f3a5c060106", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "protontricks": { + "flake": false, + "locked": { + "lastModified": 1722530921, + "narHash": "sha256-t794WEMJx/JNX3gTMHfgquFWB7yXkleW07+QURm1NPM=", + "owner": "Matoking", + "repo": "protontricks", + "rev": "f7b1fa33b0438dbd72f7222703f8442e40edc510", + "type": "github" + }, + "original": { + "owner": "Matoking", + "ref": "appinfo_v29", + "repo": "protontricks", + "type": "github" + } + }, + "root": { + "inputs": { + "agenix": "agenix", + "binsider": "binsider", + "firefox-mod-theme": "firefox-mod-theme", + "home-manager": "home-manager", + "niri": "niri", + "nixpkgs": "nixpkgs", + "protontricks": "protontricks", + "rust-overlay": "rust-overlay", + "vdf-patch": "vdf-patch", + "zen-browser": "zen-browser" + } + }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727317727, + "narHash": "sha256-yGYahXzCquyYEgf5GTtvtaN5hXbw20Ok2+o8uVxoaFs=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "a3d832f389606d7dc61a45b244c72ea472d1fcd4", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "vdf-patch": { + "flake": false, + "locked": { + "lastModified": 1719784100, + "narHash": "sha256-OPonFrYrEFYtx0T2hvSYXl/idsm0iDPwqlnm1KbTPIo=", + "owner": "Matoking", + "repo": "vdf", + "rev": "981cad270c2558aeb8eccaf42cfcf9fabbbed199", + "type": "github" + }, + "original": { + "owner": "Matoking", + "ref": "support_new_bvdf", + "repo": "vdf", + "type": "github" + } + }, + "xwayland-satellite-stable": { + "flake": false, + "locked": { + "lastModified": 1718165778, + "narHash": "sha256-dwF9nI54a6Fo9XU5s4qmvMXSgCid3YQVGxch00qEMvI=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "b6d281967cb0b7bf1dfdb8d0f597b517dc4aa5c5", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "ref": "v0.4", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "xwayland-satellite-unstable": { + "flake": false, + "locked": { + "lastModified": 1726378112, + "narHash": "sha256-OANPb73V/RQDqtpIcbzeJ93KuOHKFQv+1xXC44Ut7tY=", + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "rev": "b962a0f33b503aa39c9cf6919f488b664e5b79b4", + "type": "github" + }, + "original": { + "owner": "Supreeeme", + "repo": "xwayland-satellite", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727287465, + "narHash": "sha256-XQAf5M593WmxgaXagtkci/H9DA3jSVx1TJk6F3X5VQo=", + "owner": "MarceColl", + "repo": "zen-browser-flake", + "rev": "96f1b5d80bf7360cb77c9b521f388324f18383a0", + "type": "github" + }, + "original": { + "owner": "MarceColl", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/nix/home-manager/flake.nix b/nix/home-manager/flake.nix new file mode 100644 index 0000000..6bba1fd --- /dev/null +++ b/nix/home-manager/flake.nix @@ -0,0 +1,103 @@ +{ + description = "My nixOS flake for home-manager"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + niri = { + url = "github:sodiboo/niri-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + agenix = { + url = "github:ryantm/agenix"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.home-manager.follows = "home-manager"; + }; + + rust-overlay = { + url = "github:oxalica/rust-overlay"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + binsider = { + url = "github:orhun/binsider"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zen-browser = { + url = "github:MarceColl/zen-browser-flake"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + # sources to patch protontricks as it doesn't work with latest steam beta + # https://github.com/Matoking/protontricks/issues/304#issuecomment-2280920826 + protontricks = { + url = "github:Matoking/protontricks/appinfo_v29"; + flake = false; + }; + + vdf-patch = { + url = "github:Matoking/vdf/support_new_bvdf"; + flake = false; + }; + + firefox-mod-theme = { + url = "github:datguypiko/Firefox-Mod-Blur"; + flake = false; + }; + + }; + + outputs = + { + self, + nixpkgs, + home-manager, + niri, + rust-overlay, + agenix, + ... + }@inputs: + let + username = "primary"; + homeDirectory = "/home/${username}"; + hostname = nixpkgs.lib.strings.removeSuffix "\n" (builtins.readFile /etc/hostname); + pkgs = import nixpkgs { }; + in + { + + homeConfigurations.${username} = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { + inherit inputs username homeDirectory; + }; + modules = [ + ./system-${hostname}.nix + niri.homeModules.config + agenix.homeManagerModules.age + + # add declarative rust modules + ( + { pkgs, ... }: + { + nixpkgs.overlays = [ + rust-overlay.overlays.default + niri.overlays.niri + ]; + + # home-manager stuff + home = { + inherit username homeDirectory; + }; + } + ) + ]; + }; + }; +} diff --git a/nix/home-manager/gui.nix b/nix/home-manager/gui.nix new file mode 100644 index 0000000..f04115d --- /dev/null +++ b/nix/home-manager/gui.nix @@ -0,0 +1,163 @@ +{ + pkgs, + lib, + inputs, + ... +}: +{ + imports = [ + ./no-gui.nix + # ./progs/librewolf.nix + ./progs/gpt4all/gpt4all.nix + ]; + + nixpkgs.config.allowUnfreePredicate = + pkg: + builtins.elem (lib.getName pkg) [ + "apple_cursor" + "factorio-alpha" + ]; + + home.packages = with pkgs; [ + #calculator + gnome-calculator + + #productivity stuff + libreoffice + hunspell # spellcheck + hunspellDicts.en_US # spellcheck dictionary + + #video and audio downloading + parabolic + + #soulseek client + nicotine-plus + + #dark web browsing deep web browsing + tor-browser + + #audio editing + audacity + + #fonts + noto-fonts + noto-fonts-emoji + liberation_ttf + nerdfonts + jetbrains-mono + + #for ebook reading + foliate + + #audio mixer (pavucontrol but for pipewire) + pwvucontrol + + #minecraft launcher + prismlauncher + + mpv + mumble + system76-keyboard-configurator + mission-center + + #jellyfin + finamp # music player + delfin # jellyfin client + + signal-desktop + + #accounting + gnucash + + imagemagick + inkscape + nomacs + + nautilus + + lrcget + + #openstreetmap contributing + josm + + gparted + gnome-disk-utility + + #small nicities + wl-clipboard # wl-copy & wl-paste + libnotify # notifications library + xdg-utils # xdg utils + + puddletag + + inputs.zen-browser.packages."${pkgs.system}".specific + + (factorio.override (import ./secrets/factorio.nix)) + ]; + + # make chromium-based stuff use wayland + home.file.".config/chromium-flags.conf".text = "--ozone-platform-hint=auto"; + + #dark mode + dconf.settings = { + "org/gnome/desktop/interface" = { + color-scheme = "prefer-dark"; + }; + }; + + home.sessionVariables = { + TERMINAL = "alacritty"; + BROWSER = "zen"; + }; + + #Terminal emulator + programs.alacritty = { + enable = true; + package = pkgs.alacritty; + settings = import ./progs/alacritty.nix { inherit pkgs; }; + }; + + #for trezor stuff + /* + trezor-udev-rules #trezor udev rules + trezord + trezor-suite + monero-gui + monero-cli + trezorctl + */ + + #allow extra fonts to be detected by fontconfig + fonts.fontconfig.enable = true; + + #gtk application theming + gtk = { + enable = true; + # make gtk3 applications look like libadwaita applications! + theme = { + package = pkgs.adw-gtk3; + name = "adw-gtk3-dark"; + }; + iconTheme = { + package = pkgs.adwaita-icon-theme; + name = "Adwaita"; + }; + }; + + #qt application theming + qt = { + enable = true; + style = { + name = "breeze-dark"; + package = pkgs.kdePackages.breeze; + }; + }; + + #macOS cursor! + home.pointerCursor = { + gtk.enable = true; + package = pkgs.apple-cursor; + name = "macOS"; + size = 24; + }; +} diff --git a/nix/home-manager/no-gui.nix b/nix/home-manager/no-gui.nix new file mode 100644 index 0000000..5e95ef3 --- /dev/null +++ b/nix/home-manager/no-gui.nix @@ -0,0 +1,202 @@ +{ + pkgs, + inputs, + lib, + homeDirectory, + config, + ... +}: +{ + home.stateVersion = "24.11"; + + home.packages = with pkgs; [ + #hex viewer + hexyl + + #rust stuff + (rust-bin.selectLatestNightlyWith ( + toolchain: + toolchain.default.override { + extensions = [ + "rust-src" + "rust-analyzer" + "clippy" + "rustfmt" + "rust-std" + "cargo" + ]; + #thumbv7m-none-eabi target for stm32 + targets = [ "thumbv7m-none-eabi" ]; + } + )) + + #find typos in code + typos + + #python formatter + ruff + + #for website generation + hugo + + #java development + google-java-format # formatter + jdk # java + jdt-language-server # lsp server + + #for benchmaking stuff + hyperfine + + #replacements for common posix tools + eza # ls replacement + bat # pretty `cat` clone + delta # viewer for `git` and `diff` output + dust # pretty `du` version + duf # better `df` clone + gping # `ping`... but with a graph!! + tldr # `man` but more straight-forward and simpler + ripgrep # grep, but written in rust, respects .gitignore, and very very fast, command is `rg` + + #adds `sensors` command + lm_sensors + + #rssfeed + newsboat + + #HTML/CSS/JSON/ESLint language servers + vscode-langservers-extracted + + just + + pfetch-rs + waypipe + htop + bottom + wget + unzip + mold + gcc + compsize + killall + gnumake + + sshfs + + #nix formatter + nixfmt-rfc-style + + #serial viewer + minicom + + #"~~matt's~~ my trace route" + mtr + + file + + b3sum + + ffmpeg-full + + #microcontroller tooling + probe-rs + + (python312.withPackages ( + ps: with ps; [ + python-lsp-server # lsp + python-lsp-ruff # ruff integration + ] + )) + + binwalk + + smartmontools + + nil # nix lsp + yaml-language-server # yaml lsp + marksman # markdown lsp + + #clang-format and clang-tidy + clang-tools + + # inputs.binsider.packages.${pkgs.system}.binsider + + lldb + + fio + ]; + + home.file.".cargo/config.toml".text = '' + [target.${lib.strings.removeSuffix "-linux" pkgs.system}-unknown-linux-gnu] + linker = "${pkgs.clang}/bin/clang" + rustflags = ["-C", "link-arg=-fuse-ld=${pkgs.mold}/bin/mold"] + ''; + + #default applications + home.sessionVariables = { + EDITOR = "hx"; + }; + + #feed reader + programs.newsboat = { + enable = true; + #store rss feeds in a separate file because it's *a lot* + urls = import ./progs/rss.nix; + }; + + #git (self explanatory) + programs.git = { + enable = true; + package = pkgs.git; + userName = "Simon Gardling"; + userEmail = "titaniumtown@proton.me"; + + #better way to view diffs + delta.enable = true; + + #master -> main + extraConfig = { + init = { + defaultBranch = "main"; + }; + push.autoSetupRemote = true; + }; + + #gpg signing keys + signing = { + key = "9AB28AC10ECE533D"; + signByDefault = true; + }; + }; + + age.secrets.serverpass = { + file = ./secrets/server-password.age; + path = "${homeDirectory}/.secrets/serverpass"; + }; + + age.secrets.gnupg = { + file = ./secrets/gnupg.age; + path = "${homeDirectory}/.secrets/gnupg.tar"; + }; + + home.activation.extractGnuPG = + let + gnupg_dir = "${homeDirectory}/.gnupg"; + in + '' + #!/bin/sh + rm -fr ${gnupg_dir} || true + mkdir -p ${gnupg_dir} + ${pkgs.gnutar}/bin/tar xf ${config.age.secrets.gnupg.path} -C ${gnupg_dir} + find ${gnupg_dir} -type f -exec chmod 600 {} \; + find ${gnupg_dir} -type d -exec chmod 700 {} \; + ''; + + #fish shell! + programs.fish = import ./progs/fish.nix { inherit pkgs; }; + + #text editor + programs.helix = import ./progs/helix.nix { inherit pkgs; }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; +} diff --git a/nix/home-manager/progs/alacritty.nix b/nix/home-manager/progs/alacritty.nix new file mode 100644 index 0000000..50cadaf --- /dev/null +++ b/nix/home-manager/progs/alacritty.nix @@ -0,0 +1,124 @@ +{ pkgs }: +{ + #use the fish shell + shell.program = "${pkgs.fish}/bin/fish"; + + #some programs can't handle alacritty + env.TERM = "xterm-256color"; + + window = { + #using a window manager, no decorations needed + decorations = "none"; + + #semi-transparent + opacity = 0.95; + + #padding between the content of the terminal and the edge + padding = { + x = 10; + y = 10; + }; + + dimensions = { + columns = 80; + lines = 40; + }; + }; + + scrolling = { + history = 1000; + multiplier = 3; + }; + + font = + let + baseFont = { + family = "JetBrains Mono Nerd Font"; + style = "Regular"; + }; + in + { + size = 12; + + normal = baseFont; + + bold = baseFont // { + style = "Bold"; + }; + + italic = baseFont // { + style = "Italic"; + }; + + offset.y = 0; + glyph_offset.y = 0; + }; + + #color scheme + colors = + let + normal = { + black = "0x1b1e28"; + red = "0xd0679d"; + green = "0x5de4c7"; + yellow = "0xfffac2"; + blue = "#435c89"; + magenta = "0xfcc5e9"; + cyan = "0xadd7ff"; + white = "0xffffff"; + }; + + bright = { + black = "0xa6accd"; + red = normal.red; + green = normal.green; + yellow = normal.yellow; + blue = normal.cyan; + magenta = "0xfae4fc"; + cyan = "0x89ddff"; + white = normal.white; + }; + in + { + inherit normal bright; + primary = { + background = "0x131621"; + foreground = bright.black; + }; + + cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + + search = + let + foreground = normal.black; + background = normal.cyan; + in + { + matches = { + inherit foreground background; + }; + + focused_match = { + inherit foreground background; + }; + }; + + selection = { + text = "CellForeground"; + background = "0x303340"; + }; + + vi_mode_cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + }; + + cursor = { + style = "Underline"; + vi_mode_style = "Underline"; + }; +} diff --git a/nix/home-manager/progs/borg.nix b/nix/home-manager/progs/borg.nix new file mode 100644 index 0000000..b928cd3 --- /dev/null +++ b/nix/home-manager/progs/borg.nix @@ -0,0 +1,46 @@ +{ homeDirectory, borgPasswordFile }: +{ + + home = { + location = { + sourceDirectories = + # stuff in my home directory: + ( + map (f: "${homeDirectory}/${f}") [ + ".zen" + ".local/share/fish" + ".gnupg" + ".config/Signal" + ".wallpaper.png" + ".ssh" + + "dotfiles" + "Documents" + "projects" + "Pictures" + "school" + "justfile" + ] + ); + + excludeHomeManagerSymlinks = true; + repositories = [ "ssh://server-public/tank/bak/laptop" ]; + + extraConfig = { + compression = "zstd"; + }; + }; + + retention = { + keepHourly = 48; + keepDaily = 30; + keepWeekly = 26; + keepMonthly = 24; + keepYearly = 10; + }; + + storage = { + encryptionPasscommand = "cat ${borgPasswordFile}"; + }; + }; +} diff --git a/nix/home-manager/progs/fish.nix b/nix/home-manager/progs/fish.nix new file mode 100644 index 0000000..25e6ac0 --- /dev/null +++ b/nix/home-manager/progs/fish.nix @@ -0,0 +1,65 @@ +{ pkgs }: +let + eza = "${pkgs.eza}/bin/eza --color=always --group-directories-first"; + cargo = "${pkgs.cargo}/bin/cargo"; + coreutil = "${pkgs.coreutils}/bin"; +in +{ + enable = true; + + interactiveShellInit = '' + #disable greeting + set fish_greeting + + #fixes gnupg password entry + export GPG_TTY=(${coreutil}/tty) + + #pfetch on shell start (disable pkgs because of execution time) + PF_INFO="ascii title os host kernel uptime memory editor wm" ${pkgs.pfetch-rs}/bin/pfetch + ''; + + shellAliases = { + c = cargo; + cr = "${cargo} run"; + cb = "${cargo} build"; + + # I hate the red background + run0 = "run0 --background=\"\""; + + # from DistroTube's dot files: Changing "ls" to "eza" + ls = "${eza} -al"; + la = "${eza} -a"; + ll = "${eza} -l"; + lt = "${eza} -aT"; + + # gets the largest files in a git repo's history + "git-size" = '' + ${pkgs.git}/bin/git rev-list --objects --all | + ${pkgs.git}/bin/git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | + ${pkgs.gnused}/bin/sed -n 's/^blob //p' | + ${coreutil}/sort --numeric-sort --key=2 | + ${coreutil}/cut -c 1-12,41- | + ${coreutil}/numfmt --field=2 --to=iec-i --suffix=B --padding=7 --round=nearest''; + + #aliases for (I think) macos commands + pbcopy = "${pkgs.wl-clipboard}/bin/wl-copy"; + pbpaste = "${pkgs.wl-clipboard}/bin/wl-paste"; + }; + + shellInit = '' + fish_add_path ~/.local/bin + fish_add_path ~/.cargo/bin + set hydro_color_pwd 62A + set hydro_color_error red + set hydro_color_duration yellow + set hydro_color_prompt green + set hydro_color_git blue + ''; + + plugins = [ + { + name = "hydro"; + src = pkgs.fishPlugins.hydro.src; + } + ]; +} diff --git a/nix/home-manager/progs/gpt4all-HEAD-disable-settings-err.patch b/nix/home-manager/progs/gpt4all-HEAD-disable-settings-err.patch new file mode 100644 index 0000000..a6911ab --- /dev/null +++ b/nix/home-manager/progs/gpt4all-HEAD-disable-settings-err.patch @@ -0,0 +1,19 @@ +diff --git a/main.qml b/main.qml +index 1e685385..7c747eba 100644 +--- a/main.qml ++++ b/main.qml +@@ -72,12 +72,14 @@ Window { + return; + } + ++ /* + // check if we have access to settings and if not show an error + if (!hasShownSettingsAccess && !LLM.hasSettingsAccess()) { + errorSettingsAccess.open(); + hasShownSettingsAccess = true; + return; + } ++ */ + + // check for first time start of this version + if (!hasCheckedFirstStart) { diff --git a/nix/home-manager/progs/gpt4all/gpt4all-HEAD-disable-settings-err.patch b/nix/home-manager/progs/gpt4all/gpt4all-HEAD-disable-settings-err.patch new file mode 100644 index 0000000..a6911ab --- /dev/null +++ b/nix/home-manager/progs/gpt4all/gpt4all-HEAD-disable-settings-err.patch @@ -0,0 +1,19 @@ +diff --git a/main.qml b/main.qml +index 1e685385..7c747eba 100644 +--- a/main.qml ++++ b/main.qml +@@ -72,12 +72,14 @@ Window { + return; + } + ++ /* + // check if we have access to settings and if not show an error + if (!hasShownSettingsAccess && !LLM.hasSettingsAccess()) { + errorSettingsAccess.open(); + hasShownSettingsAccess = true; + return; + } ++ */ + + // check for first time start of this version + if (!hasCheckedFirstStart) { diff --git a/nix/home-manager/progs/gpt4all/gpt4all-HEAD-embeddings-model.patch b/nix/home-manager/progs/gpt4all/gpt4all-HEAD-embeddings-model.patch new file mode 100644 index 0000000..fb15635 --- /dev/null +++ b/nix/home-manager/progs/gpt4all/gpt4all-HEAD-embeddings-model.patch @@ -0,0 +1,53 @@ +commit 425b33877c819dd88f3692aae37452c767371f6b +Author: Simon Gardling +Date: Thu Sep 19 10:00:39 2024 -0400 + + use locally downloaded embeddings + +diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt +index 900307ae..802fc31a 100644 +--- a//CMakeLists.txt ++++ b/CMakeLists.txt +@@ -120,6 +120,7 @@ elseif (APPLE) + endif() + + # Embedding model ++#[[ + set(LOCAL_EMBEDDING_MODEL "nomic-embed-text-v1.5.f16.gguf") + set(LOCAL_EMBEDDING_MODEL_MD5 "a5401e7f7e46ed9fcaed5b60a281d547") + set(LOCAL_EMBEDDING_MODEL_PATH "${CMAKE_BINARY_DIR}/resources/${LOCAL_EMBEDDING_MODEL}") +@@ -134,6 +135,7 @@ message(STATUS "Embedding model downloaded to ${LOCAL_EMBEDDING_MODEL_PATH}") + if (APPLE) + list(APPEND CHAT_EXE_RESOURCES "${LOCAL_EMBEDDING_MODEL_PATH}") + endif() ++]] + + set(QAPPLICATION_CLASS QGuiApplication) + add_subdirectory(deps/SingleApplication) +@@ -348,11 +350,13 @@ if (LLMODEL_CUDA) + endif() + endif() + ++#[[ + if (NOT APPLE) + install(FILES "${LOCAL_EMBEDDING_MODEL_PATH}" + DESTINATION resources + COMPONENT ${COMPONENT_NAME_MAIN}) + endif() ++]] + + set(CPACK_GENERATOR "IFW") + set(CPACK_VERBATIM_VARIABLES YES) +diff --git a/gpt4all-chat/src/embllm.cpp b/gpt4all-chat/src/embllm.cpp +index 81b1e9e1..e3266cc7 100644 +--- a/src/embllm.cpp ++++ b/src/embllm.cpp +@@ -84,7 +84,7 @@ bool EmbeddingLLMWorker::loadModel() + + QString filePath = embPathFmt.arg(QCoreApplication::applicationDirPath(), LOCAL_EMBEDDING_MODEL); + if (!QFileInfo::exists(filePath)) { +- qWarning() << "embllm WARNING: Local embedding model not found"; ++ qWarning() << "embllm WARNING: Local embedding model not found: " << filePath; + return false; + } + diff --git a/nix/home-manager/progs/gpt4all/gpt4all.nix b/nix/home-manager/progs/gpt4all/gpt4all.nix new file mode 100644 index 0000000..ef222f8 --- /dev/null +++ b/nix/home-manager/progs/gpt4all/gpt4all.nix @@ -0,0 +1,124 @@ +{ pkgs, lib, ... }: +let + models = [ + { + name = "Qwen2.5-14B-Instruct-Q4_K_S.gguf"; + context_length = "32768"; + gen_length = "8192"; + source = pkgs.fetchurl { + url = "https://huggingface.co/bartowski/Qwen2.5-14B-Instruct-GGUF/resolve/main/Qwen2.5-14B-Instruct-Q4_K_S.gguf?download=true"; + sha256 = "E1CmWUhMMbTXEjIRczzA3rSrVuR8qOL8BLagw7LiyZk="; + }; + } + { + name = "Qwen2.5-7B-Instruct-Q6_K_L.gguf"; + context_length = "32768"; + gen_length = "8192"; + source = pkgs.fetchurl { + url = "https://huggingface.co/bartowski/Qwen2.5-7B-Instruct-GGUF/resolve/main/Qwen2.5-7B-Instruct-Q6_K_L.gguf?download=true"; + sha256 = "thEXN06T/UVGfzdB83jlgpG7kuTzZtz1ZUAdupAnErM="; + }; + } + ]; + + # stolen from: https://stackoverflow.com/a/42398526 + optimizeWithFlags = + pkg: flags: + pkgs.lib.overrideDerivation pkg ( + old: + let + newflags = pkgs.lib.foldl' (acc: x: "${acc} ${x}") "" flags; + oldflags = if (pkgs.lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else ""; + in + { + NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}"; + stdenv = pkgs.clangStdenv; + } + ); + + model_files = builtins.listToAttrs ( + map (f: { + name = ".local/share/nomic.ai/GPT4All/${f.name}"; + value = { + source = f.source; + }; + }) models + ); + + gpt4all_package = ( + optimizeWithFlags + (pkgs.gpt4all.overrideAttrs (old: { + # https://github.com/NixOS/nixpkgs/pull/344001 3.2.1 -> 3.3.0 + version = "3.3.0"; + src = pkgs.fetchFromGitHub { + fetchSubmodules = true; + owner = "nomic-ai"; + repo = "gpt4all"; + rev = "HEAD"; + sha256 = "RDYf+VaI5pl46Cd04ADvvi4ygNfYa4fY9rTv9Ui3qUk="; + }; + + patches = [ + ./gpt4all-HEAD-embeddings-model.patch + ./gpt4all-HEAD-disable-settings-err.patch + ]; + })) + # compile flags + [ + "-Ofast" + "-march=native" + "-mtune=native" + "-fno-protect-parens" + "-fno-finite-math-only" # https://github.com/ggerganov/llama.cpp/pull/7154#issuecomment-2143844461 + ] + ); + +in +{ + home.packages = [ + gpt4all_package + ]; + + home.file = lib.recursiveUpdate { + ".config/nomic.ai/GPT4All.ini".text = + let + system_prompt = "You are an expert AI assistant who is thoughtful and works step-by-step from first principles derive an answer to the user's prompt. For each step, provide a title that describes what you're doing in that step, along with the content. Decide if you need another step or if you're ready to provide your answer to the user, make sure to exhaust ALL POSSIBILITIES before providing a response to the user. While your reasoning is not shown to the user, it is under high levels of scrutiny to ensure high-quality reasoning. WHEN YOU DETERMINE THAT YOU ARE READY TO GIVE A FINAL ANSWER TO THE USER GIVEN YOUR REASONING AND STEP-BY-STEP WORK. ONLY TEXT WRITTEN AFTER A SECTION NAMED \"Final Answer\" WILL BE SHOWN TO THE USER. ASSUME THAT NO REASONING STEPS ARE SHOWN TO THE USER. DO NOT THINK THAT THE USER CAN SEE YOUR INTERNAL REASONING STEPS. + USE AS MANY REASONING STEPS AS POSSIBLE. AT LEAST 3. BE AWARE OF YOUR LIMITATIONS AS AN LLM AND WHAT YOU CAN AND CANNOT DO. EXPLORE ALTERNATE ANSWERS AND CONSIDER THAT YOUR ANSWER MAY BE WRONG. IDENTIFY POSSIBLE ERRORS IN YOUR REASONING AND WHERE SUCH ERRORS MAY BE. FULLY TEST ALL OTHER POSSIBILITIES. YOU CAN BE WRONG. WHEN YOU SAY YOU ARE RE-EXAMINING, ACTUALLY RE-EXAMINE, AND USE ANOTHER APPROACH TO DO SO. DO NOT JUST SAY YOU ARE RE-EXAMINING. SHOW ALL YOUR WORK. USE AT LEAST 3 METHODS TO DERIVE THE ANSWER. USE BEST PRACTICES. WORK FROM FIRST PRINCIPLES TO CREATE YOUR ANSWER."; + in + '' + [General] + chatTheme=Dark + height=940 + suggestionMode=Off + threadCount=8 + uniqueId=7096f2d2-448d-4272-a132-d37e77f8a781 + userDefaultModel=${(builtins.elemAt models 0).name} + width=1472 + x=0 + y=0 + + [download] + lastVersionStarted=${gpt4all_package.version} + '' + + (lib.concatStrings ( + map (model: '' + [model-${model.name}] + contextLength=${model.context_length} + filename=${model.name} + maxLength=${model.gen_length} + promptBatchSize=256 + promptTemplate=<|im_start|>user\n%1<|im_end|>\n<|im_start|>assistant\n + systemPrompt="<|im_start|>system\n${ + # replace newlines with the string "\n" for gpt4all to properly parse + builtins.replaceStrings [ "\n" ] [ "\\n" ] system_prompt + }<|im_end|> + \n" + '') models + )) + + '' + [network] + isActive=true + usageStatsActive=true + ''; + } model_files; +} diff --git a/nix/home-manager/progs/helix.nix b/nix/home-manager/progs/helix.nix new file mode 100644 index 0000000..76f4a5e --- /dev/null +++ b/nix/home-manager/progs/helix.nix @@ -0,0 +1,288 @@ +{ pkgs }: +{ + enable = true; + package = pkgs.helix; + settings = { + theme = "my_theme"; + editor = { + cursor-shape = { + insert = "bar"; + normal = "block"; + select = "underline"; + }; + + file-picker = { + hidden = false; + }; + + #wrapping!! + soft-wrap.enable = true; + }; + }; + + languages = { + language = [ + { + name = "rust"; + auto-format = true; + } + ]; + }; + + themes = { + #modified fleet_dark theme + my_theme = + let + white = "#ffffff"; + gray-120 = "#d1d1d1"; + gray-110 = "#c2c2c2"; + gray-100 = "#a0a0a0"; + gray-90 = "#898989"; + gray-80 = "#767676"; + gray-70 = "#5d5d5d"; + gray-60 = "#484848"; + gray-50 = "#383838"; + gray-40 = "#333333"; + gray-30 = "#2d2d2d"; + gray-20 = "#292929"; + gray-15 = "#1F1F1F"; + gray-10 = "#181818"; + black = "#000000"; + blue-110 = "#6daaf7"; + blue-100 = "#4d9bf8"; + blue-90 = "#3691f9"; + blue-80 = "#1a85f6"; + blue-70 = "#0273eb"; + blue-60 = "#0c6ddd"; + blue-50 = "#195eb5"; + blue-40 = "#194176"; + blue-30 = "#163764"; + blue-20 = "#132c4f"; + blue-10 = "#0b1b32"; + red-80 = "#ec7388"; + red-70 = "#ea4b67"; + red-60 = "#d93953"; + red-50 = "#ce364d"; + red-40 = "#c03248"; + red-30 = "#a72a3f"; + red-20 = "#761b2d"; + red-10 = "#390813"; + green-50 = "#4ca988"; + green-40 = "#3ea17f"; + green-30 = "#028764"; + green-20 = "#134939"; + green-10 = "#081f19"; + yellow-60 = "#f8ab17"; + yellow-50 = "#e1971b"; + yellow-40 = "#b5791f"; + yellow-30 = "#7c511a"; + yellow-20 = "#5a3a14"; + yellow-10 = "#281806"; + purple-20 = "#c07bf3"; + purple-10 = "#b35def"; + + blue = "#87C3FF"; + blue-light = "#ADD1DE"; + coral = "#CC7C8A"; + cyan = "#82D2CE"; + cyan-dark = "#779E9E"; + lime = "#A8CC7C"; + orange = "#E09B70"; + pink = "#E394DC"; + violet = "#AF9CFF"; + yellow = "#EBC88D"; + in + { + "attribute" = lime; + "type" = blue; + "type.return" = blue-light; + "type.parameter" = blue-light; + "constructor" = yellow; + "constant" = violet; + "constant.builtin.boolean" = cyan; + "constant.character" = yellow; + "constant.character.escape" = cyan; + "constant.numeric" = yellow; + "string" = pink; + "string.regexp" = cyan; + "string.special" = { + fg = yellow; + modifiers = [ "underlined" ]; + }; # .path / .url / .symbol + + "comment" = gray-90; # .line + # "comment.block" = {} # .documentation + "variable" = gray-120; # .builtin + "variable.builtin" = { + fg = coral; + }; + # "variable.other" = {} # .member + "variable.other.member" = violet; + "label" = yellow; + "keyword" = cyan; # .operator / .directive / .function + "function" = yellow; + "function.declaration" = "#EFEFEF"; + "function.macro" = lime; + "function.builtin" = lime; + "function.special" = lime; + #"function.declaration.method" = { fg = "lightest", modifiers = ["bold"] } #depends on #4892 + "tag" = blue; + "special" = lime; + "namespace" = blue; + + # used in theming + # "markup" = {} # .normal / .quote / .raw + # "markup.normal" = {} # .completion / .hover + "markup.bold" = { + modifiers = [ "bold" ]; + }; + "markup.italic" = { + modifiers = [ "italic" ]; + }; + "markup.strikethrough" = { + modifiers = [ "crossed_out" ]; + }; + "markup.heading" = { + fg = cyan; + modifiers = [ "bold" ]; + }; # .marker / .1 / .2 / .3 / .4 / .5 / .6 + "markup.list" = pink; # .unnumbered / .numbered + "markup.list.numbered" = cyan; + "markup.list.unnumbered" = cyan; + # "markup.link" = "green" + "markup.link.url" = { + fg = pink; + modifiers = [ + "italic" + "underlined" + ]; + }; + "markup.link.text" = cyan; + "markup.link.label" = purple-20; + "markup.quote" = pink; + "markup.raw" = pink; + "markup.raw.inline" = cyan; # .completion / .hover + "markup.raw.block" = "#EB83E2"; + + "diff.plus" = green-50; + "diff.minus" = red-50; + "diff.delta" = blue-80; + + # ui specific + # "ui.background" = { bg = gray-10; }; # .separator + "ui.background" = { }; + "ui.statusline" = { + fg = gray-120; + bg = gray-20; + }; # .inactive / .normal / .insert / .select + "ui.statusline.normal" = { + fg = gray-120; + bg = gray-20; + }; + "ui.statusline.inactive" = { + fg = gray-90; + }; + "ui.statusline.insert" = { + fg = gray-20; + bg = blue-90; + }; + "ui.statusline.select" = { + fg = gray-20; + bg = yellow-60; + }; + + "ui.cursor" = { + modifiers = [ "reversed" ]; + }; # .insert / .select / .match / .primary + "ui.cursor.match" = { + bg = blue-30; + }; # .insert / .select / .match / .primary + "ui.selection" = { + bg = gray-50; + }; # .primary + "ui.selection.primary" = { + bg = blue-40; + }; + + "ui.cursorline" = { + bg = gray-15; + }; + "ui.linenr" = gray-70; + "ui.linenr.selected" = gray-110; + + "ui.popup" = { + fg = gray-120; + bg = gray-20; + }; # .info + "ui.window" = { + fg = gray-50; + }; + "ui.help" = { + fg = gray-120; + bg = gray-20; + }; + "ui.menu" = { + fg = gray-120; + bg = gray-20; + }; # .selected + "ui.menu.selected" = { + fg = white; + bg = blue-40; + }; # .selected + # Calculated as #ffffff with 30% opacity + "ui.menu.scroll" = { + fg = "#dfdfdf"; + }; + + "ui.text" = gray-120; # .focus / .info + "ui.text.focus" = { + fg = white; + bg = blue-40; + }; + + "ui.virtual" = gray-90; # .whitespace + "ui.virtual.inlay-hint" = { + fg = gray-70; + }; + "ui.virtual.ruler" = { + bg = gray-20; + }; + + "hint" = gray-80; + "info" = "#A366C4"; + "warning" = "#FACb66"; + "error" = "#FF5269"; + + "diagnostic.hint" = { + underline = { + color = gray-80; + style = "line"; + }; + }; + "diagnostic.info" = { + underline = { + color = "#A366C4"; + style = "line"; + }; + }; + "diagnostic.warning" = { + underline = { + color = "#FACB66"; + style = "line"; + }; + }; + "diagnostic.error" = { + underline = { + color = "#FF5269"; + style = "line"; + }; + }; + "diagnostic.unnecessary" = { + modifiers = [ "dim" ]; + }; + "diagnostic.deprecated" = { + modifiers = [ "crossed_out" ]; + }; + }; + }; +} diff --git a/nix/home-manager/progs/librewolf.nix b/nix/home-manager/progs/librewolf.nix new file mode 100644 index 0000000..c26fd13 --- /dev/null +++ b/nix/home-manager/progs/librewolf.nix @@ -0,0 +1,77 @@ +{ pkgs, inputs, ... }: +{ + home.packages = with pkgs; [ librewolf ]; + + programs.librewolf = { + enable = true; + settings = { + "webgl.disabled" = false; + "privacy.resistFingerprinting" = false; + "privacy.clearOnShutdown.history" = false; + "privacy.clearOnShutdown.cookies" = false; + "network.cookie.lifetimePolicy" = 0; + "general.useragent.compatMode.firefox" = true; + "identity.fxaccounts.enabled" = true; + "services.sync.prefs.sync.privacy.clearOnShutdown.cookies" = false; + "services.sync.prefs.sync.privacy.clearOnShutdown_v2.cookiesAndStorage" = false; + + "general.useragent.override" = "Mozilla/5.0 (X11; Linux x86_64; rv:${pkgs.firefox.version}) Gecko/20100101 Firefox/${pkgs.firefox.version}"; + + "extensions.activeThemeID" = "firefox-compact-dark@mozilla.org"; + + # For themeing + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + "browser.tabs.drawInTitlebar" = true; + "svg.context-properties.content.enabled" = true; + + #fake location, FIT (just about) + "geo.provider.network.url" = + "data:application/json," + + builtins.toJSON { + location = { + lat = 28.0749; + lng = -80.6302; + }; + accuracy = 1.0; + }; + }; + }; + + home.file = + let + chromeTheme = ".librewolf/tckj7njq.default-release/chrome"; + + firefoxThemeFile = file: src: { + target = "${chromeTheme}/${file}"; + source = "${inputs.firefox-mod-theme}/${src}/${file}"; + recursive = true; + }; + + baseThemeFile = { + file = ""; + src = ""; + }; + + modThemeFiles = [ + { + file = "userChrome.css"; + } + { + file = "userContent.css"; + } + { + file = "ASSETS"; + } + ]; + in + builtins.listToAttrs ( + map (f: { + name = "firefox-theme-${f.file}"; + value = firefoxThemeFile f.file f.src; + }) (map (f: baseThemeFile // f) modThemeFiles) + ); + + home.sessionVariables = { + BROWSER = "librewolf"; + }; +} diff --git a/nix/home-manager/progs/niri.nix b/nix/home-manager/progs/niri.nix new file mode 100644 index 0000000..a6aa705 --- /dev/null +++ b/nix/home-manager/progs/niri.nix @@ -0,0 +1,167 @@ +{ + config, + pkgs, + homeDirectory, +}: +{ + prefer-no-csd = true; + + spawn-at-startup = [ + #waybar + { command = [ "${pkgs.waybar}/bin/waybar" ]; } + + #swaybg works on more than just sway (sets a wallpaper) + { + command = [ + "${pkgs.swaybg}/bin/swaybg" + "-m" + "center" + "-i" + "${homeDirectory}/.wallpaper.png" + ]; + } + ]; + + window-rules = [ + { draw-border-with-background = false; } + { + geometry-corner-radius = { + top-left = 10.0; + top-right = 10.0; + bottom-right = 10.0; + bottom-left = 10.0; + }; + } + { clip-to-geometry = true; } + ]; + + binds = with config.lib.niri.actions; { + #application launcher + "Mod+Space".action = spawn [ + "${pkgs.rofi-wayland}/bin/rofi" + "-show" + "combi" + ]; + + #open a terminal + "Mod+T".action = spawn "${pkgs.alacritty}/bin/alacritty"; + + #lock the screen + "Mod+X".action = spawn "${pkgs.swaylock}/bin/swaylock"; + + #screenshotting + "Print".action = screenshot; + "Ctrl+Print".action = screenshot-screen; + "Alt+Print".action = screenshot-window; + + #Volume control + "XF86AudioRaiseVolume".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "-u" + "up" + ]; + "XF86AudioLowerVolume".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "-u" + "down" + ]; + "XF86AudioMute".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "toggle-mute" + ]; + "XF86AudioMicMute".action = spawn [ + "${pkgs.avizo}/bin/volumectl" + "-m" + "toggle-mute" + ]; + + #Display Brightness control + "XF86MonBrightnessUp".action = spawn [ + "${pkgs.avizo}/bin/lightctl" + "up" + ]; + "XF86MonBrightnessDown".action = spawn [ + "${pkgs.avizo}/bin/lightctl" + "down" + ]; + + #Force close a window + "Mod+Q".action = close-window; + + "Mod+Shift+Q".action = quit; + + #bindings for like window management ig + + "Mod+Left".action = focus-column-left; + "Mod+Down".action = focus-window-down; + "Mod+Up".action = focus-window-up; + "Mod+Right".action = focus-column-right; + + "Mod+H".action = focus-column-left; + "Mod+J".action = focus-window-down; + "Mod+K".action = focus-window-up; + "Mod+L".action = focus-column-right; + + "Mod+Ctrl+Left".action = move-column-left; + "Mod+Ctrl+Down".action = move-window-down; + "Mod+Ctrl+Up".action = move-window-up; + "Mod+Ctrl+Right".action = move-column-right; + + "Mod+Ctrl+H".action = move-column-left; + "Mod+Ctrl+J".action = move-window-down; + "Mod+Ctrl+K".action = move-window-up; + "Mod+Ctrl+L".action = move-column-right; + + #fine adjustments to height and width of window + "Mod+Minus".action = set-column-width "-10%"; + "Mod+Equal".action = set-column-width "+10%"; + "Mod+Shift+Minus".action = set-window-height "-10%"; + "Mod+Shift+Equal".action = set-window-height "+10%"; + + "Mod+Home".action = focus-column-first; + "Mod+End".action = focus-column-last; + "Mod+Ctrl+Home".action = move-column-to-first; + "Mod+Ctrl+End".action = move-column-to-last; + + "Mod+Shift+Left".action = focus-monitor-left; + "Mod+Shift+Down".action = focus-monitor-down; + "Mod+Shift+Up".action = focus-monitor-up; + "Mod+Shift+Right".action = focus-monitor-right; + + "Mod+Shift+H".action = focus-monitor-left; + "Mod+Shift+J".action = focus-monitor-down; + "Mod+Shift+K".action = focus-monitor-up; + "Mod+Shift+L".action = focus-monitor-right; + + "Mod+Shift+Ctrl+Left".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+Down".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+Up".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+Right".action = move-column-to-monitor-right; + + "Mod+Shift+Ctrl+H".action = move-column-to-monitor-left; + "Mod+Shift+Ctrl+J".action = move-column-to-monitor-down; + "Mod+Shift+Ctrl+K".action = move-column-to-monitor-up; + "Mod+Shift+Ctrl+L".action = move-column-to-monitor-right; + + "Mod+Page_Down".action = focus-workspace-down; + "Mod+Page_Up".action = focus-workspace-up; + "Mod+U".action = focus-workspace-down; + "Mod+I".action = focus-workspace-up; + + #move a window up and down workspaces + "Mod+Ctrl+Page_Down".action = move-column-to-workspace-down; + "Mod+Ctrl+Page_Up".action = move-column-to-workspace-up; + + "Mod+Ctrl+U".action = move-column-to-workspace-down; + "Mod+Ctrl+I".action = move-column-to-workspace-up; + + #does little squeeze thing into the left or right position with another window + "Mod+BracketLeft".action = consume-or-expel-window-left; + "Mod+BracketRight".action = consume-or-expel-window-right; + + "Mod+R".action = switch-preset-column-width; + "Mod+F".action = maximize-column; + "Mod+Shift+F".action = fullscreen-window; + "Mod+C".action = center-column; + }; +} diff --git a/nix/home-manager/progs/rss.nix b/nix/home-manager/progs/rss.nix new file mode 100644 index 0000000..97515ca --- /dev/null +++ b/nix/home-manager/progs/rss.nix @@ -0,0 +1,91 @@ +[ + { + title = "Stratechery"; + url = "https://stratechery.passport.online/feed/rss/2gi1tPZ8Ta36Tsx7rDLM5P"; + } + + { + title = "Factorio Blog"; + url = "https://www.factorio.com/blog/rss"; + } + + { + title = "Firefox Nightly News"; + url = "https://blog.nightly.mozilla.org/feed/"; + } + + { + title = "Servo Blog"; + url = "https://servo.org/blog/feed.xml"; + } + + { + title = "Alyssa Rosenzweig"; + url = "https://rosenzweig.io/feed.xml"; + } + + { + title = "Marc's Blog"; + url = "https://brooker.co.za/blog/rss.xml"; + } + + { + title = "Fabien Sanglard"; + url = "https://fabiensanglard.net/rss.xml"; + } + + { + title = "Xuanwo's Blog"; + url = "https://xuanwo.io/index.xml"; + } + + { + title = "Carlos Galdino"; + url = "https://blog.carlosgaldino.com/atom.xml"; + } + + { + title = "soatok"; + url = "https://soatok.blog/feed/"; + } + + { + title = "Jack Garbus"; + url = "https://jarbus.net/index.xml"; + } + + { + title = "Terence Eden"; + url = "https://shkspr.mobi/blog/feed/atom/"; + } + + { + title = "GioCities"; + url = "https://blog.giovanh.com/feeds/atom.xml"; + } + + { + title = "mcyoung"; + url = "https://mcyoung.xyz/atom.xml"; + } + + { + title = "Embrace the Red"; + url = "https://embracethered.com/blog/index.xml"; + } + + { + title = "Chips and Cheese"; + url = "https://chipsandcheese.com/feed/"; + } + + { + title = "System5"; + url = "https://blogsystem5.substack.com/feed"; + } + + { + title = "lwn"; + url = "https://lwn.net/headlines/Features"; + } +] diff --git a/nix/home-manager/progs/swaylock.nix b/nix/home-manager/progs/swaylock.nix new file mode 100644 index 0000000..bb528c3 --- /dev/null +++ b/nix/home-manager/progs/swaylock.nix @@ -0,0 +1,31 @@ +{ + color = "24273a"; + bs-hl-color = "f4dbd6"; + caps-lock-bs-hl-color = "f4dbd6"; + caps-lock-key-hl-color = "a6da95"; + inside-color = 0; + inside-clear-color = 0; + inside-caps-lock-color = 0; + inside-ver-color = 0; + inside-wrong-color = 0; + key-hl-color = "a6da95"; + layout-bg-color = 0; + layout-border-color = 0; + layout-text-color = "cad3f5"; + line-color = 0; + line-clear-color = 0; + line-caps-lock-color = 0; + line-ver-color = 0; + line-wrong-color = 0; + ring-color = "b7bdf8"; + ring-clear-color = "f4dbd6"; + ring-caps-lock-color = "f5a97f"; + ring-ver-color = "8aadf4"; + ring-wrong-color = "ee99a0"; + separator-color = 0; + text-color = "cad3f5"; + text-clear-color = "f4dbd6"; + text-caps-lock-color = "f5a97f"; + text-ver-color = "8aadf4"; + text-wrong-color = "ee99a0"; +} diff --git a/nix/home-manager/progs/waybar.nix b/nix/home-manager/progs/waybar.nix new file mode 100644 index 0000000..5448024 --- /dev/null +++ b/nix/home-manager/progs/waybar.nix @@ -0,0 +1,253 @@ +{ pkgs }: +{ + enable = true; + settings.mainBar = { + layer = "top"; + position = "top"; + # mod = "dock"; + # exclusive = true; + # gtk-layer-shell = true; + margin-bottom = -1; + # passthrough = false; + height = 32; + modules-left = + [ + ]; + modules-center = [ "clock" ]; + modules-right = [ + "cpu" + "memory" + "tray" + "pulseaudio" + "network" + "battery" + ]; + cpu = { + interval = 5; + format = " {usage}%"; + max-length = 10; + }; + memory = { + interval = 10; + format = " {percentage}%"; + max-length = 10; + tooltip = true; + tooltip-format = "RAM - {used:0.1f}GiB used"; + }; + tray = { + icon-size = 18; + spacing = 3; + }; + clock = { + format = " {:%R\n %d.%m.%Y}"; + tooltip-format = "{calendar}"; + calendar = { + mode = "year"; + mode-mon-col = 3; + weeks-pos = "right"; + on-scroll = 1; + on-click-right = "mode"; + format = { + months = "{}"; + days = "{}"; + weeks = "W{}"; + weekdays = "{}"; + today = "{}"; + }; + }; + actions = { + on-click-right = "mode"; + on-click-forward = "tz_up"; + on-click-backward = "tz_down"; + on-scroll-up = "shift_up"; + on-scroll-down = "shift_down"; + }; + }; + network = { + format-wifi = " {icon}"; + format-ethernet = "  "; + format-disconnected = "󰌙 "; + format-icons = [ + "󰤯 " + "󰤟 " + "󰤢 " + "󰤢 " + "󰤨 " + ]; + }; + battery = { + states = { + good = 95; + warning = 30; + critical = 20; + }; + format = " {icon} {capacity}%"; + format-charging = "  {capacity}%"; + format-plugged = "  {capacity}%"; + format-alt = "{time} {icon}"; + format-icons = [ + "󰂎" + "󰁺" + "󰁻" + "󰁼" + "󰁽" + "󰁾" + "󰁿" + "󰂀" + "󰂁" + "󰂂" + "󰁹" + ]; + }; + # not actually pulseaudio-specific + pulseaudio = { + max-volume = 100; + scroll-step = 10; + format = "{icon}"; + tooltip-format = "{volume}%"; + format-muted = "🔇"; + format-icons = { + default = [ + " " + " " + " " + ]; + }; + on-click = "${pkgs.pwvucontrol}/bin/pwvucontrol"; + }; + }; + + style = '' + /*base background color*/ + @define-color bg_main rgba(25, 25, 25, 1.0); + @define-color bg_main_tooltip rgba(0, 0, 0, 0.7); + + + /*base background color of selections */ + @define-color bg_hover rgba(200, 200, 200, 0.3); + /*base background color of active elements */ + @define-color bg_active rgba(100, 100, 100, 0.5); + + /*base border color*/ + @define-color border_main rgba(255, 255, 255, 0.2); + + /*text color for entries, views and content in general */ + @define-color content_main white; + /*text color for entries that are unselected */ + @define-color content_inactive rgba(255, 255, 255, 0.25); + + * { + text-shadow: none; + box-shadow: none; + border: none; + border-radius: 0; + font-family: "Segoe UI", "Ubuntu"; + font-weight: 600; + font-size: 12.7px; + } + + window#waybar { + background: @bg_main; + border-top: 0; + color: @content_main; + } + + tooltip { + background: @bg_main_tooltip; + border-radius: 5px; + border-width: 1px; + border-style: solid; + border-color: @border_main; + } + + tooltip label { + color: @content_main; + } + + #taskbar { + } + + #taskbar button { + min-width: 130px; + border-bottom: 3px solid rgba(255, 255, 255, 0.3); + margin-left: 2px; + margin-right: 2px; + padding-left: 8px; + padding-right: 8px; + color: white; + transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); + } + + #taskbar button.active { + border-bottom: 3px solid white; + background: @bg_active; + } + + #taskbar button:hover { + border-bottom: 3px solid white; + background: @bg_hover; + color: @content_main; + } + + #cpu, #memory { + padding:3px; + } + + #window { + border-radius: 10px; + margin-left: 20px; + margin-right: 20px; + } + + #tray { + margin-left: 5px; + margin-right: 5px; + } + + #tray > .passive { + border-bottom: none; + } + + #tray > .active { + border-bottom: 3px solid white; + } + + #tray > .needs-attention { + border-bottom: 3px solid @warning_color; + } + + #tray > widget { + transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); + } + + #tray > widget:hover { + background: @bg_hover; + } + + #pulseaudio { + font-family: "JetBrains Mono Nerd Font"; + padding-left: 3px; + padding-right: 3px; + transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); + } + + #pulseaudio:hover { + background: @bg_hover; + } + + #network { + padding-left: 3px; + padding-right: 3px; + } + + #clock { + padding-right: 5px; + padding-left: 5px; + transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); + } + + #clock:hover { + background: @bg_hover; + } + ''; +} diff --git a/nix/home-manager/secrets/borg-laptop-password.age b/nix/home-manager/secrets/borg-laptop-password.age new file mode 100644 index 0000000..abca559 --- /dev/null +++ b/nix/home-manager/secrets/borg-laptop-password.age @@ -0,0 +1,10 @@ +age-encryption.org/v1 +-> ssh-ed25519 JlUYaQ 0zR1i7aaaTiNatQ64adSfLAes3mxyErq3kZUziRInVc +A8sfonsw2iodHRFsmYbmMNAviEUFSy9mkXuq6jefki8 +-> ssh-ed25519 dHDJgQ CmnVM06YvF+mzPNF1LsHdyL1hk+d/yH3HTBcdRlX/2c +79u1EAd+g/Cmb9TzAifO4VHqJZk5T88nP4DWfsJEuIw +-> >=ei241-grease co`|!7_c lx{qy +A6d8YS1s8NZojKmRVWhmJDzOOFT/AEO/IRZN0LI30QP3jImoTJ4EFDQUm4p+0IWk +dam3RKxF7XzF6dNigGDKKeIVXcSX1SiEgHyIo0+hPm2nZbM/p1IJ6fsACbTB6Q +--- /Za+90oVP7/fGDLBRr6s56UopJjz8f851js/htBcYWA +6e0YT0|`H>`b. XGXs1n.$o \ No newline at end of file diff --git a/nix/home-manager/secrets/factorio.nix b/nix/home-manager/secrets/factorio.nix new file mode 100644 index 0000000..b9ac467 --- /dev/null +++ b/nix/home-manager/secrets/factorio.nix @@ -0,0 +1,4 @@ +{ + username = "titaniumtown"; + token = "7e949b0b0615bd637f0d81fdf8bc5d"; +} diff --git a/nix/home-manager/secrets/gnupg.age b/nix/home-manager/secrets/gnupg.age new file mode 100644 index 0000000..2a50dc2 Binary files /dev/null and b/nix/home-manager/secrets/gnupg.age differ diff --git a/nix/home-manager/secrets/secrets.nix b/nix/home-manager/secrets/secrets.nix new file mode 100644 index 0000000..9cd62a9 --- /dev/null +++ b/nix/home-manager/secrets/secrets.nix @@ -0,0 +1,18 @@ +let + laptop = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO4jL6gYOunUlUtPvGdML0cpbKSsPNqQ1jit4E7U1RyH"; + desktop = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBJjT5QZ3zRDb+V6Em20EYpSEgPW5e/U+06uQGJdraxi"; +in +(builtins.listToAttrs ( + map + (f: { + f.publicKeys = [ + laptop + desktop + ]; + }) + [ + "server-password.age" + "borg-laptop-password.age" + "gnupg.age" + ] +)) diff --git a/nix/home-manager/secrets/server-password.age b/nix/home-manager/secrets/server-password.age new file mode 100644 index 0000000..1df1be5 --- /dev/null +++ b/nix/home-manager/secrets/server-password.age @@ -0,0 +1,9 @@ +age-encryption.org/v1 +-> ssh-ed25519 JlUYaQ u9duGBEW7wp7aG5cqd1gfB8w+MDAirki9ZVSsotqtRM +9gyL9k29ytNJZ6Kp90309bDim1fZNqcLhPTVqs1py5s +-> ssh-ed25519 dHDJgQ ytHA01CSY/0dD6F8XC9ilzNaivZS84PsCmr5GFWAE1o +4jLi+spahOIExkrUyfpX8cYJFEKvWfErWskYJ2btBkw +-> Q-grease +n1QvV95VRYZ7CiOl6KOedEKr2L7tjTdj8aahF/DHOifCyWnc +--- iV/7+IbpWvsgrZIs2yPwOL0Xa6AlvkIfwbDotCh7iiQ +'Fh2mYiuL/D* :@;f 9v{2aǫ& \ No newline at end of file diff --git a/nix/home-manager/system-mreow.nix b/nix/home-manager/system-mreow.nix new file mode 100644 index 0000000..c042439 --- /dev/null +++ b/nix/home-manager/system-mreow.nix @@ -0,0 +1,183 @@ +{ + config, + pkgs, + lib, + homeDirectory, + ... +}: +{ + imports = [ ./gui.nix ]; + + home.packages = with pkgs; [ + wdisplays + intel-gpu-tools + swaylock + + #manage bluetooth devices + blueman + + niri-unstable + ]; + + #bluetooth manager + services.blueman-applet.enable = true; + + #notification daemon + services.dunst = { + enable = true; + package = pkgs.dunst; + }; + + #window manager + programs.niri = { + package = pkgs.niri-unstable; + settings = import ./progs/niri.nix { inherit config pkgs homeDirectory; }; + }; + + programs.swaylock = { + enable = true; + settings = import ./progs/swaylock.nix; + }; + + #waybar for status bar + programs.waybar = import ./progs/waybar.nix { inherit pkgs; }; + + #rofi for application launcher + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + extraConfig = { + modi = "window,drun,ssh,combi"; + combi-modi = "window,drun,ssh"; + }; + }; + + age.secrets.borg-laptop-password = { + file = ./secrets/borg-laptop-password.age; + path = "${homeDirectory}/.secrets/borg_bak_pass"; + }; + + #backup utility + programs.borgmatic = { + enable = true; + package = pkgs.borgmatic; + backups = + let + borgPasswordFile = config.age.secrets.borg-laptop-password.path; + in + import ./progs/borg.nix { inherit homeDirectory borgPasswordFile; }; + }; + + # https://community.frame.work/t/speakers-sound-quality/1078/83 + # Filter: ON HPQ Fc 100.0 Hz Gain 0.0 dB Q 1.0 + # Filter: ON PK Fc 150.0 Hz Gain 4.02 dB Q 3.0 + # Filter: ON PK Fc 600.0 Hz Gain -5.07 dB Q 4.000000000000008 + # Filter: ON PK Fc 1200.0 Hz Gain -3.49 dB Q 4.17 + # Filter: ON PK Fc 2000.0 Hz Gain 1.43 dB Q 4.0 + # Filter: ON PK Fc 5300.0 Hz Gain 3.84 dB Q 2.64 + # Filter: ON HSC Fc 6000.0 Hz Gain 4.02 dB Q 4.36 + # Filter: ON PK Fc 7500.0 Hz Gain -2.09 dB Q 3.0 + # Filter: ON PK Fc 8000.0 Hz Gain 2.01 dB Q 4.36 + # Filter: ON PK Fc 900.0 Hz Gain -4.12 dB Q 5.909999999999967 + home.file.".config/easyeffects/output/framework.json".text = + let + baseBand = { + mode = "RLC (BT)"; + mute = false; + solo = false; + slope = "1x"; + type = "Bell"; + }; + + bandList = [ + { + frequency = 100.0; + gain = 0.0; + q = 1.0; + slope = "x4"; + type = "Hi-pass"; + } + { + frequency = 150.0; + gain = 4.02; + q = 3.0; + } + { + frequency = 600.0; + gain = -5.07; + q = 4.000000000000008; + } + { + frequency = 1200.0; + gain = -3.49; + q = 4.17; + } + { + frequency = 2000.0; + gain = 1.43; + q = 4.0; + } + { + frequency = 5300.0; + gain = 3.84; + q = 2.64; + } + { + frequency = 6000.0; + gain = 4.02; + q = 4.36; + type = "Hi-shelf"; + } + { + frequency = 7500.0; + gain = -2.09; + q = 3.0; + } + { + frequency = 8000.0; + gain = 2.01; + q = 4.36; + } + { + frequency = 900.0; + gain = -4.12; + q = 5.909999999999967; + } + ]; + + bands = builtins.listToAttrs ( + map (f: { + name = "band${toString f.snd}"; + value = baseBand // f.fst; + }) (lib.lists.zipLists bandList (lib.range 0 (lib.length (bandList)))) + ); + + in + builtins.toJSON { + output = { + blocklist = [ ]; + equalizer = { + balance = 0.0; + bypass = false; + input-gain = 0.0; + left = bands; + right = bands; + mode = "IIR"; + num-bands = 10; + output-gain = -1.5; + pitch-left = 0.0; + pitch-right = 0.0; + split-channels = false; + }; + plugins_order = [ + "equalizer" + ]; + }; + }; + + services.easyeffects = { + enable = true; + package = pkgs.easyeffects; + preset = "framework"; + }; +} diff --git a/nix/home-manager/system-nixos.nix b/nix/home-manager/system-nixos.nix new file mode 100644 index 0000000..1435381 --- /dev/null +++ b/nix/home-manager/system-nixos.nix @@ -0,0 +1,45 @@ +{ + pkgs, + inputs, + lib, + ... +}: +{ + imports = [ ./gui.nix ]; + nixpkgs.config.allowUnfree = true; + + nixpkgs.overlays = [ + # Add a protontricks-beta package so we can use protontricks with latest steam beta + # https://github.com/Matoking/protontricks/issues/304#issuecomment-2280920826 + ( + final: prev: + let + ps = prev.python312Packages; + in + { + vdf-patch = ps.vdf.overrideAttrs (oldAttrs: { + src = inputs.vdf-patch; + }); + protontricks-beta = prev.protontricks.overrideAttrs (oldAttrs: { + src = inputs.protontricks; + propagatedBuildInputs = [ + ps.setuptools # implicit dependency, used to find data/icon_placeholder.png + final.vdf-patch + ps.pillow + ]; + }); + } + ) + ]; + + home.packages = with pkgs; [ + protontricks-beta + beatsabermodmanager + protonup-qt + ]; + + programs.alacritty.settings = { + window.decorations = lib.mkForce "full"; + window.opacity = lib.mkForce 1.0; + }; +}