From 60a15031a920b8083ad8f327f14bfcd16bd40bf1 Mon Sep 17 00:00:00 2001 From: atagen Date: Sun, 21 May 2023 01:34:21 +1000 Subject: [PATCH] nix-rice, slightly scuffed --- flake.lock | 46 ++++++------------ flake.nix | 51 ++++++++------------ home/home.nix | 98 +++++++++++++++++++++----------------- overlay.nix | 5 +- pkgs/gruvbox-gtk-theme.nix | 35 ++++++++++++++ pkgs/gruvbox-kvantum.nix | 22 +++++++++ pkgs/rose-pine-theme.nix | 35 ++++++++++++++ rice.nix | 86 +++++++++++++++++++++++++++++++++ system/configuration.nix | 13 ++--- 9 files changed, 275 insertions(+), 116 deletions(-) create mode 100644 pkgs/gruvbox-gtk-theme.nix create mode 100644 pkgs/gruvbox-kvantum.nix create mode 100644 pkgs/rose-pine-theme.nix create mode 100644 rice.nix diff --git a/flake.lock b/flake.lock index 88cde32..e89031e 100644 --- a/flake.lock +++ b/flake.lock @@ -17,21 +17,6 @@ "type": "github" } }, - "declarative-cachix": { - "locked": { - "lastModified": 1670437766, - "narHash": "sha256-OINAikZrqLN0MsTAP4tNHoezXjIOZ/tkbu/C/KCEgmU=", - "owner": "jonascarpay", - "repo": "declarative-cachix", - "rev": "abe4d70e5d9a225a7ecf98086b089cc04202f2e3", - "type": "github" - }, - "original": { - "owner": "jonascarpay", - "repo": "declarative-cachix", - "type": "github" - } - }, "dream2nix": { "inputs": { "all-cabal-json": [ @@ -334,11 +319,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1684456775, - "narHash": "sha256-fjrP6+fZqBmAx8+ASDNkVf0ES5hIFQitEwPo+qQz4JI=", + "lastModified": 1684543135, + "narHash": "sha256-MQCw6PDfUO5s9z6i2QvPZ7ePXsycQFBjISUsT+leThY=", "owner": "helix-editor", "repo": "helix", - "rev": "53f47bc47771c94dab51626ca025be28e62eba0c", + "rev": "d3cca0f3571fd30f4d7067a82c02753686297a67", "type": "github" }, "original": { @@ -354,11 +339,11 @@ ] }, "locked": { - "lastModified": 1684442239, - "narHash": "sha256-8wD+fQpNULCF9a88E1Knw3MtXWqvyhn8u/859QSSoE4=", + "lastModified": 1684484967, + "narHash": "sha256-P3ftCqeJmDYS9LSr2gGC4XGGcp5vv8TOasJX6fVHWsw=", "owner": "nix-community", "repo": "home-manager", - "rev": "c10403a5739d6275334710903fe709bc8d587980", + "rev": "b9a52ad20e58ebd003444915e35e3dd2c18fc715", "type": "github" }, "original": { @@ -571,11 +556,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1684385584, - "narHash": "sha256-O7y0gK8OLIDqz+LaHJJyeu09IGiXlZIS3+JgEzGmmJA=", + "lastModified": 1684570954, + "narHash": "sha256-FX5y4Sm87RWwfu9PI71XFvuRpZLowh00FQpIJ1WfXqE=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "48a0fb7aab511df92a17cf239c37f2bd2ec9ae3a", + "rev": "3005f20ce0aaa58169cdee57c8aa12e5f1b6e1b3", "type": "github" }, "original": { @@ -587,11 +572,11 @@ }, "nur": { "locked": { - "lastModified": 1684469276, - "narHash": "sha256-AgJ0m3gAv1QvjpY1Euu9gb/btz8+8Jg71GFpjpWdclc=", + "lastModified": 1684585623, + "narHash": "sha256-28XEOYjrpzlVDt11Elz7db8R3HwY/4B6EspFscSRsfk=", "owner": "nix-community", "repo": "NUR", - "rev": "868fce50c669080c90cbf5d467a3a405df55552a", + "rev": "4e959da0346280293e4008150d48b82fe055a311", "type": "github" }, "original": { @@ -649,7 +634,6 @@ }, "root": { "inputs": { - "declarative-cachix": "declarative-cachix", "eww": "eww", "flake-parts": "flake-parts", "flake-utils": "flake-utils", @@ -694,11 +678,11 @@ ] }, "locked": { - "lastModified": 1684462813, - "narHash": "sha256-YFphDnxzXtLLExXjiR9bUVF4isI/MKiC4HMboh2ZSOc=", + "lastModified": 1684549120, + "narHash": "sha256-YlsvaWQtRui3OI9EAm4upXIxI4f0TYiv08TBN+WeFm8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "e2ceeaa7f9334c5d732323b6fec363229da4f382", + "rev": "f7c0c7f4b0780f977808de0bc0475ab044d3fd08", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 824a99f..d9b12d4 100644 --- a/flake.nix +++ b/flake.nix @@ -38,8 +38,7 @@ hyprland.url = "github:hyprwm/Hyprland"; - declarative-cachix.url = "github:jonascarpay/declarative-cachix"; - + # declarative-cachix.url = "github:jonascarpay/declarative-cachix"; nix-rice.url = "github:bertof/nix-rice"; }; @@ -60,12 +59,12 @@ ]; in rec { # custom packages - packages = forAllSystems ( - system: let - pkgs = nixpkgs.legacyPackages.${system}; - in - import ./pkgs {inherit pkgs;} - ); + # packages = forAllSystems ( + # system: let + # pkgs = nixpkgs.legacyPackages.${system}; + # in + # import ./pkgs {inherit pkgs;} + # ); # homepkgs = forAllSystems (system: # let pkgs = nixpkgs.legacyPackages.${system}; @@ -73,10 +72,7 @@ # ); # any overlays or modules we use - overlays = [ - nix-rice.overlays.default - (import ./overlay.nix {inherit inputs;}) - ]; + overlays = import ./overlay.nix {inherit inputs;}; # nixosModules = import ./modules/nixos; # homeModules = import ./modules/home; @@ -88,6 +84,12 @@ modules = [ ./system/quiver.nix nur.nixosModules.nur + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.extraSpecialArgs = { inherit inputs outputs; }; + home-manager.users.bolt.imports = [ ./home/bolt.nix ]; + } ]; }; @@ -98,28 +100,15 @@ modules = [ ./system/adrift.nix nur.nixosModules.nur + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.extraSpecialArgs = { inherit inputs outputs; }; + home-manager.users.plank.imports = [ ./home/plank.nix ]; + } ]; }; }; - homeConfigurations = { - "bolt@quiver" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/bolt.nix - nur.hmModules.nur - ]; - }; - - "plank@adrift" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ - ./home/plank.nix - nur.hmModules.nur - ]; - }; - }; }; } diff --git a/home/home.nix b/home/home.nix index d848452..4704747 100644 --- a/home/home.nix +++ b/home/home.nix @@ -6,7 +6,8 @@ pkgs, nur, ... -}: +}: let + palette-hex = pkgs.lib.nix-rice.palette.toRgbHex pkgs.rice.palette; in { imports = [ inputs.hyprland.homeManagerModules.default @@ -77,7 +78,7 @@ in { hidpi = false; }; recommendedEnvironment = true; - extraConfig = with pkgs.rice; builtins.replaceStrings + extraConfig = with pkgs.rice; (builtins.replaceStrings ["#BGIMAGE" "#GTKTHEME" "#FONT" @@ -86,17 +87,17 @@ in { "#BORDER"] ["${bg.image}" gtk.name - fonts.sansSerif.name + fonts.sans.name icons.name - palette.util.fg - palette.util.bg] - (builtins.readFile dots/hyprland/hyprland.conf); + palette-hex.util.fg + palette-hex.util.bg] + (builtins.readFile dots/hyprland/hyprland.conf)); }; programs.eww-hyprland = { enable = true; - colors = with pkgs.rice.palette; + colors = with palette-hex; (builtins.replaceStrings ["BLACK" "BLCKA" @@ -159,25 +160,28 @@ in { { "swaync/config.json" = dots/swaync/config.json; "swaync/configSchema.json" = dots/swaync/configSchema.json; - "swaync/style.css" = with rice.palette; builtins.replaceStrings - ["PANELBG" - "BORDER" - "NOTIBGNORM" - "NOTIBGHOVER" - "NOTIBGFOCUS" - "NOTIBGCLOSE" - "NOTIBGHOVERCLOSE" - "BGSELECTED"] - [util.bg - normal.black - util.bg - bright.black - bright.black - normal.black - bright.black - bright.black] - (builtins.readFile dots/swaync/style.css); + } // {"swaync/style.css" = { + enable = true; + text = with palette-hex; (builtins.replaceStrings + ["PANELBG" + "BORDER" + "NOTIBGNORM" + "NOTIBGHOVER" + "NOTIBGFOCUS" + "NOTIBGCLOSE" + "NOTIBGHOVERCLOSE" + "BGSELECTED"] + [util.bg + normal.black + util.bg + bright.black + bright.black + normal.black + bright.black + bright.black] + (builtins.readFile dots/swaync/style.css)); }; + }; xdg.systemDirs.data = [ "${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}" @@ -185,12 +189,12 @@ in { ]; home.sessionVariables = { - GTK_THEME = rice.gtk.name; + GTK_THEME = pkgs.rice.gtk.name; }; programs.wlogout = { enable = true; - layout = builtins.fromJSON (builtins.readFile dots/wlogout/layout); - style = with rice.palette; builtins.replaceStrings + layout = (builtins.fromJSON (builtins.readFile dots/wlogout/layout)); + style = with palette-hex; (builtins.replaceStrings ["/usr/share/wlogout" "/etc/wlogout" "WINBG" @@ -203,7 +207,7 @@ in { util.fg util.bg_sel normal.yellow] - (builtins.readFile dots/wlogout/style.css); + (builtins.readFile dots/wlogout/style.css)); }; programs.fuzzel = with pkgs.rice; { @@ -211,7 +215,7 @@ in { settings = { main = { dpi-aware = "no"; - font = with fonts.sansSerif; lib.strings.concatStrings [name ":size=" size]; + font = with fonts.sans; lib.strings.concatStrings [name ":size=" (builtins.toString size)]; icon-theme = icons.name; terminal = "kitty"; }; @@ -223,21 +227,27 @@ in { radius = rounding; }; colors = { - background = lib.strings.concatStrings [pkgs.rice.palette.util.bg "FF"]; - text = lib.strings.concatStrings [pkgs.rice.palette.util.fg "FF"]; - selection = lib.strings.concatStrings [pkgs.rice.palette.util.bg_sel "FF"]; - selection-text = lib.strings.concatStrings [pkgs.rice.palette.util.fg_sel "FF"]; - selection-match = lib.strings.concatStrings [pkgs.rice.palette.util.cursor_text "FF"]; - match = lib.strings.concatStrings [pkgs.rice.palette.util "FF"]; - border = lib.strings.concatStrings [pkgs.rice.palette.util.bg_sel "FF"]; + background = lib.strings.concatStrings [palette-hex.util.bg "FF"]; + text = lib.strings.concatStrings [palette-hex.util.fg "FF"]; + selection = lib.strings.concatStrings [palette-hex.util.bg_sel "FF"]; + selection-text = lib.strings.concatStrings [palette-hex.util.fg_sel "FF"]; + selection-match = lib.strings.concatStrings [palette-hex.util.cursor "FF"]; + match = lib.strings.concatStrings [palette-hex.util.fg_sel "FF"]; + border = lib.strings.concatStrings [palette-hex.util.bg_sel "FF"]; }; }; }; gtk = { enable = true; - theme = rice.gtk; - iconTheme = rice.icons; + theme = with pkgs.rice.gtk; { + package = package; + name = name; + }; + iconTheme = with pkgs.rice.icons; { + package = package; + name = name; + }; }; programs.direnv = { @@ -275,17 +285,17 @@ in { }; }; - programs.kitty = with rice; { + programs.kitty = with pkgs.rice; { enable = true; font = with fonts; { name = monospace.name; size = monospace.size; }; - settings = with palette; { + settings = with palette-hex; { foreground = util.fg; background = util.bg; cursor = util.cursor; - cursor_text = util.cursor_text; + cursor_text = util.bg; selection_foreground = util.fg_sel; selection_background = util.bg_sel; color0 = normal.black; @@ -319,10 +329,10 @@ in { programs.fzf = { enable = true; enableZshIntegration = true; - colors = with rice.palette; { + colors = with palette-hex; { fg = util.fg; bg = util.bg; - hl = util.cursor_text; + hl = util.bg_sel; "fg+" = util.fg_sel; "bg+" = util.bg_sel; "hl+" = bright.green; diff --git a/overlay.nix b/overlay.nix index 2536d3e..667b682 100644 --- a/overlay.nix +++ b/overlay.nix @@ -6,8 +6,5 @@ config.allowUnfree = true; }; }; + rice = import ./rice.nix; } -# inputs: _: prev: { -# system76-scheduler = prev.callPackage ./syspkgs/system76-scheduler.nix {}; -# } - diff --git a/pkgs/gruvbox-gtk-theme.nix b/pkgs/gruvbox-gtk-theme.nix new file mode 100644 index 0000000..759d755 --- /dev/null +++ b/pkgs/gruvbox-gtk-theme.nix @@ -0,0 +1,35 @@ +{ + stdenv, + fetchFromGitHub, + lib, + gnome-themes-extra, + gtk-engine-murrine, + gtk_engines, +}: +stdenv.mkDerivation rec { + pname = "gruvbox-gtk-theme"; + version = "unstable-2023-05-20"; + + src = fetchFromGitHub { + owner = "Fausto-Korpsvart"; + repo = "Gruvbox-GTK-Theme"; + rev = "5927e8693a70619b45fbe3317c59f04f6e101943"; + sha256 = lib.fakeSha256; + }; + + buildInputs = [ + gnome-themes-extra # adwaita engine for Gtk2 + gtk_engines # pixmap engine for Gtk2 + ]; + + propagatedUserEnvPkgs = [ + gtk-engine-murrine # murrine engine for Gtk2 + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/themes + cp -a themes/Grubvox-Dark-B $out/share/themes/Gruvbox-Dark + runHook postInstall + ''; +} diff --git a/pkgs/gruvbox-kvantum.nix b/pkgs/gruvbox-kvantum.nix new file mode 100644 index 0000000..3f73ec0 --- /dev/null +++ b/pkgs/gruvbox-kvantum.nix @@ -0,0 +1,22 @@ +{ + stdenv, + fetchFromGitHub, + lib, +}: +stdenv.mkDerivation rec { + pname = "gruvbox-kvantum"; + version = "unstable-2023-02-06"; + + src = fetchFromGitHub { + owner = "thefallnn"; + repo = "Gruvbox-Kvantum"; + rev = "b04c6b67a4228c2b980821a0f0531bfe122c4aac"; + sha256 = lib.fakeSha256; + }; + + installPhase = '' + runHook preInstall + cp -a gruvbox-kvantum/ $out/ + runHook postInstall + ''; +} diff --git a/pkgs/rose-pine-theme.nix b/pkgs/rose-pine-theme.nix new file mode 100644 index 0000000..9dcc6cf --- /dev/null +++ b/pkgs/rose-pine-theme.nix @@ -0,0 +1,35 @@ +{ + stdenv, + fetchFromGitHub, + lib, + gnome-themes-extra, + gtk-engine-murrine, + gtk_engines, +}: +stdenv.mkDerivation rec { + pname = "gruvbox-gtk-theme"; + version = "unstable-2023-05-20"; + + src = fetchFromGitHub { + owner = "Fausto-Korpsvart"; + repo = "Gruvbox-GTK-Theme"; + rev = "5927e8693a70619b45fbe3317c59f04f6e101943"; + sha256 = lib.fakeSha256; + }; + + buildInputs = [ + gnome-themes-extra # adwaita engine for Gtk2 + gtk_engines # pixmap engine for Gtk2 + ]; + + propagatedUserEnvPkgs = [ + gtk-engine-murrine # murrine engine for Gtk2 + ]; + + installPhase = '' + runHook preInstall + mkdir -p $out/share/themes + cp -a themes/Grubvox-Dark-B $out/share/themes + runHook postInstall + ''; +} diff --git a/rice.nix b/rice.nix new file mode 100644 index 0000000..8bca559 --- /dev/null +++ b/rice.nix @@ -0,0 +1,86 @@ +self: super: let + theme = super.lib.nix-rice.kitty-themes.getThemeByName "GruvboxMaterialDarkMedium"; +in rec { + rice = { + palette = with super.lib.nix-rice; rec { + normal = palette.defaultPalette // { + black = theme.color0; + red = theme.color1; + green = theme.color2; + yellow = theme.color3; + blue = theme.color4; + magenta = theme.color5; + cyan = theme.color6; + white = theme.color7; + }; + bright = palette.defaultPalette // { + black = theme.color8; + red = theme.color9; + green = theme.color10; + yellow = theme.color11; + blue = theme.color12; + magenta = theme.color13; + cyan = theme.color14; + white = theme.color15; + }; + util = palette.defaultPalette // { + fg = theme.foreground; + bg = theme.background; + fg_sel = theme.selection_foreground; + bg_sel = theme.selection_background; + cursor = theme.cursor; + # cursor_text = theme.cursor_text_color; + # url = theme.url_color; + }; + } // theme; + + fonts = { + sans = { + name = "Inria Sans"; + size = 12; + package = self.inriafonts; + }; + serif = { + name = "Inria Serif"; + size = 12; + package = self.inriafonts; + }; + monospace = { + name = "Fira Code"; + size = 10; + package = self.fira-code; + }; + emoji = { + name = "Twitter Color Emoji"; + size = 12; + package = self.twemoji-color-font; + }; + }; + + icons = { + name = "Papirus-Dark"; + package = self.papirus-icon-theme; + }; + + gtk = { + package = self.gruvbox-gtk-theme; + name = "Gruvbox-Dark"; + }; + + kvantum = { + package = self.gruvbox-kvantum; + }; + + borders = { + thickness = 3; + rounding = 8; + }; + + bg = { + image = super.fetchurl { + sha256 = "sha256-6BCoxgqK5pCxv5P7Rf5MoyLbHAShRd3YuacAcZ916C8="; + url = "https://gruvbox-wallpapers.pages.dev/wallpapers/irl/flowers-2.jpg"; + }; + }; + }; # /rice +} diff --git a/system/configuration.nix b/system/configuration.nix index f872348..121c5ae 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -9,10 +9,11 @@ }: { nixpkgs = { overlays = [ + inputs.nur.overlay outputs.overlays.additions outputs.overlays.unstable-pkgs - inputs.nur.overlay - nix-rice.overlays.default + inputs.nix-rice.overlays.default + outputs.overlays.rice ]; config = { allowUnfree = true; @@ -28,7 +29,7 @@ }; imports = [ - inputs.declarative-cachix.nixosModules.declarative-cachix + # inputs.declarative-cachix.nixosModules.declarative-cachix # inputs.helix ]; @@ -65,9 +66,9 @@ # }; # }; - cachix = [ - "nix-community" - ]; + # cachix = [ + # "nix-community" + # ]; nix.extraOptions = '' keep-outputs = true