From a2d8d6b460bb6c53cb09ce645fd041c0c308c0c8 Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Wed, 7 Feb 2024 12:03:02 +0100 Subject: [PATCH] treewide: remove runtime fetch operations (#224) Fixes #222 --- flake.lock | 18 ++++++++ flake.nix | 92 ++++++++++++++++++++++---------------- modules/gnome/theme.nix | 12 +---- modules/plymouth/nixos.nix | 4 ++ stylix/templates.nix | 1 + 5 files changed, 79 insertions(+), 48 deletions(-) diff --git a/flake.lock b/flake.lock index 32b27ee..4154f61 100644 --- a/flake.lock +++ b/flake.lock @@ -179,6 +179,23 @@ "type": "github" } }, + "gnome-shell": { + "flake": false, + "locked": { + "lastModified": 1698794309, + "narHash": "sha256-/TIkZ8y5Wv3QHLFp79Poao9fINurKs5pa4z0CRe+F8s=", + "owner": "GNOME", + "repo": "gnome-shell", + "rev": "a7c169c6c29cf02a4c392fa0acbbc5f5072823e7", + "type": "github" + }, + "original": { + "owner": "GNOME", + "ref": "45.1", + "repo": "gnome-shell", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -227,6 +244,7 @@ "base16-tmux": "base16-tmux", "base16-vim": "base16-vim", "flake-compat": "flake-compat", + "gnome-shell": "gnome-shell", "home-manager": "home-manager", "nixpkgs": "nixpkgs" } diff --git a/flake.nix b/flake.nix index 3365199..8e21285 100644 --- a/flake.nix +++ b/flake.nix @@ -1,52 +1,68 @@ { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + base16-alacritty = { + flake = false; + url = "github:aarowill/base16-alacritty"; + }; + + base16-alacritty-yaml = { + flake = false; + url = "github:aarowill/base16-alacritty/63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7"; + }; + + base16-fish = { + flake = false; + url = "github:tomyun/base16-fish"; + }; + + base16-foot = { + flake = false; + url = "github:tinted-theming/base16-foot"; + }; + + base16-helix = { + flake = false; + url = "github:tinted-theming/base16-helix"; + }; + + base16-tmux = { + flake = false; + url = "github:tinted-theming/base16-tmux"; + }; + + base16-kitty = { + flake = false; + url = "github:kdrag0n/base16-kitty"; + }; + + base16-vim = { + flake = false; + url = "github:chriskempson/base16-vim"; + }; + base16.url = "github:SenchoPens/base16.nix"; - # Used for documentation - home-manager = { - url = "github:nix-community/home-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - flake-compat = { - url = "github:edolstra/flake-compat"; flake = false; + url = "github:edolstra/flake-compat"; }; - # Templates - base16-alacritty = { - url = "github:aarowill/base16-alacritty"; + gnome-shell = { flake = false; + + # TODO: Unlocking the input and pointing to official repository requires + # updating the patch: + # https://github.com/danth/stylix/pull/224#discussion_r1460339607. + url = "github:GNOME/gnome-shell/45.1"; }; - base16-alacritty-yaml = { - url = "github:aarowill/base16-alacritty/63d8ae5dfefe5db825dd4c699d0cdc2fc2c3eaf7"; - flake = false; - }; - base16-fish = { - url = "github:tomyun/base16-fish"; - flake = false; - }; - base16-foot = { - url = "github:tinted-theming/base16-foot"; - flake = false; - }; - base16-helix = { - url = "github:tinted-theming/base16-helix"; - flake = false; - }; - base16-kitty = { - url = "github:kdrag0n/base16-kitty"; - flake = false; - }; - base16-tmux = { - url = "github:tinted-theming/base16-tmux"; - flake = false; - }; - base16-vim = { - url = "github:chriskempson/base16-vim"; - flake = false; + + # The 'home-manager' input is used to generate the documentation. + home-manager = { + inputs.nixpkgs.follows = "nixpkgs"; + url = "github:nix-community/home-manager"; }; + + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = diff --git a/modules/gnome/theme.nix b/modules/gnome/theme.nix index 26461c2..9d9bc4a 100644 --- a/modules/gnome/theme.nix +++ b/modules/gnome/theme.nix @@ -1,4 +1,4 @@ -{ pkgs, config, ... }: +{ config, pkgs, ... }: let colors = config.lib.stylix.colors { @@ -8,15 +8,7 @@ let in pkgs.stdenv.mkDerivation { name = "${config.lib.stylix.colors.slug}-gnome-shell-theme"; - - src = pkgs.fetchFromGitLab { - domain = "gitlab.gnome.org"; - owner = "GNOME"; - repo = "gnome-shell"; - rev = "45.1"; - sha256 = "/TIkZ8y5Wv3QHLFp79Poao9fINurKs5pa4z0CRe+F8s="; - }; - + src = config.lib.stylix.templates.gnome-shell; patches = [ ./shell_colors.patch ]; postPatch = '' rm data/theme/gnome-shell-sass/{_colors.scss,_palette.scss} diff --git a/modules/plymouth/nixos.nix b/modules/plymouth/nixos.nix index 3abd8be..e9a83be 100644 --- a/modules/plymouth/nixos.nix +++ b/modules/plymouth/nixos.nix @@ -59,6 +59,10 @@ in { description = mdDoc "Logo to be used on the boot screen."; type = with types; either path package; defaultText = literalMD "NixOS logo"; + + # Considering that Flake inputs are currently unable to fetch individual + # files, the SVG file is fetched with `pkgs.fetchurl` to avoid downloading + # the entire repository for a single SVG file. default = pkgs.fetchurl { url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake.svg"; # Reduce size diff --git a/stylix/templates.nix b/stylix/templates.nix index 790aef8..65b5466 100644 --- a/stylix/templates.nix +++ b/stylix/templates.nix @@ -10,6 +10,7 @@ inputs: base16-kitty base16-tmux base16-vim + gnome-shell ; }; }