diff --git a/.gitignore b/.gitignore index ef6c6c3..749e984 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ .env.nix -hardware-configuration.nix diff --git a/blueplum.nix b/blueplum.nix index 4cef910..0ade1cd 100644 --- a/blueplum.nix +++ b/blueplum.nix @@ -1,91 +1,104 @@ -{ - config, - pkgs, - lib ? pkgs.lib, - ... -}: - let concat = strings: builtins.concatStringsSep " " strings; - wacom.src = + + displays = let - xsetwacom = "${pkgs.xf86_input_wacom}/bin/xsetwacom"; - awk = lib.getExe pkgs.gawk; + primary = "DP-2"; + secondary = "HDMI-0"; + in - '' - #!/bin/sh - - # Wait for X socket - for i in $(seq 30); do - [ -S /tmp/.X11-unix/X0 ] && break - sleep 0.5 - done - - # Just to be sure that the displays are ready... - sleep 5 - - export DISPLAY=:0 - export XAUTHORITY="$HOME/.Xauthority" - - for i in $(seq 10); do - if ${xsetwacom} list devices | grep -q Wacom; then - break - fi - sleep 1 - done - - stylus=$(${xsetwacom} list devices | ${awk} -F' \t' '/stylus/{print $1}') - - if [ -z "$${stylus}" ]; then - exit 0 - fi - - ${xsetwacom} set "$stylus" MapToOutput HEAD-0 - ''; + { + inherit primary secondary; + xrandr = concat [ + "--output ${primary}" + "--mode 1920x1080" + "--pos 0x0" + "--rate 144" + "--primary" + "" + "--output ${secondary}" + "--mode 1920x1080" + "--pos 1920x0" + "--rate 144" + ]; + }; in { - services.xserver.videoDrivers = [ "nvidia" ]; - services.xserver.wacom.enable = true; + inherit displays; - hardware.nvidia = { - modesetting.enable = true; + nixosModule = + { + pkgs, + config, + lib ? pkgs.lib, + ... + }: + let + wacom.src = + let + xsetwacom = "${pkgs.xf86_input_wacom}/bin/xsetwacom"; + awk = lib.getExe pkgs.gawk; + in + '' + #!/bin/sh - open = true; + # Wait for X socket + for i in $(seq 30); do + [ -S /tmp/.X11-unix/X0 ] && break + sleep 0.5 + done - nvidiaSettings = true; + # Just to be sure that the displays are ready... + sleep 5 - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; + export DISPLAY=:0 + export XAUTHORITY="$HOME/.Xauthority" - home-manager.users.anton.xsession.profileExtra = concat [ - "${lib.getExe pkgs.xrandr}" - "${concat [ - "--output DP-2" - "--mode 1920x1080" - "--pos 0x0" - "--rate 144" - "--primary" - ]}" - "${concat [ - "--output HDMI-0" - "--mode 1920x1080" - "--pos 1920x0" - "--rate 144" - ]}" - ]; + for i in $(seq 10); do + if ${xsetwacom} list devices | grep -q Wacom; then + break + fi + sleep 1 + done - systemd.user.services.wacom = { - enable = true; - description = "Configure my Wacom (One) tablet"; - wantedBy = [ "default.target" ]; - after = [ "graphical-session.target" ]; - serviceConfig = { - Type = "oneshot"; - ExecStart = pkgs.writeShellScript "wacom.sh" wacom.src; + stylus=$(${xsetwacom} list devices | ${awk} -F' \t' '/stylus/{print $1}') + + if [ -z "$${stylus}" ]; then + exit 0 + fi + + ${xsetwacom} set "$stylus" MapToOutput HEAD-0 + ''; + + in + { + + services.xserver.videoDrivers = [ "nvidia" ]; + services.xserver.wacom.enable = true; + + hardware.nvidia = { + modesetting.enable = true; + + open = true; + + nvidiaSettings = true; + + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; + + systemd.user.services.wacom = { + enable = true; + description = "Configure my Wacom (One) tablet"; + wantedBy = [ "default.target" ]; + after = [ "graphical-session.target" ]; + serviceConfig = { + Type = "oneshot"; + ExecStart = pkgs.writeShellScript "wacom.sh" wacom.src; + }; + }; + + services.udev.extraRules = '' + ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="056a", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="wacom.service" + ''; }; - }; - - services.udev.extraRules = '' - ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="056a", TAG+="systemd", ENV{SYSTEMD_USER_WANTS}+="wacom.service" - ''; } diff --git a/configuration.nix b/configuration.nix index 546c5c8..6aadfab 100644 --- a/configuration.nix +++ b/configuration.nix @@ -2,31 +2,20 @@ config, pkgs, lib, + hostname, + env, ... + }: -let - stateVersion = "25.05"; - env = import ./.env.nix { inherit pkgs; }; - - mpkgs = import ./pkgs/default.nix { - config = { - system.stateVersion = stateVersion; - }; - }; -in { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - (import (./. + "/${env.hostname}.nix")) - mpkgs.home-manager.module - ]; + imports = [ ./hardware-configuration.nix ] ++ lib.optional (env ? nixosModule) env.nixosModule; - nixpkgs.config.allowUnfree = true; - nixpkgs.overlays = [ - (import "${fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz"}/overlay.nix") + nix.settings.experimental-features = [ + "nix-command" + "flakes" ]; + nixpkgs.config.allowUnfree = true; environment.systemPackages = with pkgs; [ chromium @@ -43,17 +32,10 @@ in fzf ripgrep - (fenix.stable.withComponents [ - "rustc" - "cargo" - "clippy" - "rust-src" - "rustfmt" - "rust-analyzer" - ]) + # perhaps set up lsps through dev shells someday? nodejs_latest - prettierd typescript-language-server + prettierd pnpm nixd nixfmt @@ -70,8 +52,8 @@ in jetbrains-mono nerd-fonts.symbols-only inter - times-newer-roman - (mpkgs.font.monaco) + nimbus-roman + monaco ]; fonts.fontconfig = { @@ -87,7 +69,7 @@ in "Inter" "Noto Sans" ]; - serif = [ "Times Newer Roman" ]; + serif = [ "Nimbus Roman" ]; }; }; @@ -97,16 +79,13 @@ in windowManager.i3 = { enable = true; - extraPackages = with pkgs; [ rofi i3status ]; }; - displayManager.startx.enable = true; - # Configure keymap in X11 xkb = { layout = "us"; variant = ""; @@ -118,16 +97,14 @@ in greetd = { enable = true; restart = false; - settings = { - default_session = { - command = lib.concatStringsSep " " [ - "${lib.getExe pkgs.tuigreet}" - "--remember" - "--asterisks" - "--time" - ]; - user = "greeter"; - }; + settings.default_session = { + command = lib.concatStringsSep " " [ + "${lib.getExe pkgs.tuigreet}" + "--remember" + "--asterisks" + "--time" + ]; + user = "greeter"; }; }; }; @@ -136,10 +113,10 @@ in programs.fish.enable = true; programs.bash.interactiveShellInit = '' - if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] then - shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" - exec ${pkgs.fish}/bin/fish $LOGIN_OPTION - fi + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi ''; # Define a user account. Don't forget to set a password with ‘passwd’. @@ -153,14 +130,6 @@ in ]; }; - home-manager = { - useUserPackages = true; - useGlobalPkgs = true; - sharedModules = [ ] ++ (mpkgs.home-manager.sharedModules); - users.anton = import ./home.nix; - }; - - # programs.home-manager.enable = true; programs.dconf.enable = true; qt = { enable = true; @@ -168,26 +137,25 @@ in style = "adwaita-dark"; }; - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver - intel-vaapi-driver - libvdpau-va-gl - mesa - ]; - }; + hardware = { + graphics = { + enable = true; + extraPackages = with pkgs.unstable; [ + intel-media-driver + intel-vaapi-driver + libvdpau-va-gl + (pkgs.mesa) + ]; + }; + bluetooth = { + enable = true; + powerOnBoot = true; - hardware.bluetooth = { - enable = true; - powerOnBoot = true; - - settings = { - General = { + settings.General = { Experimental = true; FastConnectable = true; }; - Policy.AutoEnable = true; + settings.Policy.AutoEnable = true; }; }; @@ -198,26 +166,27 @@ in services.gnome.gnome-keyring.enable = true; - # Bootloader. - boot.loader.systemd-boot = { - enable = true; - configurationLimit = 10; + boot = { + loader.systemd-boot = { + enable = true; + configurationLimit = 10; + }; + loader.efi.canTouchEfiVariables = true; + + kernelParams = [ "console=tty1" ]; + kernelPackages = pkgs.unstable.linuxPackages_latest; }; - boot.loader.efi.canTouchEfiVariables = true; - boot.kernelParams = [ "console=tty1" ]; + networking = { + hostName = hostname; - boot.kernelPackages = pkgs.linuxPackages_latest; - - networking.hostName = env.hostname; - networking.firewall.enable = false; - - networking.networkmanager.enable = true; + firewall.enable = false; + networkmanager.enable = true; + }; time.timeZone = "Europe/Stockholm"; i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { LC_ADDRESS = "sv_SE.UTF-8"; LC_IDENTIFICATION = "sv_SE.UTF-8"; @@ -230,13 +199,11 @@ in LC_TIME = "sv_SE.UTF-8"; }; - nix.settings.extra-experimental-features = [ "nix-command" ]; - # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = stateVersion; # Did you read the comment? + system.stateVersion = "25.05"; # Did you read the comment? } diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..e1c032a --- /dev/null +++ b/flake.lock @@ -0,0 +1,118 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772985280, + "narHash": "sha256-FdrNykOoY9VStevU4zjSUdvsL9SzJTcXt4omdEDZDLk=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8f736f007139d7f70752657dff6a401a585d6cbc", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-25.11", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1772822230, + "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-25.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1772963539, + "narHash": "sha256-9jVDGZnvCckTGdYT53d/EfznygLskyLQXYwJLKMPsZs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9dcb002ca1690658be4a04645215baea8b95f31d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "overlay": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "path": "./pkgs", + "type": "path" + }, + "original": { + "path": "./pkgs", + "type": "path" + }, + "parent": [] + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "overlay": "overlay", + "sops-nix": "sops-nix" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1773096132, + "narHash": "sha256-M3zEnq9OElB7zqc+mjgPlByPm1O5t2fbUrH3t/Hm5Ag=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "d1ff3b1034d5bab5d7d8086a7803c5a5968cd784", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..03d6d87 --- /dev/null +++ b/flake.nix @@ -0,0 +1,70 @@ +{ + description = "System configuration"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; + nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager.url = "github:nix-community/home-manager/release-25.11"; + home-manager.inputs.nixpkgs.follows = "nixpkgs"; + + sops-nix.url = "github:Mic92/sops-nix"; + sops-nix.inputs.nixpkgs.follows = "nixpkgs"; + + overlay.url = "path:./pkgs"; + }; + outputs = + { + self, + nixpkgs, + nixpkgs-unstable, + home-manager, + sops-nix, + overlay, + }@inputs: + let + systems = [ + "aarch64-linux" + "i686-linux" + "x86_64-linux" + "aarch64-darwin" + "x86_64-darwin" + + ]; + forAllSystems = nixpkgs.lib.genAttrs systems; + hostname = "blueplum"; + env = import ./${hostname}.nix; + in + { + formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt); + + nixosConfigurations.blueplum = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs hostname env; }; + modules = [ + { + nixpkgs.overlays = [ + overlay.overlays.default + (final: prev: { + unstable = import nixpkgs-unstable { + inherit (final) config; + inherit (final.stdenv.hostPlatform) system; + }; + }) + ]; + } + ./configuration.nix + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.anton = import ./home.nix; + sharedModules = import ./modules; + extraSpecialArgs = { inherit hostname env; }; + }; + } + sops-nix.nixosModules.sops + ]; + }; + + }; +} diff --git a/hardware-configuration.nix b/hardware-configuration.nix new file mode 100644 index 0000000..a1a9b2e --- /dev/null +++ b/hardware-configuration.nix @@ -0,0 +1,43 @@ +# 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 = [ "xhci_pci" "ahci" "nvme" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/2a269992-8aaa-4600-99b7-9020e8cd8cfc"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/D622-8FDF"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/home/anton/mnt/sda" = + { device = "/dev/disk/by-uuid/735e9ebf-71f7-49ce-a2d7-5e62a8820f2a"; + fsType = "ext4"; + }; + + 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.eno1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/home.nix b/home.nix index d261a06..ec67fed 100644 --- a/home.nix +++ b/home.nix @@ -1,19 +1,21 @@ { pkgs, - lib ? pkgs.lib, + lib, + env, ... }: let - mpkgs = import ./pkgs/default.nix { }; - inherit (mpkgs.config) neovim fish; - - env = import ./.env.nix { inherit pkgs; }; - + # env = import ./.env.nix { inherit pkgs; }; home = /home/anton; in { - imports = [ ]; + imports = [ + ./home/vesktop.nix + ./home/kitty.nix + ./home/i3.nix + ] + ++ lib.optional (env ? homeManager) env.homeManager; home.username = lib.mkDefault "anton"; home.homeDirectory = lib.mkDefault home; @@ -27,7 +29,6 @@ in vscode godotPackages_4_5.godot - neovim btop xclip tree @@ -36,9 +37,6 @@ in hyperfine bat - typst - tinymist - # required by spotify ffmpeg_4 ]; @@ -51,36 +49,42 @@ in package = pkgs.posy-cursors; }; - xsession = { - enable = true; - windowManager.i3 = import ./home/i3.nix { inherit pkgs; }; - }; - programs.btop.enable = true; programs.fastfetch.enable = true; - programs.kitty = import ./home/kitty.nix { inherit pkgs; }; - - programs.fish = { + programs.direnv = { enable = true; - shellInit = '' - set fish_function_path $fish_function_path ${fish}/functions - ''; - interactiveShellInit = '' - source ${fish}/config.fish - ''; + nix-direnv.enable = true; }; + programs.fish = + let + config = pkgs.configs.fish; + in + { + enable = true; + shellInit = '' + set fish_function_path $fish_function_path ${config}/functions + ''; + interactiveShellInit = '' + source ${config}/config.fish + ''; + }; + # Fix Fish command not found issues programs.command-not-found.enable = false; programs.neovim = { enable = true; defaultEditor = true; - extraConfig = '' - set runtimepath+=${neovim} - source ${neovim}/init.lua - ''; + extraConfig = + let + config = pkgs.configs.neovim; + in + '' + set runtimepath+=${config} + source ${config}/init.lua + ''; }; programs.rofi = { @@ -92,14 +96,14 @@ in programs.git = { enable = true; - signing = - if (env.git or { }) ? signingKey then - { - key = env.git.signingKey; - signByDefault = true; - } - else - { signByDefault = false; }; + # signing = + # if (env.git or { }) ? signingKey then + # { + # key = env.git.signingKey; + # signByDefault = true; + # } + # else + # { signByDefault = false; }; settings = { user.name = "Anton"; @@ -135,12 +139,12 @@ in programs.tetrio-desktop = { enable = true; - package = mpkgs.tetrio.desktop; + package = pkgs.tetrio.desktop; plus = { enable = true; - package = mpkgs.tetrio.plus; - skin.package = mpkgs.tetrio.skins.simple-connected; + package = pkgs.tetrio.plus; + skin.package = pkgs.tetrio.skins.simple-connected; }; settings = { @@ -193,7 +197,7 @@ in }; }; - programs.vesktop = import ./home/vesktop.nix; + # programs.vesktop = pkgs.callPackage { }; services.gpg-agent = { enable = true; @@ -217,5 +221,5 @@ in NIXPKGS_ALLOW_UNFREE = 1; }; - home.stateVersion = mpkgs.system.stateVersion; + home.stateVersion = "25.11"; } diff --git a/home/i3.nix b/home/i3.nix index f714d2c..ffe73ef 100644 --- a/home/i3.nix +++ b/home/i3.nix @@ -1,106 +1,101 @@ { pkgs, - lib ? pkgs.lib, + lib, + env, ... }: let mod = "Mod4"; - - wallpaper = pkgs.callPackage ../pkgs/wallpaper/default.nix { }; - - env = import /etc/nixos/.env.nix { inherit pkgs; }; + displays = if env ? displays then env.displays else null; in { - enable = true; + xsession.windowManager.i3 = { + enable = true; - config = { - modifier = mod; + config = { + modifier = mod; - fonts = { - names = [ "Monaco" ]; - size = 8.0; - }; + fonts = { + names = [ "Monaco" ]; + size = 8.0; + }; - keybindings = lib.mkOptionDefault { - "${mod}+q" = "kill"; - "${mod}+n" = "exec \"${ - lib.concatStringsSep " " [ - "${lib.getExe pkgs.rofi}" - "-show combi" - "-modes combi" - "-combi-modes drun,run" - "-combi-display-format {text}" - ] - }\""; - "${mod}+Return" = "exec ${lib.getExe pkgs.kitty}"; - - "${mod}+Left" = "focus left"; - "${mod}+Right" = "focus right"; - "${mod}+Up" = "focus up"; - "${mod}+Down" = "focus down"; - - "${mod}+Shift+Left" = "move left"; - "${mod}+Shift+Right" = "move right"; - "${mod}+Shift+Up" = "move up"; - "${mod}+Shift+Down" = "move down"; - - "${mod}+Ctrl+Left" = "move workspace to output left"; - "${mod}+Ctrl+Right" = "move workspace to output right"; - - "Print" = "exec ${lib.getExe pkgs.flameshot} gui"; - }; - }; - - extraConfig = - let - background = lib.concatStringsSep " " [ - "exec --no-startup-id" - (lib.concatStringsSep " " [ - (lib.getExe pkgs.xwinwrap) - "-g 3820x1080" - "-s" - "-b" - "-ni" - "-sp" - "-ov" - "-nf" - ]) - "--" - (lib.concatStringsSep " " [ - (lib.getExe pkgs.mpv) - "${wallpaper}/wallpaper.mov" - "-wid WID" - "--loop" - "--no-audio" - "--no-osc" - "--no-input-default-bindings" - "--no-input-cursor" - "--gpu-api=vulkan" - "--vo=gpu-next" - "--framedrop=vo" - "--profile=low-latency" - "--hwdec=auto" - ]) - ]; - displays = - if (env ? displays) then - lib.concatStringsSep "\n" [ - "workspace 1 output ${env.displays.primary}" - (if (env.displays ? secondary) then "workspace 2 output ${env.displays.secondary}" else "") - "exec i3-msg focus output ${env.displays.primary}" - ( - if (env.displays ? xrandr) then - "exec \"${lib.getExe pkgs.xrandr} ${env.displays.xrandr}\"" - else - "" - ) + keybindings = lib.mkOptionDefault { + "${mod}+q" = "kill"; + "${mod}+n" = "exec \"${ + lib.concatStringsSep " " [ + "${lib.getExe pkgs.rofi}" + "-show combi" + "-modes combi" + "-combi-modes drun,run" + "-combi-display-format {text}" ] - else - ""; - in - lib.concatStringsSep "\n" [ - background - displays - ]; + }\""; + "${mod}+Return" = "exec ${lib.getExe pkgs.kitty}"; + + "${mod}+Left" = "focus left"; + "${mod}+Right" = "focus right"; + "${mod}+Up" = "focus up"; + "${mod}+Down" = "focus down"; + + "${mod}+Shift+Left" = "move left"; + "${mod}+Shift+Right" = "move right"; + "${mod}+Shift+Up" = "move up"; + "${mod}+Shift+Down" = "move down"; + + "${mod}+Ctrl+Left" = "move workspace to output left"; + "${mod}+Ctrl+Right" = "move workspace to output right"; + + "Print" = "exec ${lib.getExe pkgs.flameshot} gui"; + }; + }; + + extraConfig = + let + background = lib.concatStringsSep " " [ + "exec --no-startup-id" + (lib.concatStringsSep " " [ + (lib.getExe pkgs.xwinwrap) + "-g 3820x1080" + "-s" + "-b" + "-ni" + "-sp" + "-ov" + "-nf" + ]) + "--" + (lib.concatStringsSep " " [ + (lib.getExe pkgs.mpv) + "${pkgs.wallpaper}/wallpaper.mov" + "-wid WID" + "--loop" + "--no-audio" + "--no-osc" + "--no-input-default-bindings" + "--no-input-cursor" + "--gpu-api=vulkan" + "--vo=gpu-next" + "--framedrop=vo" + "--profile=low-latency" + "--hwdec=auto" + ]) + ]; + displayConf = + if displays != null then + lib.concatStringsSep "\n" [ + "workspace 1 output ${displays.primary}" + (if (displays ? secondary) then "workspace 2 output ${displays.secondary}" else "") + "exec i3-msg focus output ${displays.primary}" + (if (displays ? xrandr) then "exec \"${lib.getExe pkgs.xrandr} ${displays.xrandr}\"" else "") + ] + else + ""; + in + lib.concatStringsSep "\n" [ + background + displayConf + ]; + }; } diff --git a/home/kitty.nix b/home/kitty.nix index 55af03b..ed2f758 100644 --- a/home/kitty.nix +++ b/home/kitty.nix @@ -1,49 +1,59 @@ -{ pkgs, ... }: - { - enable = true; - font = { - package = pkgs.jetbrains-mono; - name = "JetBrains Mono"; - size = 13; + pkgs, + lib, + ... +}: + +let + makeTheme = + attrs: builtins.concatStringsSep "\n" (lib.mapAttrsToList (k: v: "${k} ${toString v}") attrs); +in +{ + programs.kitty = { + enable = true; + font = { + package = pkgs.jetbrains-mono; + name = "JetBrains Mono"; + size = 13; + }; + extraConfig = makeTheme { + foreground = "#f2f4f8"; + background = "#161616"; + selection_foreground = "#f2f4f8"; + selection_background = "#2a2a2a"; + + cursor = "#f2f4f8"; + cursor_text_color = "#161616"; + + url_color = "#25be6a"; + + active_border_color = "#78a9ff"; + inactive_border_color = "#535353"; + bell_border_color = "#3ddbd9"; + + active_tab_foreground = "#0c0c0c"; + active_tab_background = "#78a9ff"; + inactive_tab_foreground = "#6e6f70"; + inactive_tab_background = "#2a2a2a"; + + color0 = "#282828"; + color8 = "#484848"; + color1 = "#ee5396"; + color9 = "#f16da6"; + color2 = "#25be6a"; + color10 = "#46c880"; + color3 = "#ebcb8b"; + color11 = "#f0d399"; + color4 = "#78a9ff"; + color12 = "#8cb6ff"; + color5 = "#be95ff"; + color13 = "#c8a5ff"; + color6 = "#33b1ff"; + color14 = "#52bdff"; + color7 = "#dfdfe0"; + color15 = "#e4e4e5"; + color16 = "#3ddbd9"; + color17 = "#ff7eb6"; + }; }; - extraConfig = '' - foreground #f2f4f8 - background #161616 - selection_foreground #f2f4f8 - selection_background #2a2a2a - - cursor #f2f4f8 - cursor_text_color #161616 - - url_color #25be6a - - active_border_color #78a9ff - inactive_border_color #535353 - bell_border_color #3ddbd9 - - active_tab_foreground #0c0c0c - active_tab_background #78a9ff - inactive_tab_foreground #6e6f70 - inactive_tab_background #2a2a2a - - color0 #282828 - color8 #484848 - color1 #ee5396 - color9 #f16da6 - color2 #25be6a - color10 #46c880 - color3 #ebcb8b - color11 #f0d399 - color4 #78a9ff - color12 #8cb6ff - color5 #be95ff - color13 #c8a5ff - color6 #33b1ff - color14 #52bdff - color7 #dfdfe0 - color15 #e4e4e5 - color16 #3ddbd9 - color17 #ff7eb6 - ''; } diff --git a/home/neovim.nix b/home/neovim.nix index 737b33d..b2f53bf 100644 --- a/home/neovim.nix +++ b/home/neovim.nix @@ -1,6 +1,21 @@ -{ lib, ... }: +{ + pkgs, + configs ? pkgs.configs, + ... +}: { - enable = true; + programs.neovim = { + enable = true; + defaultEditor = true; + extraConfig = + let + config = configs.neovim; + in + '' + set runtimepath+=${config} + source ${config}/init.lua + ''; + }; } diff --git a/home/vesktop.nix b/home/vesktop.nix index d2c25e1..14336a7 100644 --- a/home/vesktop.nix +++ b/home/vesktop.nix @@ -1,4 +1,7 @@ +{ ... }: + { + programs.vesktop = { enable = true; settings = { discordBranch = "stable"; @@ -313,4 +316,5 @@ WebContextMenus.enabled = true; }; }; + }; } diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..aefb920 --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,4 @@ +[ + ./tetrio + ./initialFile.nix +] diff --git a/modules/initialFile.nix b/modules/initialFile.nix new file mode 100644 index 0000000..0e5d70f --- /dev/null +++ b/modules/initialFile.nix @@ -0,0 +1,172 @@ +{ + pkgs, + lib ? pkgs.lib, + config, + ... +}: + +let + inherit (lib) mkOption types; + + cfg = lib.filterAttrs (n: f: f.enable) config.home.initialFile; + home = config.home.homeDirectory; +in +{ + options = { + home.initialFile = mkOption { + type = types.attrsOf ( + types.submodule ( + { name, config, ... }: + { + options = { + enable = mkOption { + type = types.bool; + default = true; + }; + target = mkOption { + type = types.str; + apply = + path: + let + absPath = if lib.hasPrefix "/" path then path else "${home}/${path}"; + in + lib.removePrefix (home + "/") absPath; + description = "Path to target file relative to home directory"; + default = "/homeless-shelter/home"; + }; + text = mkOption { + type = types.nullOr types.lines; + description = "Text of the file, otherwise copies .source file."; + default = null; + }; + source = mkOption { + type = types.path; + description = "Path of file whose source to copy"; + }; + mode = mkOption { + type = types.nullOr types.str; + description = "File mode to apply to target file (sourced from .source / .text if not specified)"; + default = null; + }; + dir_mode = mkOption { + type = types.str; + description = "File mode to apply to directories"; + default = "0755"; + }; + recursive = mkOption { + type = types.bool; + description = "Whether or not to recursively copy .source as a directory instead of as a file"; + default = false; + }; + force = mkOption { + type = types.bool; + description = "Whether to unconditionally replace the target file, even if it already exists."; + default = false; + }; + }; + config = { + target = lib.mkDefault name; + source = lib.mkIf (config.text != null) ( + lib.mkDefault ( + pkgs.writeTextFile { + inherit (config) text; + name = lib.hm.strings.storeFileName name; + } + ) + ); + }; + } + ) + ); + description = "Attribute set of files to write into the user home (if they don't already exist)."; + default = { }; + }; + }; + + config = { + assertions = [ + ( + let + dups = lib.attrNames ( + lib.filterAttrs (n: v: v > 1) ( + lib.foldAttrs (acc: v: acc + v) 0 (lib.mapAttrsToList (n: v: { ${v.target} = 1; }) cfg) + ) + ); + dupsStr = lib.concatStringsSep ", " dups; + in + { + assertion = dups == [ ]; + message = '' + Conflicting managed target files: ${dupsStr} + + This may happen, for example, if you have a configuration similar to + + home.initialFile = { + conflict1 = { source = ./foo.nix; target = "baz"; }; + conflict2 = { source = ./bar.nix; target = "baz"; }; + }''; + } + ) + ]; + + home.activation.copyInitialFiles = lib.hm.dag.entryAfter [ "writeBoundary" ] ( + let + homeArg = lib.escapeShellArg home; + in + '' + function copyFile() { + local source="$1" + local targetRel="$2" + local mode="$3" + local dirMode="$4" + local recursive="$5" + local force="$6" + + local target="${homeArg}/$targetRel" + + if [[ -e "$target" && "$force" != "true" ]]; then + verboseEcho "Skipping existing $target" + return 0 + fi + + run mkdir -p "$(dirname "$target")" + + if [[ -d "$source" ]]; then + if [[ "$recursive" != "true" ]]; then + errorEcho "Source '$source' is a directory but recursive=false" + return 1 + fi + run rm -rf "$target" + run cp -r "$source" "$target" + else + if [[ -e "$target" && "$force" == "true" ]]; then + run rm -f "$target" + fi + run cp "$source" "$target" + fi + + if [[ -n "$mode" ]]; then + if [[ -d "$target" && "$recursive" == "true" ]]; then + run chmod "$dirMode" "$target" + find "$target" -type f -exec chmod "$mode" {} + + else + run chmod "$mode" "$target" + fi + fi + } + '' + + lib.concatMapStrings ( + v: + let + src = lib.escapeShellArg (toString v.source); + tgt = lib.escapeShellArg v.target; + mode = if v.mode == null then "''" else lib.escapeShellArg v.mode; + in + '' + copyFile ${src} ${tgt} ${mode} ${lib.escapeShellArg v.dir_mode} ${lib.trivial.boolToString v.recursive} ${lib.trivial.boolToString v.force} + '' + ) (lib.attrValues cfg) + ); + + }; +} diff --git a/modules/tetrio/default.nix b/modules/tetrio/default.nix new file mode 100644 index 0000000..37a132b --- /dev/null +++ b/modules/tetrio/default.nix @@ -0,0 +1,723 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + inherit (lib) mkOption mkIf types; + inherit (types) either; + + clamp = + x: min: max: + if x < min then + min + else if x > max then + max + else + x; + + cfg = config.programs.tetrio-desktop; +in +{ + options.programs.tetrio-desktop = { + enable = lib.mkEnableOption "tetrio"; + package = lib.mkPackageOption pkgs "tetrio-desktop" { }; + + plus = { + enable = lib.mkEnableOption "tetrio-plus"; + package = lib.mkOption { + type = types.path; + description = "The package to use for TETR.IO PLUS"; + default = pkgs.tetrio-plus; + }; + + skin = mkOption { + type = types.nullOr ( + types.submodule { + options = { + package = mkOption { + type = types.package; + description = "The package to use for the skin"; + example = "mpkgs.tetrio.skin.simple-connected"; + }; + + nearest = mkOption { + type = types.bool; + description = "Force nearest-neighbor scaling"; + default = false; + }; + }; + } + ); + default = null; + description = "In-game tetrimino skin"; + }; + + hideOnStartup = lib.mkOption { + type = types.bool; + default = true; + description = "Disable the TETR.IO PLUS configuration panel showing"; + }; + }; + settings = { + handling = + let + buffering = types.enum [ + "off" + "hold" + "tap" + ]; + in + { + + auto_repeat_rate = mkOption { + type = types.number; + apply = x: clamp x 0 5; + description = "Automatic Repeat Rate: the speed at which tetrominoes move when holding down movement keys, measured in frames per movement."; + default = 2; + }; + delayed_auto_shift = mkOption { + type = types.number; + apply = x: clamp x 1 20; + description = "Delayed Auto Shift: the time between the initial keypress and the start of its automatic repeat movement, measured in frames."; + default = 10; + }; + das_cut_delay = mkOption { + type = types.number; + apply = x: clamp x 0 20; + + description = "DAS Cut Delay (frames): if not 0, any ongoing DAS movement will pause for a set amount of time after dropping/rotating a piece, measured in frames."; + default = 1; + }; + soft_drop_factor = mkOption { + type = types.number; + apply = x: clamp x 5 41; + description = "Soft Drop Factor: the factor with which soft drops change the gravity speed."; + default = 6; + }; + prevent_hard_drops = mkOption { + type = types.bool; + description = "If enabled, when a piece locks on its own, the hard drop key becomes unavailable for a few frames. This prevents accidental hard drops."; + default = true; + }; + direction_cancel_das = mkOption { + type = types.bool; + description = "If enabled, DAS charge is cancelled when you change directions."; + default = false; + }; + soft_drop_over_movement = mkOption { + type = types.bool; + description = "If enabled, at very high speeds soft drop will always take precedence over horizontal movement, for a more consistent game feel."; + default = true; + }; + rotation_buffering = mkOption { + type = buffering; + description = "When to buffer rotations for the next piece (\"hold\": only if you hold the key as the next piece spawns)."; + default = "tap"; + }; + hold_buffering = mkOption { + type = buffering; + description = "When to buffer holding for the next piece (\"hold\": only if you hold the key as the next piece spawns)."; + default = "tap"; + }; + }; + audio = + let + percentage = x: x / 100.0; + in + { + music = { + volume = mkOption { + type = types.number; + apply = x: percentage (clamp x 0 200); + description = "Volume (%) at which BGM and jingles play."; + default = 100; + }; + reset_on_retry = mkOption { + type = types.bool; + apply = x: !x; + description = "If enabled, the background music will reset whenever you retry a game."; + default = false; + }; + preferences = mkOption { + type = + with types; + attrsOf (enum [ + "off" + "--" + "-" + "" + "+" + "++" + ]); + apply = + x: + pkgs.lib.mapAttrs ( + _: value: + { + "off" = "ban"; + "--" = "minmin"; + "-" = "min"; + "" = "base"; + "+" = "plus"; + "++" = "plusplus"; + } + ."${value}" + ) x; + default = { }; + }; + }; + sfx = { + volume = mkOption { + type = types.number; + apply = x: percentage (clamp x 0 200); + description = "Volume (%) at which sound effects play."; + default = 100; + }; + next_pieces = mkOption { + type = types.bool; + description = "Whether to play a sound effect that signifies the next piece that'll come up."; + default = false; + }; + other_players = mkOption { + type = types.bool; + description = "Whether to hear the sounds of other people playing in Multiplayer."; + default = true; + }; + attacks = mkOption { + type = types.bool; + description = "Whether to hear the sounds of attacks going towards and from you."; + default = true; + }; + speed_changes = mkOption { + type = types.bool; + description = "Whether to hear a sound when your Climb Speed changes in Quick Play."; + default = true; + }; + }; + scroll_adjust_volume = mkOption { + type = types.bool; + description = "Whether to allow adjusting the volume via scrolling in-game (or everywhere while holding ALT)."; + default = true; + }; + mute_unfocused = mkOption { + type = types.bool; + description = "If enabled, the background music will be muted when TETR.IO is minimized or tabbed away."; + default = true; + }; + stereo = mkOption { + type = types.number; + apply = x: percentage (clamp x 0 100); + description = "Intensity (%) of stereo effects. 0% -> Centered; 100% -> Directional"; + default = 50; + }; + disable = mkOption { + type = types.bool; + description = "If enabled, no audio will ever play. This will speed up the game, with a rather obvious drawback."; + default = false; + }; + }; + visual = + let + toFloat = x: if builtins.typeOf x == "str" then builtins.fromJSON x else x; + percentage = + x: min: max: + builtins.toString ((clamp (toFloat x) min max) / 100.0); + in + { + graphics = { + pipeline = mkOption { + type = types.enum [ + "compatability" + "webgl-1" + "webgl-2" + ]; + apply = + x: + { + "compatability" = "legacy"; + "webgl-1" = "webgl1"; + "webgl-2" = "webgl2"; + } + ."${x}"; + description = "The WebGL mode to use for rendering"; + default = "webgl-2"; + }; + tier = mkOption { + type = types.enum [ + "minimal" + "low" + "medium" + "high" + "ultra" + ]; + description = "The graphics tier to use for rendering"; + default = "ultra"; + }; + cache = mkOption { + type = types.bool; + apply = x: if x then "medium" else "low"; + description = "Whether or not to enable caching of resources"; + default = true; + }; + particle_count = mkOption { + type = with types; either str number; + apply = x: percentage x 10 150; + description = "How many particles to display (%)."; + default = 150; + }; + + powersave = mkOption { + type = types.bool; + description = "If enabled, prioritize power saving over performance."; + default = false; + }; + low_resolution = mkOption { + type = types.bool; + description = "If enabled, render blurrier graphics. Not very pretty but helps performance."; + default = false; + }; + low_precision_counters = mkOption { + type = types.bool; + description = "If enabled, don't show as much precision on in-game counters. Speeds up the game significantly."; + default = false; + }; + }; + show_unfocus_warning = mkOption { + type = types.bool; + description = "If enabled, a warning is shown when TETR.IO is out of focus."; + default = true; + }; + action_text = mkOption { + type = types.enum [ + "off" + "some" + "all" + ]; + description = "Determines how much action text to display when performing special attacks."; + default = "some"; + }; + board_bounciness = mkOption { + type = with types; either str number; + apply = x: percentage x 0 200; + description = "How much (%) the board reacts when you move pieces around."; + default = 40; + }; + damage_shakiness = mkOption { + type = with types; either str number; + apply = x: percentage x 0 110; + description = "How much (%) the board reacts when you receive damage."; + default = 100; + }; + grid_opacity = mkOption { + type = with types; either str number; + apply = x: percentage x 0 110; + description = "How visible the grid is (%). 0% makes the grid invisible."; + default = 10; + }; + board_opacity = mkOption { + type = with types; either str number; + apply = x: percentage x 0 110; + description = "How visible the board is (%). 0% makes the board invisible."; + default = 85; + }; + shadow_opacity = mkOption { + type = with types; either str number; + apply = x: percentage x 0 110; + description = "How visible the shadow piece is (%). 0% makes the shadow piece invisible."; + default = 15; + }; + background_opacity = mkOption { + type = with types; either str number; + apply = x: percentage x 0 100; + description = "How visible the background images are. 0% makes the background entirely black."; + default = 5; + }; + show_background_in_menus = mkOption { + type = types.bool; + apply = x: !x; + description = "If enabled, do not show the background when in menus. This will majorly improve performance in menus, but you will no longer see the background."; + default = false; + }; + board_zoom = mkOption { + type = with types; either str number; + apply = x: percentage x 0 110; + description = "How large the board displays. Values over 100% may cause some elements to not be visible."; + default = 100; + }; + spin_board = mkOption { + type = types.bool; + description = "When enabled, the board reacts to T-Spins by rotating a little with it."; + default = true; + }; + fire_meter = mkOption { + type = types.bool; + description = "If enabled, fill a fire meter when doing well, illuminating boards that have a lot of fire."; + default = true; + }; + danger_warning = mkOption { + type = types.bool; + description = "If enabled, makes the board red and play a warning sound when you're in danger."; + default = true; + }; + colored_shadow = mkOption { + type = types.bool; + description = "If enabled, colors the shadow piece."; + default = true; + }; + color_locked_hold_piece = mkOption { + type = types.bool; + description = "If enabled, the HOLD piece will be grayed out if it may not be used."; + default = true; + }; + + }; + multiplayer = { + chat = { + enable = mkOption { + type = types.bool; + apply = x: !x; + description = "If disabled, chat will be hidden when ingame."; + default = true; + }; + filter = mkOption { + type = types.bool; + description = "If enabled, profanity in chat will be filtered. Note that such filters are never perfect."; + default = true; + }; + show_emotes = mkOption { + type = types.bool; + description = "If enabled, show emotes in chat."; + default = true; + }; + show_animated_emotes = mkOption { + type = types.bool; + description = "If enabled, show animated emotes in chat."; + default = true; + }; + invert = mkOption { + type = types.bool; + description = "If enabled, chat text shows in black (good for light backgrounds)."; + default = false; + }; + darken = mkOption { + type = types.bool; + description = "If enabled, show a background behind chat messages when typing."; + default = true; + }; + }; + notifications = + let + notification.optional = types.enum [ + "off" + "in-game" + "desktop" + ]; + notification.required = types.enum [ + "in-game" + "desktop" + ]; + apply = + x: + { + "off" = "off"; + "in-game" = "ingame"; + "desktop" = "both"; + } + ."${x}"; + in + { + when = { + friend_online = mkOption { + type = notification.optional; + inherit apply; + description = "Notify me when a friend goes online"; + default = "in-game"; + }; + friend_offline = mkOption { + type = notification.optional; + inherit apply; + description = "Notify me when a friend goes offline"; + default = "off"; + }; + friend_dm_recieved = mkOption { + type = notification.optional; + inherit apply; + description = "Notify me when a friend sends me a direct message"; + default = "desktop"; + }; + dm_recieved = mkOption { + type = notification.optional; + inherit apply; + description = "Notify me when a non-friend sends me a direct message"; + default = "desktop"; + }; + room_invite = mkOption { + type = notification.required; + inherit apply; + description = "Notify me when someone invites me to a room"; + default = "desktop"; + }; + other = mkOption { + type = notification.required; + inherit apply; + description = "Other notifications"; + default = "desktop"; + }; + }; + enable_desktop_notifications = mkOption { + type = types.bool; + description = "If enabled, show notifications outside of the game."; + default = true; + }; + suppress_while_playing = mkOption { + type = types.bool; + description = "If enabled, unimportant notifications don't show ingame, but will be shown after the game."; + default = false; + }; + full_volume = mkOption { + type = types.bool; + description = "If enabled, notification sounds always play at full volume."; + default = true; + }; + }; + hide_room_ids = mkOption { + type = types.bool; + description = "If enabled, room IDs will not be shown, to protect you from streamsniping."; + default = false; + }; + show_network_warnings = mkOption { + type = types.bool; + apply = x: !x; + description = "If disabled, network warning icons will not be shown."; + default = true; + }; + notify_elim = mkOption { + type = types.bool; + description = "If enabled, show a popup when you KO someone or get KO'd."; + default = true; + }; + duels_side_by_side = mkOption { + type = types.bool; + description = "Whether to display a duel side-by-side. This causes your own board to move slightly to the left."; + default = true; + }; + simplify_thumbnails = mkOption { + type = types.bool; + description = "If enabled, always shows the simpler thumbnails for other players. This increases performance in games between 2 and 8 players, but looks less nice."; + default = false; + }; + animate_super_lobby_background = mkOption { + type = types.bool; + apply = x: !x; + description = "If enabled, the background of Super Lobbies (rooms of 100+ players) animate."; + default = true; + }; + animate_background_in_quickplay = mkOption { + type = types.bool; + apply = x: !x; + description = "If enabled, the background of Quick Play animate."; + default = true; + }; + welcome_guide = mkOption { + type = types.bool; + description = "If enabled, show the simple guide with the keybinds in multiplayer lobbies."; + default = true; + }; + }; + keep_replay_tools_open = mkOption { + type = types.bool; + description = "If enabled, the replay tools do not collapse when you're not using them."; + default = false; + }; + skip_login_screen = mkOption { + type = types.enum [ + "never" + "by-url" + "always" + ]; + apply = + x: + { + "never" = "never"; + "by-url" = "quickjoin"; + "always" = "always"; + } + ."${x}"; + description = "When to skip the login screen (\"by-url\": only when joining matches or viewing replays by url)"; + default = "always"; + }; + discord_rpc = mkOption { + type = types.bool; + description = "If enabled, show your current activity in Discord."; + default = true; + }; + flash_taskbar_icon = mkOption { + type = types.bool; + description = "If enabled, the taskbar icon will flash when something important happens."; + default = true; + }; + devtools = mkOption { + type = types.bool; + description = "If enabled, allow opening the developer toolbox."; + default = false; + }; + advertisments.i_support_the_devs.i_cannot_play_with_ads.and_i_really_want_to.disable = mkOption { + type = types.bool; + description = "If enabled, most/all third-party ads will not show."; + default = false; + }; + }; + }; + + config = mkIf cfg.enable ( + lib.mkMerge [ + { + home.packages = [ + (cfg.package.override { + withTetrioPlus = cfg.plus.enable; + tetrio-plus = cfg.plus.package; + }) + ]; + + home.initialFile.".config/tetrio-desktop/Local Storage/leveldb" = { + mode = "0644"; + source = pkgs.callPackage ./leveldb.nix { + value = { + handling = + let + set = cfg.settings.handling; + in + { + arr = set.auto_repeat_rate; + das = set.delayed_auto_shift; + dcd = set.das_cut_delay; + sdf = set.soft_drop_factor; + safelock = set.prevent_hard_drops; + cancel = set.direction_cancel_das; + may20g = set.soft_drop_over_movement; + irs = set.rotation_buffering; + ihs = set.hold_buffering; + }; + volume = + let + set = cfg.settings.audio; + in + { + music = set.music.volume; + bgmtweak = set.music.preferences; + sfx = set.sfx.volume; + stereo = set.stereo; + scrollable = set.scroll_adjust_volume; + oof = set.mute_unfocused; + next = set.sfx.next_pieces; + others = set.sfx.other_players; + attacks = set.sfx.attacks; + zenithrank = set.sfx.speed_changes; + disable = set.disable; + }; + video = + let + set = cfg.settings.visual; + mul = cfg.settings.multiplayer; + in + { + actionText = set.action_text; + bounciness = set.board_bounciness; + shakiness = set.damage_shakiness; + gridopacity = set.grid_opacity; + boardopacity = set.board_opacity; + shadowopacity = set.shadow_opacity; + zoom = set.board_zoom; + sidebyside = mul.duels_side_by_side; + spin = set.spin_board; + kos = mul.notify_elim; + siren = set.danger_warning; + colorshadow = set.colored_shadow; + + graphics = set.graphics.tier; + caching = set.graphics.cache; + webgl = set.graphics.pipeline; + particles = set.graphics.particle_count; + background = set.background_opacity; + powersave = set.graphics.powersave; + lowres = set.graphics.low_resolution; + lowrescounters = set.graphics.low_precision_counters; + alwaystiny = mul.simplify_thumbnails; + nosuperlobbyanim = mul.animate_super_lobby_background; + nozenithanim = mul.animate_background_in_quickplay; + nobg = set.show_background_in_menus; + chatfilter = mul.chat.filter; + nochat = mul.chat.enable; + hideroomids = mul.hide_room_ids; + emotes = mul.chat.show_emotes; + emotes_anim = mul.chat.show_animated_emotes; + invert = mul.chat.invert; + chatbg = mul.chat.darken; + replaytoolsnocollapse = cfg.settings.keep_replay_tools_open; + hidenetwork = mul.show_network_warnings; + focuswarning = set.show_unfocus_warning; + guide = mul.welcome_guide; + + desktopnotifications = mul.notifications.enable_desktop_notifications; + }; + notifications = + let + set = cfg.settings.multiplayer.notifications; + in + { + suppress = set.suppress_while_playing; + forcesound = set.full_volume; + online = set.when.friend_online; + offline = set.when.friend_offline; + dm = set.when.friend_dm_recieved; + dm_pending = set.when.dm_recieved; + invite = set.when.room_invite; + other = set.when.other; + }; + electron = { + loginskip = cfg.settings.skip_login_screen; + adblock = + cfg.settings.advertisments.i_support_the_devs.i_cannot_play_with_ads.and_i_really_want_to.disable; + taskbarflash = cfg.settings.flash_taskbar_icon; + autoupdate = false; + anglecompat = false; + presence = cfg.settings.discord_rpc; + devtools = cfg.settings.devtools; + }; + }; + }; + recursive = true; + }; + } + (mkIf (cfg.plus.enable) { + home.file.".config/tetrio-desktop/tetrioplus/tpkey-tetrioPlusEnabled.json" = { + text = '' + { "value": true } + ''; + force = true; + }; + home.file.".config/tetrio-desktop/tetrioplus/tpkey-hideTetrioPlusOnStartup.json" = { + text = '' + { "value": ${lib.trivial.boolToString cfg.plus.hideOnStartup} } + ''; + force = true; + }; + }) + (mkIf (cfg.plus.enable && cfg.plus ? skin) { + home.file.".config/tetrio-desktop/tetrioplus/tpkey-skin.json" = { + source = cfg.plus.skin.package; + force = true; + }; + home.file.".config/tetrio-desktop/tetrioplus/tpkey-forceNearestScaling.json" = { + text = '' + { "value": ${lib.trivial.boolToString cfg.plus.skin.nearest} } + ''; + force = true; + }; + }) + ] + ); +} diff --git a/modules/tetrio/leveldb.nix b/modules/tetrio/leveldb.nix new file mode 100644 index 0000000..820ab1b --- /dev/null +++ b/modules/tetrio/leveldb.nix @@ -0,0 +1,32 @@ +{ + stdenv, + lib, + leveldb-cli, + value, + origin ? "https://tetr.io", + key ? "userConfig", +}: + +let + src = ./.; +in +stdenv.mkDerivation { + pname = "tetrio-leveldb"; + version = "1"; + + inherit src; + + nativeBuildInputs = [ leveldb-cli ]; + + buildPhase = '' + runHook preBuild + + ${lib.getExe leveldb-cli} \ + $out \ + ${lib.escapeShellArg origin} \ + ${lib.escapeShellArg key} \ + ${lib.escapeShellArg (builtins.toJSON value)} + + runHook postBuild + ''; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index cbb7ea6..bcf9f7b 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -1,32 +1,22 @@ -{ - pkgs ? import { config.allowUnfree = true; }, - config ? (import { }).config, - fetchzip ? pkgs.fetchzip, - ... -}: +final: prev: let - system = { - stateVersion = config.system.stateVersion; - }; - use = path: pkgs.callPackage (import path) { inherit pkgs; }; + fetchzip = prev.fetchzip; + use = path: prev.callPackage (import path) { pkgs = prev; }; in { - inherit system; - - wallpaper = use ./wallpaper/default.nix; - tetrio.desktop = use ./tetrio/default.nix; + wallpaper = use ./wallpaper; + tetrio.desktop = use ./tetrio; tetrio.plus = let repo = { owner = "UniQMG"; name = "tetrio-plus"; job = "11675178434"; - hash = "sha256-j3ACcnT64eMQtWYDGOE2oGXpnN5EUqk+lyV6ARBEtU8="; }; src = fetchzip { url = "https://gitlab.com/${repo.owner}/${repo.name}/-/jobs/${repo.job}/artifacts/raw/app.asar.zip"; - hash = repo.hash; + hash = "sha256-j3ACcnT64eMQtWYDGOE2oGXpnN5EUqk+lyV6ARBEtU8="; }; in "${src}/app.asar"; @@ -34,25 +24,11 @@ in simple-connected = use ./tetrio/skins/simple-connected.nix; }; - leveldb-cli = use ./leveldb/default.nix; + leveldb-cli = use ./leveldb; - config.neovim = use ./neovim/default.nix; - config.fish = use ./fish/default.nix; + configs.neovim = use ./neovim; + configs.fish = use ./fish; - font.monaco = use ./monaco-font/default.nix; - - home-manager = { - module = - let - home-manager = fetchzip { - url = "https://github.com/nix-community/home-manager/archive/master.tar.gz"; - hash = "sha256-UZjPc/d5XRxvjDbk4veAO4XFdvx6BUum2l40V688Xq8="; - }; - in - import "${home-manager}/nixos"; - sharedModules = [ - ./home-manager/initialFile.nix - ./tetrio/module.nix - ]; - }; + nimbus-roman = use ./nimbus; + monaco = use ./monaco-font; } diff --git a/pkgs/element/default.nix b/pkgs/element/default.nix deleted file mode 100644 index 9ca5bbc..0000000 --- a/pkgs/element/default.nix +++ /dev/null @@ -1,180 +0,0 @@ -{ - lib, - stdenv, - fetchFromGitHub, - makeWrapper, - makeDesktopItem, - nodejs, - electron_39, - element-web, - sqlcipher, - callPackage, - typescript, - # command line arguments which are always set - commandLineArgs ? "", - yarnConfigHook, - yarnBuildHook, - fetchYarnDeps, - asar, - copyDesktopItems, - darwin, - ... -}: - -let - pinData = import ./element-desktop-pin.nix; - inherit (pinData.hashes) desktopSrcHash desktopYarnHash; - executableName = "element-desktop"; - electron = electron_39; - seshat = callPackage ./seshat { }; -in -stdenv.mkDerivation ( - finalAttrs: - removeAttrs pinData [ "hashes" ] - // { - pname = "element-desktop"; - name = "${finalAttrs.pname}-${finalAttrs.version}"; - src = fetchFromGitHub { - owner = "element-hq"; - repo = "element-desktop"; - rev = "v${finalAttrs.version}"; - hash = desktopSrcHash; - }; - - offlineCache = fetchYarnDeps { - yarnLock = finalAttrs.src + "/yarn.lock"; - hash = desktopYarnHash; - }; - - env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; - - nativeBuildInputs = [ - asar - copyDesktopItems - nodejs - makeWrapper - typescript - yarnConfigHook - yarnBuildHook - ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.autoSignDarwinBinariesHook ]; - - inherit seshat; - - # Only affects unused scripts in $out/share/element/electron/scripts. Also - # breaks because there are some `node`-scripts with a `npx`-shebang and - # this shouldn't be in the closure just for unused scripts. - dontPatchShebangs = true; - - postPatch = '' - cp -r ${electron.dist} electron-dist - chmod -R u+w electron-dist - - substituteInPlace package.json \ - --replace-fail \ - ' electron-builder",' \ - ' electron-builder --dir -c.electronDist=electron-dist -c.electronVersion=${electron.version} -c.mac.identity=null",' - - # `@electron/fuses` tries to run `codesign` and fails. Disable and use autoSignDarwinBinariesHook instead - substituteInPlace ./electron-builder.ts \ - --replace-fail "resetAdHocDarwinSignature:" "// resetAdHocDarwinSignature:" - - # Need to disable asar integrity check to copy in native seshat files, see postBuild phase - substituteInPlace ./electron-builder.ts \ - --replace-fail "enableEmbeddedAsarIntegrityValidation: true" "enableEmbeddedAsarIntegrityValidation: false" - ''; - - preBuild = '' - # Apply upstream patch - # Can be removed if upstream removes patches/@types+auto-launch+5.0.5.patch introduced in - # https://github.com/element-hq/element-desktop/commit/5e882f8e08d58bf9663c8e3ab33885bf7b3709de - node ./node_modules/patch-package/index.js - ''; - - postBuild = '' - # relative path to app.asar differs on Linux and MacOS - packed=$(find ./dist -name app.asar) - asar extract "$packed" tmp-app - - # linking here leads to Error: tmp-app/node_modules/matrix-seshat: file ... links out of the package - cp -r $seshat tmp-app/node_modules/matrix-seshat - - asar pack tmp-app "$packed" - ''; - - installPhase = '' - runHook preInstall - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p "$out/Applications" "$out/bin" - mv dist/mac*/Element.app "$out/Applications" - - ln -s '${element-web}' "$out/Applications/Element.app/Contents/Resources/webapp" - - wrapProgram "$out/Applications/Element.app/Contents/MacOS/Element" \ - --add-flags ${lib.escapeShellArg commandLineArgs} - - makeWrapper "$out/Applications/Element.app/Contents/MacOS/Element" "$out/bin/${executableName}" - '' - + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' - mkdir -p "$out/bin" "$out/share" - - cp -a dist/*-unpacked/resources $out/share/element - - ln -s '${element-web}' "$out/share/element/webapp" - - # icon, used in makeDesktopItem - mkdir -p "$out/share/icons/hicolor/512x512/apps" - ln -s "$out/share/element/build/icon.png" "$out/share/icons/hicolor/512x512/apps/element.png" - - # executable wrapper - # LD_PRELOAD workaround for sqlcipher not found: https://github.com/matrix-org/seshat/issues/102 - makeWrapper '${lib.getExe electron}' "$out/bin/${executableName}" \ - --set LD_PRELOAD ${sqlcipher}/lib/libsqlcipher.so \ - --add-flags "$out/share/element/app.asar" \ - --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}" \ - --add-flags ${lib.escapeShellArg commandLineArgs} - '' - + '' - runHook postInstall - ''; - - # The desktop item properties should be kept in sync with data from upstream: - # https://github.com/element-hq/element-desktop/blob/develop/package.json - desktopItems = [ - (makeDesktopItem { - name = "element-desktop"; - exec = "${executableName} %u"; - icon = "element"; - desktopName = "Element"; - genericName = "Matrix Client"; - comment = finalAttrs.meta.description; - categories = [ - "Network" - "InstantMessaging" - "Chat" - ]; - startupWMClass = "Element"; - mimeTypes = [ - "x-scheme-handler/element" - "x-scheme-handler/io.element.desktop" - ]; - }) - ]; - - passthru = { - # run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-desktop - updateScript = ./update.sh; - }; - - meta = { - description = "Feature-rich client for Matrix.org"; - homepage = "https://element.io/"; - changelog = "https://github.com/element-hq/element-desktop/blob/v${finalAttrs.version}/CHANGELOG.md"; - license = lib.licenses.agpl3Plus; - teams = [ lib.teams.matrix ]; - inherit (electron.meta) platforms; - mainProgram = "element-desktop"; - }; - } -) diff --git a/pkgs/element/element-desktop-pin.nix b/pkgs/element/element-desktop-pin.nix deleted file mode 100644 index 9c28e4b..0000000 --- a/pkgs/element/element-desktop-pin.nix +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version" = "1.12.10"; - "hashes" = { - "desktopSrcHash" = "sha256-2LQBT3+2JTR3XHO3DynOp8cw2m2SB/mGH01e3SFD/IM="; - "desktopYarnHash" = "sha256-QIzuVKmUS4tqXAzhpfLZOp51kLbfC1M2nrff8e+sdg4="; - }; -} diff --git a/pkgs/element/seshat/default.nix b/pkgs/element/seshat/default.nix deleted file mode 100644 index 5e3bb3f..0000000 --- a/pkgs/element/seshat/default.nix +++ /dev/null @@ -1,74 +0,0 @@ -{ - lib, - stdenv, - rustPlatform, - fetchFromGitHub, - sqlcipher, - nodejs, - python3, - yarn, - fixup-yarn-lock, - fetchYarnDeps, - removeReferencesTo, -}: - -let - pinData = lib.importJSON ./pin.json; - -in -rustPlatform.buildRustPackage rec { - pname = "seshat-node"; - inherit (pinData) version cargoHash; - - src = fetchFromGitHub { - owner = "matrix-org"; - repo = "seshat"; - rev = version; - hash = pinData.srcHash; - }; - - sourceRoot = "${src.name}/seshat-node/native"; - - nativeBuildInputs = [ - nodejs - python3 - yarn - fixup-yarn-lock - ]; - buildInputs = [ sqlcipher ]; - - npm_config_nodedir = nodejs; - - yarnOfflineCache = fetchYarnDeps { - yarnLock = src + "/seshat-node/yarn.lock"; - sha256 = pinData.yarnHash; - }; - - buildPhase = '' - runHook preBuild - cd .. - chmod u+w . ./yarn.lock - export HOME=$PWD/tmp - mkdir -p $HOME - yarn config --offline set yarn-offline-mirror $yarnOfflineCache - fixup-yarn-lock yarn.lock - yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive - patchShebangs node_modules/ - node_modules/.bin/neon build --release -- --target ${stdenv.hostPlatform.rust.rustcTarget} -Z unstable-options --out-dir target/release - runHook postBuild - ''; - - doCheck = false; - - installPhase = '' - runHook preInstall - shopt -s extglob - rm -rf native/!(index.node) - rm -rf node_modules $HOME - cp -r . $out - ${removeReferencesTo}/bin/remove-references-to -t ${stdenv.cc.cc} $out/native/index.node - runHook postInstall - ''; - - disallowedReferences = [ stdenv.cc.cc ]; -} diff --git a/pkgs/element/seshat/pin.json b/pkgs/element/seshat/pin.json deleted file mode 100644 index aacdffa..0000000 --- a/pkgs/element/seshat/pin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "2.3.3", - "srcHash": "sha256-HmKHWFoO8TQ9S/RcJnJ3h85/2uSkqGrgLnX82hkux4Q=", - "yarnHash": "1cbkv8ap7f8vxl5brzqb86d2dyxg555sz67cldrp0vgnk8sq6ibp", - "cargoHash": "sha256-klrFk0gpqQu/9MzLEYMNqEBETZMXtZJX67Sm5ZqyHfE==" -} diff --git a/pkgs/element/seshat/update.sh b/pkgs/element/seshat/update.sh deleted file mode 100644 index 6e7e75e..0000000 --- a/pkgs/element/seshat/update.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -I nixpkgs=../../../../../../ -i bash -p wget prefetch-yarn-deps yarn nix-prefetch nix-prefetch-github - -if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then - echo "Regenerates packaging data for the seshat package." - echo "Usage: $0 [git release tag]" - exit 1 -fi - -version="$1" - -set -euo pipefail - -if [ -z "$version" ]; then - version="$(wget -O- "https://api.github.com/repos/matrix-org/seshat/tags" | jq -r '.[] | .name' | sort --version-sort | tail -1)" -fi - -SRC="https://raw.githubusercontent.com/matrix-org/seshat/$version" - -tmpdir=$(mktemp -d) -trap 'rm -rf "$tmpdir"' EXIT - -pushd $tmpdir -wget "$SRC/seshat-node/yarn.lock" -yarn_hash=$(prefetch-yarn-deps yarn.lock) -popd - -src_hash=$(nix-prefetch-github matrix-org seshat --rev ${version} | jq -r .hash) - -cat > pin.json << EOF -{ - "version": "$version", - "srcHash": "$src_hash", - "yarnHash": "$yarn_hash", - "cargoHash": "0000000000000000000000000000000000000000000000000000" -} -EOF - -cargo_hash=$(nix-prefetch "{ sha256 }: (import ../../../../../.. {}).element-desktop.seshat.cargoDeps") - -cat > pin.json << EOF -{ - "version": "$version", - "srcHash": "$src_hash", - "yarnHash": "$yarn_hash", - "cargoHash": "$cargo_hash" -} -EOF - diff --git a/pkgs/fish/default.nix b/pkgs/fish/default.nix index b6ce760..8bfe836 100644 --- a/pkgs/fish/default.nix +++ b/pkgs/fish/default.nix @@ -1,10 +1,6 @@ -{ - pkgs ? import { }, - lib ? pkgs.lib, - ... -}: +{ stdenv, ... }: -pkgs.stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "fish-config"; version = "1.0"; @@ -14,9 +10,9 @@ pkgs.stdenv.mkDerivation rec { }; installPhase = '' - mkdir -p $out - cp -r ${src}/* $out/ - ''; + mkdir -p $out + cp -r ${src}/* $out/ + ''; dontUnpack = true; dontBuild = true; diff --git a/pkgs/flake.nix b/pkgs/flake.nix new file mode 100644 index 0000000..97c42f6 --- /dev/null +++ b/pkgs/flake.nix @@ -0,0 +1,10 @@ +{ + description = "Pkgs overlay"; + + inputs = { }; + outputs = + { self, ... }: + { + overlays.default = final: prev: (import ./default.nix final prev); + }; +} diff --git a/pkgs/leveldb/default.nix b/pkgs/leveldb/default.nix index 5a45d54..7cb8618 100644 --- a/pkgs/leveldb/default.nix +++ b/pkgs/leveldb/default.nix @@ -1,12 +1,10 @@ -{ - pkgs ? import { }, -}: +{ buildGoModule, fetchFromGitHub, ... }: -pkgs.buildGoModule { +buildGoModule { name = "leveldb-cli"; version = "1.0.0"; - src = pkgs.fetchFromGitHub { + src = fetchFromGitHub { owner = "theblueplum"; repo = "leveldb-cli"; rev = "main"; diff --git a/pkgs/monaco-font/default.nix b/pkgs/monaco-font/default.nix index 2e777db..1b25af1 100644 --- a/pkgs/monaco-font/default.nix +++ b/pkgs/monaco-font/default.nix @@ -1,10 +1,6 @@ -{ - pkgs ? import { system = builtins.currentSystem; }, - lib ? pkgs.lib, - ... -}: +{ stdenv, lib, ... }: -pkgs.stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "monaco-font"; version = "1.0"; diff --git a/pkgs/monaco-font/result b/pkgs/monaco-font/result deleted file mode 120000 index c38f055..0000000 --- a/pkgs/monaco-font/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/kp450zrxxva5fv7wwpnz841vgxan6c49-nixos-system-blueplum-25.05.811874.daf6dc47aa4b \ No newline at end of file diff --git a/pkgs/neovim/default.nix b/pkgs/neovim/default.nix index 74f39ff..fd4d7f2 100644 --- a/pkgs/neovim/default.nix +++ b/pkgs/neovim/default.nix @@ -1,10 +1,6 @@ -{ - pkg ? import , - lib ? pkg.lib, - ... -}: +{ stdenv, ... }: -pkg.stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "neovim-config"; version = "1.0"; diff --git a/pkgs/nimbus/default.nix b/pkgs/nimbus/default.nix new file mode 100644 index 0000000..70e03ff --- /dev/null +++ b/pkgs/nimbus/default.nix @@ -0,0 +1,23 @@ +{ lib, stdenv, ... }: + +stdenv.mkDerivation { + pname = "nimbus-roman"; + version = "1.0"; + + src = ./.; + + dontUnpack = true; + + installPhase = '' + mkdir -p $out/share/fonts/opentype + cp $src/nimbus.otf $out/share/fonts/opentype/nimbus.otf + cp $src/nimbus-bold.otf $out/share/fonts/opentype/nimbus-bold.otf + cp $src/nimbus-bolditalic.otf $out/share/fonts/opentype/nimbus-bolditalic.otf + ''; + + meta = with lib; { + description = "Nimbus Roman No. 9 L"; + license = licenses.gpl2; + platforms = platforms.all; + }; +} diff --git a/pkgs/nimbus/nimbus-bold.otf b/pkgs/nimbus/nimbus-bold.otf new file mode 100644 index 0000000..7d2fab8 Binary files /dev/null and b/pkgs/nimbus/nimbus-bold.otf differ diff --git a/pkgs/nimbus/nimbus-bolditalic.otf b/pkgs/nimbus/nimbus-bolditalic.otf new file mode 100644 index 0000000..367d7b6 Binary files /dev/null and b/pkgs/nimbus/nimbus-bolditalic.otf differ diff --git a/pkgs/nimbus/nimbus.otf b/pkgs/nimbus/nimbus.otf new file mode 100644 index 0000000..c173b33 Binary files /dev/null and b/pkgs/nimbus/nimbus.otf differ diff --git a/pkgs/tetrio/default.nix b/pkgs/tetrio/default.nix index ce7b3f4..5e773cd 100644 --- a/pkgs/tetrio/default.nix +++ b/pkgs/tetrio/default.nix @@ -1,30 +1,22 @@ { - pkgs ? import { }, - fetchzip ? pkgs.fetchzip, - withTetrioPlus ? false, - tetrio-plus ? pkgs.tetrio-plus, + dpkg, + fetchzip, + tetrio-desktop, + withTetrioPlus ? false, + tetrio-plus, ... }: let - tetrio-desktop = - let - version = "10"; - in - { - inherit version; - src = fetchzip { - url = "https://tetr.io/about/desktop/builds/${version}/TETR.IO%20Setup.deb"; - hash = "sha256-2FtFCajNEj7O8DGangDecs2yeKbufYLx1aZb3ShnYvw="; - nativeBuildInputs = with pkgs; [ dpkg ]; - }; - }; + version = "10"; + src = fetchzip { + url = "https://tetr.io/about/desktop/builds/${version}/TETR.IO%20Setup.deb"; + hash = "sha256-2FtFCajNEj7O8DGangDecs2yeKbufYLx1aZb3ShnYvw="; + nativeBuildInputs = [ dpkg ]; + }; in -(pkgs.tetrio-desktop.overrideAttrs { - version = tetrio-desktop.version; - src = tetrio-desktop.src; -}).override { - inherit withTetrioPlus tetrio-plus; +(tetrio-desktop.overrideAttrs { inherit src version; }).override { + inherit withTetrioPlus tetrio-plus; } diff --git a/pkgs/tetrio/leveldb.nix b/pkgs/tetrio/leveldb.nix index bef5d1a..3fcfb60 100644 --- a/pkgs/tetrio/leveldb.nix +++ b/pkgs/tetrio/leveldb.nix @@ -1,31 +1,32 @@ { - pkgs ? import { }, - mpkgs ? import /etc/nixos/pkgs/default.nix { }, + stdenv, + lib, + leveldb-cli, + value, origin ? "https://tetr.io", key ? "userConfig", - value, - ... + ... }: let src = ./.; in -pkgs.stdenv.mkDerivation { +stdenv.mkDerivation { pname = "tetrio-leveldb"; version = "1"; inherit src; - nativeBuildInputs = [ mpkgs.leveldb-cli ]; + nativeBuildInputs = [ leveldb-cli ]; buildPhase = '' runHook preBuild - ${pkgs.lib.getExe mpkgs.leveldb-cli} \ + ${lib.getExe leveldb-cli} \ $out \ - ${pkgs.lib.escapeShellArg origin} \ - ${pkgs.lib.escapeShellArg key} \ - ${pkgs.lib.escapeShellArg (builtins.toJSON value)} + ${lib.escapeShellArg origin} \ + ${lib.escapeShellArg key} \ + ${lib.escapeShellArg (builtins.toJSON value)} runHook postBuild ''; diff --git a/pkgs/tetrio/module.nix b/pkgs/tetrio/module.nix index e76184e..37a132b 100644 --- a/pkgs/tetrio/module.nix +++ b/pkgs/tetrio/module.nix @@ -18,8 +18,6 @@ let else x; - leveldb = import ./leveldb.nix; - cfg = config.programs.tetrio-desktop; in { @@ -586,7 +584,7 @@ in home.initialFile.".config/tetrio-desktop/Local Storage/leveldb" = { mode = "0644"; - source = leveldb { + source = pkgs.callPackage ./leveldb.nix { value = { handling = let diff --git a/pkgs/tetrio/skins/simple-connected.nix b/pkgs/tetrio/skins/simple-connected.nix index 7d5f7d5..e06d496 100644 --- a/pkgs/tetrio/skins/simple-connected.nix +++ b/pkgs/tetrio/skins/simple-connected.nix @@ -1,21 +1,18 @@ -{ - pkgs ? import { }, - ... -}: +{ stdenv, fetchurl, ... }: let - src = pkgs.fetchurl { + src = fetchurl { url = "https://you.have.fail/tetrioplus/data/tpsefiles/skin/SpooKoArts/simple_connected.zip.tpse"; hash = "sha256-dIrEpEV9Gy2iU6K6rMrNX4XFQEchkJqSmOuQwVF4EQQ="; }; in -pkgs.stdenv.mkDerivation { +stdenv.mkDerivation { name = "simple-connected"; version = "2022-06-26"; inherit src; - dontUnpack = true; - dontBuild = true; + dontUnpack = true; + dontBuild = true; installPhase = '' runHook preInstall @@ -23,9 +20,9 @@ pkgs.stdenv.mkDerivation { runHook postInstall ''; - fixupPhase = '' - runHook preFixup - sed -i 's/\bskin\b/value/' $out - runHook postFixup - ''; + fixupPhase = '' + runHook preFixup + sed -i 's/\bskin\b/value/' $out + runHook postFixup + ''; } diff --git a/pkgs/wallpaper/default.nix b/pkgs/wallpaper/default.nix index a5c8ae6..29c3333 100644 --- a/pkgs/wallpaper/default.nix +++ b/pkgs/wallpaper/default.nix @@ -1,10 +1,6 @@ -{ - pkgs ? import { }, - lib ? pkgs.lib, - ... -}: +{ stdenv, ... }: -pkgs.stdenv.mkDerivation rec { +stdenv.mkDerivation rec { pname = "wallpaper"; version = "1.0";