diff --git a/flake.lock b/flake.lock index d798059..5f62b12 100644 --- a/flake.lock +++ b/flake.lock @@ -154,7 +154,7 @@ "type": "github" } }, - "nix-super": { + "nixSuper": { "inputs": { "flake-compat": "flake-compat", "libgit2": "libgit2", @@ -262,7 +262,7 @@ "homeManager": "homeManager", "hyprland": "hyprland", "hyprpicker": "hyprpicker", - "nix-super": "nix-super", + "nixSuper": "nixSuper", "nixpkgs": "nixpkgs_4", "themes": "themes", "tools": "tools" @@ -386,4 +386,4 @@ }, "root": "root", "version": 7 -} +} \ No newline at end of file diff --git a/flake.nix b/flake.nix index d4ac27f..e9f00b7 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,35 @@ { description = "All my NixOS configurations."; + # nixConfig = with builtins; mapAttrs (_: concatStringsSep " ") { + # extra-substituters = [ + # "https://nix-community.cachix.org/" + # "https://hyprland.cachix.org/" + # "https://cache.privatevoid.net/" + # ]; + + # extra-trusted-public-keys = [ + # "nix-community.cachix.org:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" + # "hyprland.cachix.org:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" + # "cache.privatevoid.net:SErQ8bvNWANeAvtsOESUwVYr2VJynfuc9JRwlzTTkVg=" + # ]; + # }; + + # inputs = with builtins; mapAttrs (name: url: { + # url = "git+https://${url}"; + # } // (if elem name [ "nixSuper" "hyprland" "hyprpicker" ] then {} else { + # inputs.nixpkgs.follows = "nixpkgs"; + # })) { + # nixSuper = "github.com/privatevoid-net/nix-super"; + # nixpkgs = "github.com/NixOS/nixpkgs/tree/nixos-unstable"; + # homeManager = "github.com/nix-community/home-manager"; + # hyprland = "github.com/hyprwm/Hyprland"; + # hyprpicker = "github.com/hyprwm/hyprpicker"; + # fenix = "github.com/nix-community/fenix"; + # tools = "github.com/RGBCube/FlakeTools"; + # themes = "github.com/RGBCube/ThemeNix"; + # }; + nixConfig = { extra-substituters = '' https://nix-community.cachix.org/ @@ -20,7 +49,7 @@ url = "github:NixOS/nixpkgs/nixos-unstable"; }; - nix-super = { + nixSuper = { url = "github:privatevoid-net/nix-super"; }; @@ -29,6 +58,19 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hyprland = { + url = "github:hyprwm/Hyprland"; + }; + + hyprpicker = { + url = "github:hyprwm/hyprpicker"; + }; + + fenix = { + url = "github:nix-community/fenix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + tools = { url = "github:RGBCube/FlakeTools"; inputs.nixpkgs.follows = "nixpkgs"; @@ -37,49 +79,23 @@ themes = { url = "github:RGBCube/ThemeNix"; }; - - fenix = { - url = "github:nix-community/fenix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - hyprland = { - url = "github:hyprwm/Hyprland"; - }; - - hyprpicker = { - url = "github:hyprwm/hyprpicker"; - }; }; - outputs = { nixpkgs, nix-super, homeManager, tools, themes, fenix, ... } @ inputs: tools.eachDefaultLinuxArch (system: let + outputs = inputs @ { + self, + nixSuper, + nixpkgs, + homeManager, + fenix, + tools, + themes, + ... + }: tools.eachDefaultLinuxArch (system: let pkgs = nixpkgs.legacyPackages.${system}; - upkgs = { - theme = themes.custom (themes.raw.gruvbox-dark-hard // { - corner-radius = 12; - border-width = 3; - - font.size.normal = 12; - font.size.big = 18; - - font.sans.name = "Lexend"; - font.sans.package = pkgs.lexend; - - font.mono.name = "RobotoMono Nerd Font"; - font.mono.package = (pkgs.nerdfonts.override { - fonts = [ - "RobotoMono" - ]; - }); - - icons.name = "Gruvbox-Plus-Dark"; - icons.package = pkgs.callPackage (import ./derivations/gruvbox-icons.nix) {}; - }); - - hyprland = inputs.hyprland.packages.${system}.default; - hyprpicker = inputs.hyprpicker.packages.${system}.default; - }; + upkgs = tools.recursiveUpdateMap (name: { + ${name} = inputs.${name}.packages.${system}.default; + }) [ "hyprland" "hyprpicker" ]; lib = nixpkgs.lib; @@ -89,18 +105,29 @@ recursiveUpdate3 = x: y: z: lib.recursiveUpdate x (lib.recursiveUpdate y z); }; + theme = themes.custom (themes.raw.gruvbox-dark-hard // { + corner-radius = 12; + border-width = 3; + + font.size.normal = 12; + font.size.big = 18; + + font.sans.name = "Lexend"; + font.sans.package = pkgs.lexend; + + font.mono.name = "RobotoMono Nerd Font"; + font.mono.package = (pkgs.nerdfonts.override { fonts = [ "RobotoMono" ]; }); + + icons.name = "Gruvbox-Plus-Dark"; + icons.package = pkgs.callPackage (import ./derivations/gruvbox-icons.nix) {}; + }); + abstractions = rec { - importAll = paths: { - imports = paths; - }; + imports = paths: lib.genAttrs [ "imports" ] (_: paths); - enabled = attributes: attributes // { - enable = true; - }; + enabled = attributes: attributes // { enable = true; }; - normalUser = attributes: attributes // { - isNormalUser = true; - }; + normalUser = attributes: attributes // { isNormalUser = true; }; systemConfiguration = attributes: attributes; @@ -113,9 +140,9 @@ }; homeConfiguration = user: attributes: systemConfiguration { - home-manager.users = builtins.foldl' lib.recursiveUpdate {} (builtins.map (user: { + home-manager.users = tools.recursiveUpdateMap (user: { ${user} = attributes; - }) (if builtins.isList user then user else [ user ])); + }) (if builtins.isList user then user else [ user ]); }; homePackages = user: packages: homeConfiguration user { @@ -131,25 +158,25 @@ persistent = true; }; - nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; - nix.registry.nixpkgs.flake = nixpkgs; - nix.optimise.automatic = true; - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; + nix.nixPath = [ "nixpkgs=${nixpkgs}" ]; - nix.settings.trusted-users = [ - "root" - "@wheel" - ]; + nix.registry = { + nixpkgs.flake = nixpkgs; + default.flake = nixpkgs; + }; + + nix.settings.experimental-features = [ "nix-command" "flakes" ]; + + nix.settings.trusted-users = [ "root" "@wheel" ]; + + nix.settings.warn-dirty = false; nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ fenix.overlays.default - nix-super.overlays.default + nixSuper.overlays.default ]; programs.nix-ld = enabled {}; @@ -159,12 +186,13 @@ boot.tmp.cleanOnBoot = true; networking.hostName = host; + home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; }; specialArgs = abstractions // { - inherit upkgs ulib; + inherit upkgs ulib theme; }; importConfigurations = tools.recursiveUpdateMap (host: { diff --git a/machines/enka/bat/default.nix b/machines/enka/bat/default.nix index 4be36cd..3d342aa 100644 --- a/machines/enka/bat/default.nix +++ b/machines/enka/bat/default.nix @@ -1,4 +1,4 @@ -{ upkgs, homeConfiguration, enabled, ... }: +{ theme, homeConfiguration, enabled, ... }: homeConfiguration [ "nixos" "root" ] { programs.nushell.environmentVariables = { @@ -11,8 +11,8 @@ homeConfiguration [ "nixos" "root" ] { less = "bat --plain"; }; - programs.bat = with upkgs.theme; enabled { + programs.bat = enabled { config.theme = "default"; - themes.default = tmTheme; + themes.default = theme.tmTheme; }; } diff --git a/machines/enka/default.nix b/machines/enka/default.nix index 40585d3..19e579e 100644 --- a/machines/enka/default.nix +++ b/machines/enka/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ulib, systemConfiguration, homeConfiguration, importAll, ... }: ulib.recursiveUpdate3 +{ pkgs, ulib, systemConfiguration, homeConfiguration, imports, ... }: ulib.recursiveUpdate3 (systemConfiguration { boot.kernelPackages = pkgs.linuxPackages_latest; @@ -15,7 +15,7 @@ home.stateVersion = "23.05"; }) -(importAll [ +(imports [ ./bat ./blueman ./discord diff --git a/machines/enka/discord/default.nix b/machines/enka/discord/default.nix index ca5b6fe..64ebb90 100644 --- a/machines/enka/discord/default.nix +++ b/machines/enka/discord/default.nix @@ -1,7 +1,7 @@ -{ lib, pkgs, upkgs, homeConfiguration, homePackages, ... }: lib.recursiveUpdate +{ lib, pkgs, theme, homeConfiguration, homePackages, ... }: lib.recursiveUpdate (homeConfiguration "nixos" { - xdg.configFile."Vencord/settings/quickCss.css".text = upkgs.theme.discordCss; + xdg.configFile."Vencord/settings/quickCss.css".text = theme.discordCss; }) (with pkgs; homePackages "nixos" [ diff --git a/machines/enka/dunst/default.nix b/machines/enka/dunst/default.nix index c43d72a..e33733f 100644 --- a/machines/enka/dunst/default.nix +++ b/machines/enka/dunst/default.nix @@ -1,7 +1,7 @@ -{ upkgs, homeConfiguration, enabled, ... }: +{ theme, homeConfiguration, enabled, ... }: homeConfiguration "nixos" { - services.dunst = with upkgs.theme.withHashtag; enabled { + services.dunst = with theme.withHashtag; enabled { iconTheme = icons; settings.global = { diff --git a/machines/enka/fonts.nix b/machines/enka/fonts.nix index e65871d..bf678de 100644 --- a/machines/enka/fonts.nix +++ b/machines/enka/fonts.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, upkgs, systemConfiguration, systemFonts, ... }: lib.recursiveUpdate +{ lib, pkgs, theme, systemConfiguration, systemFonts, ... }: lib.recursiveUpdate (systemConfiguration { console = { @@ -11,8 +11,8 @@ }) (with pkgs; systemFonts [ - upkgs.theme.font.sans.package - upkgs.theme.font.mono.package + theme.font.sans.package + theme.font.mono.package noto-fonts noto-fonts-cjk-sans diff --git a/machines/enka/fuzzel/default.nix b/machines/enka/fuzzel/default.nix index e14c7ec..191fe24 100644 --- a/machines/enka/fuzzel/default.nix +++ b/machines/enka/fuzzel/default.nix @@ -1,7 +1,7 @@ -{ upkgs, homeConfiguration, enabled, ... }: +{ theme, homeConfiguration, enabled, ... }: homeConfiguration "nixos" { - programs.fuzzel = with upkgs.theme; enabled { + programs.fuzzel = with theme; enabled { settings.main = { dpi-aware = false; font = "${font.sans.name}:size=${toString font.size.big}"; diff --git a/machines/enka/gtk/default.nix b/machines/enka/gtk/default.nix index 2345ed5..b4ce73e 100644 --- a/machines/enka/gtk/default.nix +++ b/machines/enka/gtk/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, upkgs, systemConfiguration, homeConfiguration, enabled, ... }: lib.recursiveUpdate +{ lib, pkgs, theme, systemConfiguration, homeConfiguration, enabled, ... }: lib.recursiveUpdate (systemConfiguration { programs.dconf = enabled {}; @@ -6,16 +6,16 @@ (homeConfiguration "nixos" { gtk = enabled { - gtk3.extraCss = upkgs.theme.adwaitaGtkCss; - gtk4.extraCss = upkgs.theme.adwaitaGtkCss; + gtk3.extraCss = theme.adwaitaGtkCss; + gtk4.extraCss = theme.adwaitaGtkCss; - font = with upkgs.theme.font; { + font = with theme.font; { inherit (sans) name package; size = size.normal; }; - iconTheme = upkgs.theme.icons; + iconTheme = theme.icons; theme = { name = "Adwaita-dark"; diff --git a/machines/enka/hyprland/default.nix b/machines/enka/hyprland/default.nix index be7bd02..ba66785 100644 --- a/machines/enka/hyprland/default.nix +++ b/machines/enka/hyprland/default.nix @@ -1,4 +1,4 @@ -{ pkgs, upkgs, ulib, systemConfiguration, homeConfiguration, homePackages, enabled, ... }: ulib.recursiveUpdate3 +{ pkgs, upkgs, ulib, theme, systemConfiguration, homeConfiguration, homePackages, enabled, ... }: ulib.recursiveUpdate3 (systemConfiguration { hardware.opengl = enabled {}; @@ -11,7 +11,7 @@ }) (homeConfiguration "nixos" { - wayland.windowManager.hyprland = with upkgs.theme; enabled { + wayland.windowManager.hyprland = with theme; enabled { package = upkgs.hyprland; extraConfig = diff --git a/machines/enka/kitty/default.nix b/machines/enka/kitty/default.nix index a71b88e..3e6169b 100644 --- a/machines/enka/kitty/default.nix +++ b/machines/enka/kitty/default.nix @@ -1,7 +1,7 @@ -{ upkgs, homeConfiguration, enabled, ... }: +{ theme, homeConfiguration, enabled, ... }: homeConfiguration "nixos" { - programs.kitty = with upkgs.theme.withHashtag; enabled { + programs.kitty = with theme.withHashtag; enabled { font = with font; { inherit (mono) name package; diff --git a/machines/enka/waybar/default.nix b/machines/enka/waybar/default.nix index 27181f2..52fcd0e 100644 --- a/machines/enka/waybar/default.nix +++ b/machines/enka/waybar/default.nix @@ -1,7 +1,7 @@ -{ upkgs, homeConfiguration, enabled, ... }: +{ theme, homeConfiguration, enabled, ... }: homeConfiguration "nixos" { - programs.waybar = with upkgs.theme.withHashtag; enabled { + programs.waybar = with theme.withHashtag; enabled { systemd = enabled {}; settings = [{