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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -33,43 +33,6 @@
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
# This just patches the first line to use a python interpreter that has
# `dateutil` available!
timewarriorExtensions = pkgs.stdenvNoCC.mkDerivation {
name = "timewarrior-totals";
version = "v1.4.3";
src = pkgs.fetchFromGitHub rec {
owner = "GothenburgBitFactory";
repo = "timewarrior";
rev = "v1.4.3";
sha256 = nixosConfig.state.hashes.timewarrior."${rev}";
timewarriorExtensions = let
hashes = (builtins.import ../../hashes.nix).timewarrior;
in
pkgs.stdenvNoCC.mkDerivation {
name = "timewarrior-totals";
inherit (hashes) version;
src = pkgs.fetchFromGitHub {
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
taskwarriorColors = pkgs.writeText "colors.rc" ''
# General decoration

View file

@ -1,5 +1,4 @@
{
nixosConfig,
pkgs,
lib,
...
@ -7,7 +6,7 @@
inherit (lib.hm.gvariant) mkTuple;
bg = pkgs.fetchurl {
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 {
imports = [../modules/restic-backup.nix];