chore: rework how hashes work to fix packages

This commit is contained in:
Malte Tammena 2023-10-30 14:33:03 +01:00
parent 518513e354
commit 1ee4ea8d47
12 changed files with 116 additions and 114 deletions

38
hashes.nix Normal file
View file

@ -0,0 +1,38 @@
{
timewarrior = {
version = "v1.4.3";
hash = "sha256-+HsUiU287bWZ5Ytl+N5i+STuG9YlqlaKWxd69y0PRds=";
};
"2i-emulator" = {
rev = "dbd022b";
hash = "sha256-zQdnDZwFd7KkSoLyu3Ty/YDn7qosTIf2n02PHitGf2g=";
"rustyline-1.0.0" = "sha256-FFuhLmBwt5e/zOJfkz4NCuI8lG/sBhGOcxst8d+oOVk=";
};
darkman = {
rev = "b4c9bbc";
hash = "sha256-/r3mcwkdFyZQZV3jRJQladujBFvBmm8XhncbePTFlLA=";
vendorSha256 = "sha256-CGgWEaHztWeCQPIrobwLHuDkFauJM19hBU7JsA3HMic=";
};
boilr = {
version = "1.9.1";
hash = "sha256-mdkRuEzfWhdbX0DD6uwc1o8kXjqk1Y0+FFKHrM2m81w=";
cargoHash = "sha256-5nhtGqukZ8tp7gPV+JiUEHTzWUj6JtsB2i7bODcXJSc=";
};
hack = {
version = "v3.003+Nerdv2.1+FC3.1+JBMv2.242";
hash = "sha256-nCOH+48w7nEm7mXXPCsDuaRlId2hNyYdV01IbVNWuME=";
};
pexel-bg.hash = "sha256-Su2UwFpZKj5sa80UrcDSX9O2GuVI6XR2gSLpp4gJZP0=";
REpo-AiO = {
rev = "c88a6de";
hash = "sha256-3FeMPAMXvVwbQXmjz6HYo5QAbrI4x3mkVNTLIco56K4=";
};
rtlGroupPlugin = {
hash = "sha256-tknTHae9dRQ1oO8rtgqSzxC7DzbVHa2VhbddWBqNVOI=";
version = "1.1.6";
};
netflixPlugin = {
version = "1.22.3";
hash = "sha256-8NGj8n1p8euqYYdPDSeFh2ZE9lly5ThSmg69yXY3Te8=";
};
}

View file

@ -6,7 +6,9 @@
imports = [ imports = [
../hardware/intel-nuc.nix ../hardware/intel-nuc.nix
]; ];
config = { config = let
hashes = builtins.import ../hashes.nix;
in {
boot.loader.systemd-boot.enable = true; boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
@ -27,17 +29,17 @@
REpo-AiO = pkgs.fetchFromGitHub { REpo-AiO = pkgs.fetchFromGitHub {
owner = "Collabsvito"; owner = "Collabsvito";
repo = "REpo-AiO"; repo = "REpo-AiO";
inherit (config.state.hashes.REpo-AiO) rev hash; inherit (hashes.REpo-AiO) rev hash;
}; };
rtlGroupPlugin = pkgs.kodiPackages.buildKodiAddon rec { rtlGroupPlugin = pkgs.kodiPackages.buildKodiAddon rec {
pname = "rtl+"; pname = "rtl+";
namespace = "plugin.video.rtlgroup.de"; namespace = "plugin.video.rtlgroup.de";
version = config.state.hashes.rtlGroupPlugin.version; version = hashes.rtlGroupPlugin.version;
src = pkgs.fetchzip { src = pkgs.fetchzip {
url = "file://${REpo-AiO}/MATRIX/${namespace}/${namespace}-${version}+matrix.1.zip"; url = "file://${REpo-AiO}/MATRIX/${namespace}/${namespace}-${version}+matrix.1.zip";
hash = config.state.hashes.rtlGroupPlugin.hash; hash = hashes.rtlGroupPlugin.hash;
}; };
patchPhase = '' patchPhase = ''
@ -46,12 +48,12 @@
}; };
netflixPlugin = pkgs.kodiPackages.netflix.overrideAttrs rec { netflixPlugin = pkgs.kodiPackages.netflix.overrideAttrs rec {
inherit (config.state.hashes.netflixPlugin) version; inherit (hashes.netflixPlugin) version;
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
owner = "CastagnaIT"; owner = "CastagnaIT";
repo = "plugin.video.netflix"; repo = "plugin.video.netflix";
rev = "v${version}"; rev = "v${version}";
inherit (config.state.hashes.netflixPlugin) hash; inherit (hashes.netflixPlugin) hash;
}; };
}; };
in in

View file

@ -18,7 +18,6 @@
vpnIPv4 = config.state.vpn.ipv4; vpnIPv4 = config.state.vpn.ipv4;
vpnIPv6 = config.state.vpn.ipv6; vpnIPv6 = config.state.vpn.ipv6;
in { in {
imports = [ imports = [
inputs.nixos-hardware.nixosModules.common-cpu-intel #-cpu-only inputs.nixos-hardware.nixosModules.common-cpu-intel #-cpu-only

View file

@ -48,11 +48,11 @@ in {
# Some overlays # Some overlays
nixpkgs.overlays = [ nixpkgs.overlays = [
(_: super: { (_: super: {
darkman = super.callPackage ../pkgs/darkman.nix {hashes = config.state.hashes.darkman;}; darkman = super.callPackage ../pkgs/darkman.nix {};
"2i-emulator" = super.callPackage ../pkgs/2i-emulator.nix {hashes = config.state.hashes."2i-emulator";}; "2i-emulator" = super.callPackage ../pkgs/2i-emulator.nix {};
boilr = super.callPackage ../pkgs/boilr.nix {hashes = config.state.hashes.boilr;}; boilr = super.callPackage ../pkgs/boilr.nix {};
# Add fonts # Add fonts
hackNerdLigatures = super.callPackage ../pkgs/hack.nix {hashes = config.state.hashes.hack;}; hackNerdLigatures = super.callPackage ../pkgs/hack.nix {};
}) })
]; ];
# This includes the firmware, oc # This includes the firmware, oc

View file

@ -41,11 +41,6 @@ in {
description = "VPN internal DNS server address"; description = "VPN internal DNS server address";
readOnly = true; readOnly = true;
}; };
hashes = mkOption {
type = with types; attrsOf (either (attrsOf str) str);
description = "Hashes in use";
readOnly = true;
};
}; };
config.state = let config.state = let
@ -68,9 +63,5 @@ in {
}) })
state.vpn state.vpn
else builtins.throw "No VPN definitions"; else builtins.throw "No VPN definitions";
hashes =
if state ? hashes
then state.hashes
else {};
}; };
} }

View file

@ -2,8 +2,10 @@
lib, lib,
fetchFromGitHub, fetchFromGitHub,
rustPlatform, rustPlatform,
hashes, ...
}: let }: let
hashes = (builtins.import ../hashes.nix)."2i-emulator";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "klemens"; owner = "klemens";
repo = "2i-emulator"; repo = "2i-emulator";

View file

@ -11,8 +11,10 @@
libxkbcommon, libxkbcommon,
libGL, libGL,
wayland, wayland,
hashes, ...
}: let }: let
hashes = (builtins.import ../hashes.nix).boilr;
rpathLibs = [ rpathLibs = [
speechd speechd
openssl openssl

View file

@ -5,41 +5,43 @@
scdoc, scdoc,
geoclue2, geoclue2,
bash, bash,
hashes, ...
}: }: let
buildGoModule { hashes = (builtins.import ../hashes.nix).darkman;
pname = "darkman"; in
version = hashes.rev; buildGoModule {
pname = "darkman";
version = hashes.rev;
src = fetchFromGitLab { src = fetchFromGitLab {
owner = "WhyNotHugo"; owner = "WhyNotHugo";
repo = "darkman"; repo = "darkman";
inherit (hashes) hash rev; inherit (hashes) hash rev;
}; };
nativeBuildInputs = [scdoc]; nativeBuildInputs = [scdoc];
propagatedBuildInputs = [geoclue2 bash]; propagatedBuildInputs = [geoclue2 bash];
inherit (hashes) vendorSha256; inherit (hashes) vendorSha256;
patchPhase = '' patchPhase = ''
sed -i "s|^ExecStart=/usr/bin/darkman run$|ExecStart=$out/bin/darkman run|" darkman.service sed -i "s|^ExecStart=/usr/bin/darkman run$|ExecStart=$out/bin/darkman run|" darkman.service
sed -i "s|bash|${bash}/bin/bash|" scripts.go sed -i "s|bash|${bash}/bin/bash|" scripts.go
''; '';
postBuild = '' postBuild = ''
make build make build
''; '';
installPhase = '' installPhase = ''
mkdir -p $out mkdir -p $out
make install PREFIX=/ DESTDIR=$out make install PREFIX=/ DESTDIR=$out
''; '';
meta = { meta = {
description = "🌇 Framework for dark-mode and light-mode transitions on Linux desktop"; description = "🌇 Framework for dark-mode and light-mode transitions on Linux desktop";
homepage = "https://gitlab.com/WhyNotHugo/darkman"; homepage = "https://gitlab.com/WhyNotHugo/darkman";
license = lib.licenses.isc; license = lib.licenses.isc;
maintainers = []; maintainers = [];
}; };
} }

View file

@ -2,9 +2,10 @@
lib, lib,
fetchzip, fetchzip,
stdenvNoCC, stdenvNoCC,
hashes, ...
}: let }: let
pname = "Ligatured-Hack"; pname = "Ligatured-Hack";
hashes = (builtins.import ../hashes.nix).hack;
in in
stdenvNoCC.mkDerivation { stdenvNoCC.mkDerivation {
inherit pname; inherit pname;

View file

@ -33,43 +33,6 @@
v6 = "fd7a:115c:a1e0:ab12:4843:cd96:627c:6e2b"; v6 = "fd7a:115c:a1e0:ab12:4843:cd96:627c:6e2b";
}; };
}; };
hashes = {
timewarrior."v1.4.3" = "+HsUiU287bWZ5Ytl+N5i+STuG9YlqlaKWxd69y0PRds=";
"2i-emulator" = {
rev = "dbd022b";
hash = "sha256-zQdnDZwFd7KkSoLyu3Ty/YDn7qosTIf2n02PHitGf2g=";
"rustyline-1.0.0" = "sha256-FFuhLmBwt5e/zOJfkz4NCuI8lG/sBhGOcxst8d+oOVk=";
};
darkman = {
rev = "b4c9bbc";
hash = "sha256-/r3mcwkdFyZQZV3jRJQladujBFvBmm8XhncbePTFlLA=";
vendorSha256 = "sha256-CGgWEaHztWeCQPIrobwLHuDkFauJM19hBU7JsA3HMic=";
};
boilr = {
version = "1.9.1";
hash = "sha256-mdkRuEzfWhdbX0DD6uwc1o8kXjqk1Y0+FFKHrM2m81w=";
cargoHash = "sha256-5nhtGqukZ8tp7gPV+JiUEHTzWUj6JtsB2i7bODcXJSc=";
};
hack = {
version = "v3.003+Nerdv2.1+FC3.1+JBMv2.242";
hash = "sha256-nCOH+48w7nEm7mXXPCsDuaRlId2hNyYdV01IbVNWuME=";
};
pexel-bg.hash = "sha256-Su2UwFpZKj5sa80UrcDSX9O2GuVI6XR2gSLpp4gJZP0=";
microGPodder = {
rev = "6f68333";
hash = "sha256-yex9h6nllxdWRhCbeXNz5PyijNJ6lbc1orfU1vBcS4g=";
};
REpo-AiO = {
rev = "c88a6de";
hash = "sha256-3FeMPAMXvVwbQXmjz6HYo5QAbrI4x3mkVNTLIco56K4=";
};
rtlGroupPlugin = {
hash = "sha256-tknTHae9dRQ1oO8rtgqSzxC7DzbVHa2VhbddWBqNVOI=";
version = "1.1.6";
};
netflixPlugin = {
version = "1.22.3";
hash = "sha256-8NGj8n1p8euqYYdPDSeFh2ZE9lly5ThSmg69yXY3Te8=";
}; };
}; };
} }

View file

@ -13,28 +13,31 @@
# so sum up timewarrior stats # so sum up timewarrior stats
# This just patches the first line to use a python interpreter that has # This just patches the first line to use a python interpreter that has
# `dateutil` available! # `dateutil` available!
timewarriorExtensions = pkgs.stdenvNoCC.mkDerivation { timewarriorExtensions = let
name = "timewarrior-totals"; hashes = (builtins.import ../../hashes.nix).timewarrior;
version = "v1.4.3"; in
src = pkgs.fetchFromGitHub rec { pkgs.stdenvNoCC.mkDerivation {
owner = "GothenburgBitFactory"; name = "timewarrior-totals";
repo = "timewarrior"; inherit (hashes) version;
rev = "v1.4.3"; src = pkgs.fetchFromGitHub {
sha256 = nixosConfig.state.hashes.timewarrior."${rev}"; owner = "GothenburgBitFactory";
repo = "timewarrior";
rev = hashes.version;
inherit (hashes) hash;
};
buildInputs = [pkgs.coreutils];
propagatedBuildInputs = [pythonWithLibs];
phases = ["unpackPhase" "patchPhase" "installPhase"];
patchPhase = ''
sed -i 's|^#!/usr/bin/env python3$|#!${pythonWithLibs}/bin/python3|' \
ext/totals.py \
ext/on-modify.timewarrior
'';
installPhase = ''
mkdir -p $out
cp ext/totals.py ext/on-modify.timewarrior $out/
'';
}; };
buildInputs = [pkgs.coreutils];
propagatedBuildInputs = [pythonWithLibs];
phases = ["unpackPhase" "patchPhase" "installPhase"];
patchPhase = ''
sed -i 's|^#!/usr/bin/env python3$|#!${pythonWithLibs}/bin/python3|' \
ext/totals.py \
ext/on-modify.timewarrior
'';
installPhase = ''
mkdir -p $out
cp ext/totals.py ext/on-modify.timewarrior $out/
'';
};
# Color scheme used for taskwarrior # Color scheme used for taskwarrior
taskwarriorColors = pkgs.writeText "colors.rc" '' taskwarriorColors = pkgs.writeText "colors.rc" ''
# General decoration # General decoration

View file

@ -1,5 +1,4 @@
{ {
nixosConfig,
pkgs, pkgs,
lib, lib,
... ...
@ -7,7 +6,7 @@
inherit (lib.hm.gvariant) mkTuple; inherit (lib.hm.gvariant) mkTuple;
bg = pkgs.fetchurl { bg = pkgs.fetchurl {
url = "https://images.pexels.com/photos/2559941/pexels-photo-2559941.jpeg"; url = "https://images.pexels.com/photos/2559941/pexels-photo-2559941.jpeg";
hash = nixosConfig.state.hashes.pexel-bg.hash; hash = (builtins.import ../../hashes.nix).pexel-bg.hash;
}; };
in { in {
imports = [../modules/restic-backup.nix]; imports = [../modules/restic-backup.nix];