From 76c91fc81722e9803ae7d0b517da728e41cb5b37 Mon Sep 17 00:00:00 2001 From: Tao Tien <29749622+taotien@users.noreply.github.com> Date: Thu, 28 Sep 2023 23:33:56 -0700 Subject: [PATCH] current --- extras/dev.nix | 69 ++++++++++++++++++++++++++++++++++-------- extras/gaming.nix | 8 +++-- extras/uwuraid.nix | 46 ++++++++++++++++++---------- flake.lock | 18 +++++------ flake.nix | 7 ++++- systems/BASED.nix | 33 +++++++++++++++++--- systems/NOcomputer.nix | 43 +++++++++++++++++++++++--- systems/NOlaptop.nix | 28 ++++++++++++++--- users/tao.nix | 44 +++++++++++++++++++++------ 9 files changed, 232 insertions(+), 64 deletions(-) diff --git a/extras/dev.nix b/extras/dev.nix index 957a485..f49655a 100644 --- a/extras/dev.nix +++ b/extras/dev.nix @@ -1,23 +1,68 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ - elf2uf2-rs + # alsa-lib + # alsa-oss + # clang + # cmake + # libclang + # libopus + # opencv + # openssl + # pkg-config + # pkgconfig + # rustup + # udev + expat + fontconfig + freetype + freetype.dev + libGL + pkgconfig + xorg.libX11 + xorg.libXcursor + xorg.libXi + xorg.libXrandr + bacon + unstable.cargo + unstable.cargo-feature + unstable.cargo-rr + clang-tools + unstable.clippy + unstable.elf2uf2-rs + etcher gcc gdb lldb - rustup + unstable.rust-analyzer + unstable.rustfmt unstable.cargo-edit - bacon - cargo-feature - # cmake - # clang - # pkg-config - # udev - # libclang + unstable.rustc + unstable.sccache + vulkan-loader ]; - # environment.variables = { - # LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.libclang.lib ]; - # }; + nixpkgs.config.permittedInsecurePackages = [ + "electron-12.2.3" + ]; + + environment.variables = { + # LIBCLANG_PATH = pkgs.lib.makeLibraryPath [ pkgs.libclang.lib ]; + # LD_LIBRARY_PATH = + # builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" pkgs; + LD_LIBRARY_PATH = builtins.foldl' (a: b: "${a}:${b}/lib") "${pkgs.vulkan-loader}/lib" [ + pkgs.expat + pkgs.fontconfig + pkgs.freetype + pkgs.freetype.dev + pkgs.libGL + pkgs.pkgconfig + pkgs.xorg.libX11 + pkgs.xorg.libXcursor + pkgs.xorg.libXi + pkgs.xorg.libXrandr + pkgs.vulkan-loader + ]; + }; services.udev.extraRules = '' SUBSYSTEM == "tty", GROUP="dialout", ATTRS{interface}=="Black Magic GDB Server", SYMLINK+="ttyBmpGdb" diff --git a/extras/gaming.nix b/extras/gaming.nix index 9631a4e..1016739 100644 --- a/extras/gaming.nix +++ b/extras/gaming.nix @@ -1,9 +1,11 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ - lutris - mangohud - prismlauncher + unstable.lutris + unstable.mangohud + unstable.prismlauncher wine + unstable.heroic + # unstable.parsec-bin ]; programs.steam.enable = true; diff --git a/extras/uwuraid.nix b/extras/uwuraid.nix index cbfc3bb..dd91b4f 100644 --- a/extras/uwuraid.nix +++ b/extras/uwuraid.nix @@ -1,23 +1,37 @@ { ... }: { services.rpcbind.enable = true; - systemd.mounts = let commonMountOptions = { type = "nfs"; mountConfig = { Options = "noatime"; }; }; in + systemd.mounts = + let + opts = { + type = "cifs"; + mountConfig = { Options = "credentials=/etc/nixos/smb-secrets,noatime,uid=1000,gid=100"; }; + }; + in [ - (commonMountOptions // { what = "100.86.160.104:/mnt/user/anime"; where = "/mnt/uwuraid/anime"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/backup"; where = "/mnt/uwuraid/backup"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/everything"; where = "/mnt/uwuraid/everything"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/movies"; where = "/mnt/uwuraid/movies"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/photos"; where = "/mnt/uwuraid/photos"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/syncthing"; where = "/mnt/uwuraid/syncthing"; }) - (commonMountOptions // { what = "100.86.160.104:/mnt/user/television"; where = "/mnt/uwuraid/television"; }) + (opts // { what = "//100.86.160.104/anime"; where = "/mnt/uwuraid/anime"; }) + (opts // { what = "//100.86.160.104/backup"; where = "/mnt/uwuraid/backup"; }) + (opts // { what = "//100.86.160.104/everything"; where = "/mnt/uwuraid/everything"; }) + (opts // { what = "//100.86.160.104/movies"; where = "/mnt/uwuraid/movies"; }) + (opts // { what = "//100.86.160.104/music"; where = "/mnt/uwuraid/music"; }) + (opts // { what = "//100.86.160.104/photos"; where = "/mnt/uwuraid/photos"; }) + (opts // { what = "//100.86.160.104/syncthing"; where = "/mnt/uwuraid/syncthing"; }) + (opts // { what = "//100.86.160.104/television"; where = "/mnt/uwuraid/television"; }) ]; - systemd.automounts = let commonAutoMountOptions = { wantedBy = [ "multi-user.target" ]; automountConfig = { TimeoutIdleSec = "60"; }; }; in + systemd.automounts = + let + opts = { + wantedBy = [ "multi-user.target" ]; + automountConfig = { TimeoutIdleSec = "60"; }; + }; + in [ - (commonAutoMountOptions // { where = "/mnt/uwuraid/anime"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/backup"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/everything"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/movies"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/photos"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/syncthing"; }) - (commonAutoMountOptions // { where = "/mnt/uwuraid/television"; }) + (opts // { where = "/mnt/uwuraid/anime"; }) + (opts // { where = "/mnt/uwuraid/backup"; }) + (opts // { where = "/mnt/uwuraid/everything"; }) + (opts // { where = "/mnt/uwuraid/movies"; }) + (opts // { where = "/mnt/uwuraid/music"; }) + (opts // { where = "/mnt/uwuraid/photos"; }) + (opts // { where = "/mnt/uwuraid/syncthing"; }) + (opts // { where = "/mnt/uwuraid/television"; }) ]; } diff --git a/flake.lock b/flake.lock index 4ad7b61..192da82 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixos-hardware": { "locked": { - "lastModified": 1692373088, - "narHash": "sha256-EPgCecdc9I8aTdmDNoO1l7R72r2WPhZRcesV4nzxBj8=", + "lastModified": 1695541019, + "narHash": "sha256-rs++zfk41K9ArWkDAlmBDlGlKO8qeRIRzdjo+9SmNFI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "7f1836531b126cfcf584e7d7d71bf8758bb58969", + "rev": "61283b30d11f27d5b76439d43f20d0c0c8ff5296", "type": "github" }, "original": { @@ -16,11 +16,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1692339729, - "narHash": "sha256-TUK76/Pqm9qIDjEGd27Lz9EiBIvn5F70JWDmEQ4Y5DQ=", + "lastModified": 1695559356, + "narHash": "sha256-kXZ1pUoImD9OEbPCwpTz4tHsNTr4CIyIfXb3ocuR8sI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ae521bd4e460b076a455dca8b13f4151489a725c", + "rev": "261abe8a44a7e8392598d038d2e01f7b33cf26d0", "type": "github" }, "original": { @@ -31,11 +31,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1692356644, - "narHash": "sha256-AYkPFT+CbCVSBmh0WwIzPpwhEJ4Yy3A7JZvUkGJIg5o=", + "lastModified": 1695644571, + "narHash": "sha256-asS9dCCdlt1lPq0DLwkVBbVoEKuEuz+Zi3DG7pR/RxA=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "8ecc900b2f695d74dea35a92f8a9f9b32c8ea33d", + "rev": "6500b4580c2a1f3d0f980d32d285739d8e156d92", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 977b0b8..419abb7 100644 --- a/flake.nix +++ b/flake.nix @@ -11,7 +11,6 @@ let system = "x86_64-linux"; overlay-unstable = final: prev: { - # unstable = nixpkgs-unstable.legacyPackages.x86_64-linux; unstable = import nixpkgs-unstable { inherit system; config.allowUnfree = true; @@ -44,6 +43,12 @@ ./extras/dev.nix ./extras/gaming.nix ]; + NObangers = nixosSystem [ + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + ./systems/BASED.nix + ./systems/NObangers.nix + ./extras/uwuraid.nix + ]; }; diff --git a/systems/BASED.nix b/systems/BASED.nix index ccfd748..74661dd 100644 --- a/systems/BASED.nix +++ b/systems/BASED.nix @@ -1,14 +1,17 @@ { lib, pkgs, modulesPath, ... }: { environment.systemPackages = with pkgs; [ # exfatprogs + # rustup appimage-run bat bottom cifs-utils du-dust + ffmpeg firefox git helix + mesa mpv nfs-utils nil @@ -16,14 +19,17 @@ onlyoffice-bin ouch ripgrep-all - # rustup skim + snapper tree + unstable.yazi + unstable.joshuto + unstable.oculante wezterm wget - zstd yt-dlp - ffmpeg + zathura + zstd ]; programs.partition-manager.enable = true; @@ -31,6 +37,7 @@ services.openssh.enable = lib.mkDefault true; services.flatpak.enable = lib.mkDefault true; services.printing.enable = lib.mkDefault true; + services.btrfs.autoScrub.enable = true; environment.variables = { EDITOR = "hx"; @@ -57,7 +64,23 @@ boot.loader.timeout = 0; boot.supportedFilesystems = [ "ntfs" ]; - networking.networkmanager.enable = true; + networking.networkmanager = { + enable = true; + # dispatcherScripts = [{ + # source = pkgs.writeText "upHook" '' + # logger "event $2" + # if [ "$2" == "vpn-up" ]; then + # iptables -A OUTPUT -o tun0 -j ACCEPT + # iptables -A OUTPUT ! -o tun0 -j DROP + # fi + # if [ "$2" == "vpn-down" ]; then + # iptables -D OUTPUT -o tun0 -j ACCEPT + # iptables -D OUTPUT ! -o tun0 -j DROP + # fi + # ''; + # type = "basic"; + # }]; + }; networking.firewall.enable = false; services.xserver.enable = true; @@ -68,6 +91,7 @@ environment.plasma5.excludePackages = with pkgs.libsForQt5; [ elisa konsole + gwenview ]; services.pipewire = { @@ -89,6 +113,7 @@ time.timeZone = "US/Pacific"; i18n.defaultLocale = "en_US.UTF-8"; + i18n.supportedLocales = [ "all" ]; imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; diff --git a/systems/NOcomputer.nix b/systems/NOcomputer.nix index 104490d..c276ce6 100644 --- a/systems/NOcomputer.nix +++ b/systems/NOcomputer.nix @@ -1,5 +1,10 @@ -{ lib, pkgs, ... }: -{ +{ lib, pkgs, ... }: { + services.xserver.displayManager = { + autoLogin.enable = true; + autoLogin.user = "tao"; + }; + + environment.systemPackages = with pkgs; [ # mesa @@ -10,16 +15,23 @@ # nvidia-vaapi-driver ]; + environment.sessionVariables = { # wayland chromium workaround NIXOS_OZONE_WL = "1"; }; + fileSystems."/home" = { device = "/dev/disk/by-uuid/eb9fcce2-e9f3-438a-b5ce-8f72f32f0e09"; fsType = "btrfs"; options = [ "subvol=home_snaps/0/snapshot" "noatime" "compress-force=zstd:3" ]; }; + fileSystems."/home/.snapshots" = { + device = "/dev/disk/by-uuid/eb9fcce2-e9f3-438a-b5ce-8f72f32f0e09"; + fsType = "btrfs"; + options = [ "subvol=home_snaps/" "noatime" "compress-force=zstd:3" ]; + }; fileSystems."/home/tao/Games" = { device = "/dev/disk/by-uuid/eb9fcce2-e9f3-438a-b5ce-8f72f32f0e09"; fsType = "btrfs"; @@ -45,9 +57,23 @@ fsType = "btrfs"; options = [ "subvol=nixos/tmp" ]; }; - swapDevices = [{ device = "/dev/disk/by-uuid/ca0ed3d7-8758-4ac7-b016-8b4cd9608ded"; }]; + + services.snapper.configs = + { + home = { + SUBVOLUME = "/home"; + ALLOW_USERS = [ "tao" ]; + TIMELINE_CREATE = true; + TIMELINE_CLEANUP = true; + TIMELINE_LIMIT_HOURLY = "5"; + TIMELINE_LIMIT_DAILY = "7"; + }; + }; + services.snapper.snapshotInterval = "*:0/5"; + + # systemd.user.services.fans = { # description = "NZXT fans to 69% using liquidctl"; # script = '' @@ -56,10 +82,13 @@ # wantedBy = [ "default.target" ]; # }; - boot.kernelPackages = pkgs.linuxPackages_latest; + + # boot.kernelPackages = pkgs.linuxPackages_latest; + boot.kernelPackages = pkgs.unstable.linuxPackages_latest; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.kernelModules = [ "i2c-dev" "kvm-amd" ]; + hardware.opengl = { enable = true; driSupport = true; @@ -67,8 +96,9 @@ }; hardware.nvidia = { modesetting.enable = true; + powerManagement.enable = true; # package = config.boot.kernelPackages.nvidiaPackages.beta; - # package = pkgs.unstable.linuxPackages_latest.nvidiaPackages.production; + package = pkgs.unstable.linuxPackages_latest.nvidiaPackages.production; }; # enable core and mem freq sliders for nvidia services.xserver.deviceSection = '' @@ -80,10 +110,13 @@ wantedBy = [ "multi-user.target" ]; }; + services.udev.packages = [ pkgs.openrgb ]; services.udev.extraRules = '' KERNEL=="hidraw*", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="a3c5", MODE="0666" ''; + + time.hardwareClockInLocalTime = true; networking.hostName = "NOcomputer"; } diff --git a/systems/NOlaptop.nix b/systems/NOlaptop.nix index 37d571f..bfb83c6 100644 --- a/systems/NOlaptop.nix +++ b/systems/NOlaptop.nix @@ -1,6 +1,8 @@ { pkgs, ... }: { environment.systemPackages = with pkgs; [ intel-gpu-tools + # libsForQt5.skanpage + powertop ]; fileSystems."/home" = { @@ -26,10 +28,10 @@ powerManagement.powertop.enable = true; hardware.sensor.iio.enable = true; - hardware.sane = { - enable = true; - extraBackends = [ pkgs.epkowa ]; - }; + # hardware.sane = { + # enable = true; + # extraBackends = [ pkgs.epkowa ]; + # }; boot.initrd.availableKernelModules = [ "nvme" @@ -41,10 +43,28 @@ boot.kernelParams = [ "mem_sleep_default=deep" "nvme.noacpi=1" + "i915.eanble_psr=1" ]; boot.kernelModules = [ "kvm-intel" ]; powerManagement.cpuFreqGovernor = "powersave"; systemd.sleep.extraConfig = "HibernateDelaySec=60m"; + services.pipewire.wireplumber.enable = true; + environment.etc = { + "wireplumber/main.lua.d/51-fix-static.lua".text = '' + rule = { + matches = { + { + { "node.name", "equals", "alsa_output.pci-0000_00_1f.3.analog-stereo.3" }, + }, + }, + apply_properties = { + [ "audio.format" ] = "S24LE" , + }, + } + table.insert(alsa_monitor.rules, rule) + ''; + }; + networking.hostName = "NOlaptop"; } diff --git a/users/tao.nix b/users/tao.nix index 6869cf2..7564a74 100644 --- a/users/tao.nix +++ b/users/tao.nix @@ -1,30 +1,48 @@ { pkgs, ... }: { users.users.tao.packages = with pkgs; [ + # expressvpn + # fractal + # gnumake + # libftdi + # libusb + # nix-prefetch-scripts + # pkg-config + aspell + aspellDicts.en + # enchant + # nuspell + # hunspellDicts.en-us-large + rustdesk bottles + cider darktable deluge discord - # expressvpn - # fractal gh - # gnumake - # pkg-config - # libftdi - # libusb keepassxc + libsForQt5.kcharselect libsForQt5.kdeconnect-kde - # nix-prefetch-scripts - unstable.starship - rustdesk - tio + mdbook partition-manager + slack + tectonic + texlab + tio + unstable.typst + ocs-url + typst-lsp unstable.nushell unstable.prusa-slicer + unstable.starship unstable.wezterm virt-manager + zoom-us zoxide + obs-studio ]; + # programs.nushell.enable = true; + environment.shells = with pkgs; [ unstable.nushell ]; # services.expressvpn.enable = true; @@ -47,5 +65,11 @@ users.users.tao = { isNormalUser = true; extraGroups = [ "wheel" "libvirtd" "dialout" "scanner" "lp" ]; + shell = pkgs.unstable.nushell; }; + + # i18n.inputMethod = { + # enabled = "fcitx5"; + # fcitx5.addons = with pkgs; [ fcitx5-mozc fcitx5-chewing fcitx5-chinese-addons fcitx5-rime ]; + # }; }