From a58f8530b7fc42acd2cef7d0c8bdfd92d745d35c Mon Sep 17 00:00:00 2001 From: Tao Tien <29749622+taotien@users.noreply.github.com> Date: Tue, 11 Jul 2023 00:38:39 -0700 Subject: [PATCH] bugfix --- flake.lock | 14 ++++---- flake.nix | 12 +++++-- gaming.nix | 29 +++++++++++++++++ systems/BASED.nix | 73 ++++++++++++++++++++++++++++++++++++++++++ systems/NOcomputer.nix | 28 ++++++++++++++++ systems/NOlaptop.nix | 6 ++++ users/tao.nix | 45 ++++++++++++++++++++++++++ uwuraid.nix | 21 ++++++++++++ 8 files changed, 219 insertions(+), 9 deletions(-) create mode 100644 gaming.nix create mode 100644 systems/BASED.nix create mode 100644 systems/NOcomputer.nix create mode 100644 systems/NOlaptop.nix create mode 100644 users/tao.nix create mode 100644 uwuraid.nix diff --git a/flake.lock b/flake.lock index 70a6a6d..7888ea4 100644 --- a/flake.lock +++ b/flake.lock @@ -17,16 +17,18 @@ }, "nixpkgs": { "locked": { - "lastModified": 1688981480, - "narHash": "sha256-AYgIAotBA5C+55PjXKck8cpDgWYrUYsTMpMxH1bZ7/M=", - "owner": "NixOS", + "lastModified": 1688939073, + "narHash": "sha256-jYhYjeK5s6k8QS3i+ovq9VZqBJaWbxm7awTKNhHL9d0=", + "owner": "Nixos", "repo": "nixpkgs", - "rev": "b9ebd80c7dbcdec2240c5baae334365eaf3d7230", + "rev": "8df7a67abaf8aefc8a2839e0b48f92fdcf69a38b", "type": "github" }, "original": { - "id": "nixpkgs", - "type": "indirect" + "owner": "Nixos", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" } }, "root": { diff --git a/flake.nix b/flake.nix index 79b7adf..057cc93 100644 --- a/flake.nix +++ b/flake.nix @@ -2,17 +2,22 @@ description = "we say NO to shitty OSes"; inputs = { + nixpkgs.url = "github:Nixos/nixpkgs/nixos-23.05"; nixos-hardware.url = "github:NixOS/nixos-hardware"; }; - outputs = { pkgs, ... }@inputs: + outputs = { nixpkgs, ... }@inputs: let + # pkgs = import nixpkgs { + # config.allowUnfree = true; + # }; + nixosSystem = (systemModules: inputs.nixpkgs.lib.nixosSystem { modules = systemModules; }); base = ./systems/BASED.nix; nixos-hw = inputs.nixos-hardware.nixosModules; in { nixosConfigurations = { - NOcomputer = pkgs.lib.nixosSystem [ + NOcomputer = nixosSystem [ base nixos-hw.common-cpu-amd nixos-hw.common-gpu-nvidia @@ -21,7 +26,7 @@ ./gaming.nix ./users/tao.nix ]; - NOlaptop = pkgs.lib.nixosSystem [ + NOlaptop = nixosSystem [ # inputs.nixos-hardware.nixosModules.framework base ./systems/NOlaptop.nix @@ -31,5 +36,6 @@ ]; }; + }; } diff --git a/gaming.nix b/gaming.nix new file mode 100644 index 0000000..57d58b1 --- /dev/null +++ b/gaming.nix @@ -0,0 +1,29 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + lutris + mangohud + prismlauncher + wine + ]; + + programs.gamemode.enable = true; + programs.steam.enable = true; + + security.rtkit.enable = true; + environment.etc = + let + json = pkgs.formats.json { }; + in + { + "pipewire/pipewire.d/92-low-latency.conf".source = json.generate "92-low-latency.conf" { + context.properties = { + # default.clock.rate = 48000; + # default.allowed-rates = [] + default.clock.quantum = 32; + default.clock.min-quantum = 32; + default.clock.max-quantum = 32; + }; + }; + }; + +} diff --git a/systems/BASED.nix b/systems/BASED.nix new file mode 100644 index 0000000..1971692 --- /dev/null +++ b/systems/BASED.nix @@ -0,0 +1,73 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + appimage-run + bat + bottom + cifs-utils + du-dust + firefox + git + helix + mpv + nfs-utils + nil + nixpkgs-fmt + onlyoffice-bin + ouch + ripgrep-all + rustup + skim + tree + wezterm + wget + zstd + ]; + + services.tailscale.enable = true; + services.openssh.enable = true; + services.flatpak.enable = true; + services.printing.enable = true; + + environment.variables = { + EDITOR = "hx"; + VISUAL = "hx"; + }; + + imports = [ ./hardware-configuration.nix ]; + hardware.enableAllFirmware = true; + hardware.bluetooth.enable = true; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.networkmanager.enable = true; + networking.firewall.enable = false; + + services.xserver.enable = true; + services.xserver.displayManager.sddm.enable = true; + services.xserver.desktopManager.plasma5.enable = true; + services.xserver.layout = "us"; + systemd.services.display-manager.restartIfChanged = false; + environment.plasma5.excludePackages = with pkgs.libsForQt5; [ + elisa + konsole + ]; + + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + }; + + nix.settings = { + experimental-features = "nix-command flakes"; + auto-optimise-store = true; + }; + nixpkgs.config = { allowUnfree = true; }; + + time.timeZone = "US/Pacific"; + i18n.defaultLocale = "en_US.UTF-8"; + + system.stateVersion = "23.05"; +} diff --git a/systems/NOcomputer.nix b/systems/NOcomputer.nix new file mode 100644 index 0000000..72a0cea --- /dev/null +++ b/systems/NOcomputer.nix @@ -0,0 +1,28 @@ +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + openrgb + gwe + ]; + + fileSystems."/" = { options = [ "noatime" "compress-force=zstd:3" ]; }; + fileSystems."/var" = { options = [ "noatime" "compress-force=zstd:3" ]; }; + fileSystems."/tmp" = { options = [ "noatime" ]; }; + fileSystems."/home" = { options = [ "noatime" "compress-force=zstd:3" ]; }; + fileSystems."/home/tao/Games" = { options = [ "nosuid" "nodev" "noatime" "compress-force=zstd:3" "users" "rw" "exec" ]; }; + + services.udev.packages = [ pkgs.openrgb ]; + services.udev.extraRules = '' + SUBSYSTEM=="tty", GROUP="dialout", ATTRS{interface}=="Black Magic GDB Server", SYMLINK+="ttyBmpGdb" + SUBSYSTEM=="tty", GROUP="dialout", ATTRS{interface}=="Black Magic UART Port", SYMLINK+="ttyBmpTarg" + ''; + + boot.kernelModules = [ "i2c-dev" ]; + + fonts.fonts = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + noto-fonts-cjk + noto-fonts-emoji + ]; + + networking.hostname = "NOcomputer"; +} diff --git a/systems/NOlaptop.nix b/systems/NOlaptop.nix new file mode 100644 index 0000000..e8ed9c2 --- /dev/null +++ b/systems/NOlaptop.nix @@ -0,0 +1,6 @@ +{ ... }: { + boot.kernelParams = [ + "mem_sleep_default=deep" + "nvme.noacpi=1" + ]; +} diff --git a/users/tao.nix b/users/tao.nix new file mode 100644 index 0000000..3044706 --- /dev/null +++ b/users/tao.nix @@ -0,0 +1,45 @@ +{ pkgs, config, ... }: +let + unstableTarball = fetchTarball "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"; +in +{ + users.users.tao.packages = with pkgs; [ + deluge + discord + elf2uf2-rs + # fractal + gcc + gdb + keepassxc + libsForQt5.kdeconnect-kde + lldb + nix-prefetch-scripts + openrgb + starship + tio + unstable.nushell + unstable.prusa-slicer + virt-manager + zoxide + ]; + + services.syncthing = { + enable = true; + user = "tao"; + dataDir = "/home/tao/Sync"; + configDir = "/home/tao/.config/syncthing"; + }; + + nixpkgs.config = { + packageOverrides = pkgs: { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + + users.users.tao = { + isNormalUser = true; + extraGroups = [ "wheel" "libvirtd" "dialout" ]; + }; +} diff --git a/uwuraid.nix b/uwuraid.nix new file mode 100644 index 0000000..1cd3f38 --- /dev/null +++ b/uwuraid.nix @@ -0,0 +1,21 @@ +{ ... }: { + services.rpcbind.enable = true; + systemd.mounts = let commonMountOptions = { type = "nfs"; mountConfig = { Options = "noatime"; }; }; in + [ + (commonMountOptions // { what = "192.168.86.56:/mnt/user/anime"; where = "/mnt/uwuraid/anime"; }) + (commonMountOptions // { what = "192.168.86.56:/mnt/user/backup"; where = "/mnt/uwuraid/backup"; }) + (commonMountOptions // { what = "192.168.86.56:/mnt/user/syncthing"; where = "/mnt/uwuraid/syncthing"; }) + (commonMountOptions // { what = "192.168.86.56:/mnt/user/television"; where = "/mnt/uwuraid/television"; }) + (commonMountOptions // { what = "192.168.86.56:/mnt/user/photos"; where = "/mnt/uwuraid/photos"; }) + (commonMountOptions // { what = "192.168.86.56:/mnt/user/movies"; where = "/mnt/uwuraid/movies"; }) + ]; + systemd.automounts = let commonAutoMountOptions = { wantedBy = [ "multi-user.target" ]; automountConfig = { TimeoutIdleSec = "60"; }; }; in + [ + (commonAutoMountOptions // { where = "/mnt/uwuraid/anime"; }) + (commonAutoMountOptions // { where = "/mnt/uwuraid/backup"; }) + (commonAutoMountOptions // { where = "/mnt/uwuraid/syncthing"; }) + (commonAutoMountOptions // { where = "/mnt/uwuraid/television"; }) + (commonAutoMountOptions // { where = "/mnt/uwuraid/photos"; }) + (commonAutoMountOptions // { where = "/mnt/uwuraid/movies"; }) + ]; +}