From 9ce574a6e0b7eef89e65def444ea67bfd7ab8cc8 Mon Sep 17 00:00:00 2001 From: Grimmauld Date: Sun, 5 May 2024 13:14:44 +0200 Subject: [PATCH] add overlays (and make them work), update flake --- common/gaming.nix | 4 +-- common/tooling/default.nix | 2 +- common/tooling/python.nix | 5 ++- common/xdg/mime.nix | 2 +- flake.lock | 36 ++++++++----------- flake.nix | 26 +++++++------- modules/users.nix | 3 +- overlays/default.nix | 5 +++ overlays/deskwhich.nix | 3 ++ overlays/mcontrolcenter.nix | 8 +++++ overlays/the-powder-toy.nix | 8 +++++ .../hardware-configuration.nix | 7 +--- sway/default.nix | 11 +++--- 13 files changed, 69 insertions(+), 51 deletions(-) create mode 100644 overlays/default.nix create mode 100644 overlays/deskwhich.nix create mode 100644 overlays/mcontrolcenter.nix create mode 100644 overlays/the-powder-toy.nix diff --git a/common/gaming.nix b/common/gaming.nix index d31648e..9ba5338 100644 --- a/common/gaming.nix +++ b/common/gaming.nix @@ -27,7 +27,7 @@ in start = "${lib.getExe pkgs.libnotify} 'GameMode started'"; end = "${lib.getExe pkgs.libnotify} 'GameMode ended'"; }; - }; + }; }; services.udev.packages = [ pkgs.wooting-udev-rules ]; @@ -39,7 +39,7 @@ in environment.systemPackages = with pkgs; [ heroic prismlauncher - mangohud + mangohud the-powder-toy (pkgs.symlinkJoin { name = "osu"; diff --git a/common/tooling/default.nix b/common/tooling/default.nix index aac45a3..5b1204b 100644 --- a/common/tooling/default.nix +++ b/common/tooling/default.nix @@ -65,7 +65,7 @@ in core.autocrlf = "input"; commit.gpgsign = true; pull.rebase = true; - alias.pfusch= "push --force-with-lease"; + alias.pfusch = "push --force-with-lease"; }; }; diff --git a/common/tooling/python.nix b/common/tooling/python.nix index 49e6a68..6c857a8 100644 --- a/common/tooling/python.nix +++ b/common/tooling/python.nix @@ -6,13 +6,16 @@ in config = with cfg; lib.mkIf (enable && tooling.enable) { environment.systemPackages = with pkgs; [ python3 - pypy3 ] ++ lib.optionals cfg.graphical [ jetbrains.pycharm-community ]; programs.xonsh = { enable = true; + config = '' + aliases[":q"] = "exit" + aliases["ls"] = "eza" + ''; package = pkgs.xonsh.override { extraPackages = ps: with ps; [ requests diff --git a/common/xdg/mime.nix b/common/xdg/mime.nix index 46d4193..7ed24ce 100644 --- a/common/xdg/mime.nix +++ b/common/xdg/mime.nix @@ -36,7 +36,7 @@ in { config = with cfg; lib.mkIf (enable && portals && graphical) { environment.systemPackages = with pkgs; [ - (callPackage ../../custom/deskwhich/package.nix { }) + deskwhich zathura alacritty diff --git a/flake.lock b/flake.lock index 4a97f7d..5820f65 100644 --- a/flake.lock +++ b/flake.lock @@ -285,11 +285,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1712014858, - "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", + "lastModified": 1714641030, + "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", + "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e", "type": "github" }, "original": { @@ -504,11 +504,11 @@ ] }, "locked": { - "lastModified": 1714303849, - "narHash": "sha256-o/IgiwA0ZS/nMh5YB0bt+ae3Lt+tlbQouY/xL7tB5h0=", + "lastModified": 1714872073, + "narHash": "sha256-Gybo6MqJ2tva9vMaSxOgie8uVObiP0LxD2FMokiR0X4=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "dbb96ae98e723128cf5a612480ba6187113f5e49", + "rev": "b85b9c3afa1bfee0150580eb76c52e572a85a6a9", "type": "github" }, "original": { @@ -563,11 +563,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1714635257, - "narHash": "sha256-4cPymbty65RvF1DWQfc+Bc8B233A1BWxJnNULJKQ1EY=", + "lastModified": 1714763106, + "narHash": "sha256-DrDHo74uTycfpAF+/qxZAMlP/Cpe04BVioJb6fdI0YY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "63c3a29ca82437c87573e4c6919b09a24ea61b0f", + "rev": "e9be42459999a253a9f92559b1f5b72e1b44c13d", "type": "github" }, "original": { @@ -579,20 +579,14 @@ }, "nixpkgs-lib": { "locked": { - "dir": "lib", - "lastModified": 1711703276, - "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", - "type": "github" + "lastModified": 1714640452, + "narHash": "sha256-QBx10+k6JWz6u7VsohfSw8g8hjdBZEf8CFzXH1/1Z94=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" }, "original": { - "dir": "lib", - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/50eb7ecf4cd0a5756d7275c8ba36790e5bd53e33.tar.gz" } }, "nixpkgs-stable": { diff --git a/flake.nix b/flake.nix index 67f18de..995dd31 100644 --- a/flake.nix +++ b/flake.nix @@ -39,11 +39,6 @@ url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/305278.patch"; hash = "sha256-8RvPI8Id+Ttgv07IMBTAxkSc+K00WhiWgdgrCcULd7o="; } - { - # cpupower meta.mainProgram - url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/308476.patch"; - hash = "sha256-J/Bvz4RUn9lP7H4s/c6bZEX9dfWsxfG/dpXYF99U3Vs="; - } { # xdg term url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/303225.patch"; @@ -57,22 +52,29 @@ inherit system; config.allowUnfree = true; }; - patched = let unpatched = nixpkgs.legacyPackages.${system}; in - unpatched.applyPatches { - name = "nixpkgs-patched"; - src = inputs.nixpkgs; - patches = map unpatched.fetchpatch patches; - }; + overlays = if (builtins.hasAttr "overlays" definitions) then definitions.overlays else [ ]; + unpatched = nixpkgs.legacyPackages.${system}; + patched = unpatched.applyPatches { + name = "nixpkgs-patched"; + src = inputs.nixpkgs; + patches = map unpatched.fetchpatch patches; + }; nixosSystem = import (patched + "/nixos/lib/eval-config.nix"); in nixosSystem ({ inherit system; + modules = definitions.modules ++ [ + ({ config, lib, ... }: { + nixpkgs.overlays = map (f: (final: prev: (import f { inherit final prev lib config; }))) overlays; + }) + ]; specialArgs = { inherit inputs system stable; }; - } // definitions); + } // builtins.removeAttrs definitions [ "overlays" "modules" ]); in { nixosConfigurations = { grimmauld-nixos = customNixosSystem "x86_64-linux" { + overlays = import ./overlays; modules = [ agenix.nixosModules.default chaotic.nixosModules.default diff --git a/modules/users.nix b/modules/users.nix index 7c29ea4..0120ef4 100644 --- a/modules/users.nix +++ b/modules/users.nix @@ -35,8 +35,7 @@ obs-studio element-desktop ghidra - rmview - arena + # rmview ]; }; } diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..5d32e4f --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,5 @@ +[ + ./deskwhich.nix + ./mcontrolcenter.nix + ./the-powder-toy.nix +] diff --git a/overlays/deskwhich.nix b/overlays/deskwhich.nix new file mode 100644 index 0000000..865e877 --- /dev/null +++ b/overlays/deskwhich.nix @@ -0,0 +1,3 @@ +{ final, prev, ... }: { + deskwhich = prev.callPackage ../custom/deskwhich/package.nix { }; +} diff --git a/overlays/mcontrolcenter.nix b/overlays/mcontrolcenter.nix new file mode 100644 index 0000000..9c18850 --- /dev/null +++ b/overlays/mcontrolcenter.nix @@ -0,0 +1,8 @@ +{ final, prev, ... }: { + mcontrolcenter = prev.callPackage + (prev.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixpkgs/2efffaa70e6de4cb34fd694798af5d433250f4e8/pkgs/by-name/mc/mcontrolcenter/package.nix"; + hash = "sha256-WnjSrSAurmN6dWOzjjZMXXxh0lUigyRPlXlg3OC0lu8="; + }) + { }; +} diff --git a/overlays/the-powder-toy.nix b/overlays/the-powder-toy.nix new file mode 100644 index 0000000..51f69ef --- /dev/null +++ b/overlays/the-powder-toy.nix @@ -0,0 +1,8 @@ +{ final, prev, ... }: { + the-powder-toy = prev.callPackage + (prev.fetchurl { + url = "https://raw.githubusercontent.com/NixOS/nixpkgs/9863d8c74a959d73df0c495a55097f804f7b379d/pkgs/by-name/th/the-powder-toy/package.nix"; + hash = "sha256-po6jhmdV+HNZBq4/vy6uQsDuW6PyvKcvysWNPZn4K7I="; + }) + { }; +} diff --git a/specific/grimm-nixos-laptop/hardware-configuration.nix b/specific/grimm-nixos-laptop/hardware-configuration.nix index f4d8688..604899e 100644 --- a/specific/grimm-nixos-laptop/hardware-configuration.nix +++ b/specific/grimm-nixos-laptop/hardware-configuration.nix @@ -40,12 +40,7 @@ in }; environment.systemPackages = with pkgs; [ - (callPackage - (fetchurl { - url = "https://raw.githubusercontent.com/NixOS/nixpkgs/2efffaa70e6de4cb34fd694798af5d433250f4e8/pkgs/by-name/mc/mcontrolcenter/package.nix"; - hash = "sha256-WnjSrSAurmN6dWOzjjZMXXxh0lUigyRPlXlg3OC0lu8="; - }) - { }) + mcontrolcenter ]; grimmShared = { diff --git a/sway/default.nix b/sway/default.nix index b6ff1c4..34cb246 100644 --- a/sway/default.nix +++ b/sway/default.nix @@ -1,8 +1,9 @@ { inputs, system, pkgs, config, lib, ... }: let - searchclip = pkgs.writeShellScriptBin "searchclip" '' - xdg-open https://www.google.com/search?q=$(wl-paste -p | urlencode) + searchclip = let inherit (lib) getExe; in with pkgs; writeShellScriptBin "searchclip" '' + xdg-open https://www.google.com/search?q=$(wl-paste -p | ${getExe urlencode}) browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//") + sleep .1 swaymsg [app_id="$browser" urgent="newest"] focus ''; in @@ -156,7 +157,7 @@ in let open = pkgs.writeShellScriptBin "open_or_switch_browser" '' browser=$(xdg-settings get default-web-browser | sed "s/\.desktop//") - swaymsg [app_id="$browser"] focus || deskwhich $browser | xargs gio launch + swaymsg [app_id="$browser"] focus || ${getExe deskwhich} $browser | xargs gio launch ''; in "exec ${getExe open}"; @@ -167,7 +168,7 @@ in while IFS= read -r pid; do swaymsg [pid=$pid] focus && exit 0 done <<< $(pgrep spotify -u "$(whoami)") - deskwhich spotify | xargs gio launch + ${getExe deskwhich} spotify | xargs gio launch ''; in "exec ${getExe open}"; # for some reason tools = audio media on my keyboard?? @@ -175,7 +176,7 @@ in let open = pkgs.writeShellScriptBin "open_or_switch_mail" '' desk=$(xdg-settings get default-url-scheme-handler mailto | sed "s/\.desktop//") - swaymsg [app_id="$desk"] focus || deskwhich $desk | xargs gio launch + swaymsg [app_id="$desk"] focus || ${getExe deskwhich} $desk | xargs gio launch ''; in "exec ${getExe open}";