diff --git a/flake.nix b/flake.nix index 72290c2..0b87f77 100644 --- a/flake.nix +++ b/flake.nix @@ -68,116 +68,10 @@ tryFiles = import ./lib/utils/try-files.nix { inherit lib; }; - xonePatcher = { fetchFromGitHub, xone }: - xone.overrideAttrs ( - final: prev: { - src = fetchFromGitHub { - owner = "manuth"; - repo = "xone"; - rev = "954fc823fbaa429ad6e1c1a06a4a006598ef35ae"; - sha256 = "lsfm7WDXTB6t05AI/pp17yZvkNvnM2WBMUHL1eVO6qw="; - }; - }); - packageDefinitions = { - aliae = { buildGoModule, fetchFromGitHub, installShellFiles, ... }: - buildGoModule rec { - name = "aliae"; - version = "0.21.0"; - - src = fetchFromGitHub { - owner = "JanDeDobbeleer"; - repo = name; - rev = "v${version}"; - sha256 = "Xg3fJs10euju26iJky5UGGGKov47Q16IZQP28ubNca0="; - }; - - nativeBuildInputs = [ - installShellFiles - ]; - - sourceRoot = "${src.name}/src"; - vendorHash = "sha256-sXZ6Rdqy6VtYlQ3UoNWpgdri61b6aX+uAzLVa/y1lbU="; - - postInstall = '' - mv $out/bin/{src,aliae} - installShellCompletion --cmd aliae \ - --bash <($out/bin/aliae completion bash) \ - --fish <($out/bin/aliae completion fish) \ - --zsh <($out/bin/aliae completion zsh) - ''; - }; - - ttf-ms-win11 = { fetchgit, fetchurl, pkgs, p7zip, stdenv, ... }: - let - name = "ttf-ms-win11"; - iso = "win11.iso"; - version = "10.0.22631.2428-2"; - fonts = ''"''${_ttf_ms_win11[@]}"''; - ttf-ms-win11-auto = - stdenv.mkDerivation { - name = "${name}-auto"; - inherit version; - - src = fetchgit { - url = "https://aur.archlinux.org/ttf-ms-win11-auto.git"; - rev = "aee165d1396b34000b07294d36f9c19812a186f7"; - sha256 = "3QZP5j/q/BTwBLSULVACKJ7DRVh3w/wxKEOZc1Fo9Io="; - }; - - buildPhase = '' - mkdir $out - cp PKGBUILD $out/ - ''; - }; - in - # Borrowed from https://aur.archlinux.org/packages/ttf-ms-win11-auto - stdenv.mkDerivation rec { - inherit - name - version - ; - - src = fetchurl { - url = "https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"; - name = "${name}.tar"; - sha256 = "KpxK+LCq6FCwV607YH7nqQa415+jVYQ5lUnCL4MSXxk="; - downloadToTemp = true; - - nativeBuildInputs = [ - p7zip - ]; - - postFetch = '' - mv $downloadedFile "${iso}" - echo "Downloaded file:" - ls -al - 7z x "${iso}" sources/install.wim - echo "Files after extraction:" - ls -al - 7z e sources/install.wim Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf} - . ${ttf-ms-win11-auto}/PKGBUILD - mkdir "${name}" - cp ${fonts} license.rtf "${name}" - tar -czvf $out \ - --sort=name --format=posix --pax-option='delete=atime,delete=ctime' --clamp-mtime --mtime="$SOURCE_EPOCH" --numeric-owner --owner=0 --group=0 --mode='go+u,go-w' \ - "${name}" - ''; - }; - - installPhase = '' - runHook preInstall - . ${ttf-ms-win11-auto}/PKGBUILD - install -vDm644 ${fonts} -t $out/share/fonts/truetype - install -vDm644 license.rtf -t $out/share/licenses/${name}/ - runHook postInstall - ''; - }; - - xone = pkgs: xonePatcher { - inherit (pkgs) fetchFromGitHub; - inherit (pkgs.linuxPackages_latest) xone; - }; + aliae = import ./lib/packages/aliae.nix; + ttf-ms-win11 = import ./lib/packages/ttf-ms-win11.nix; + xone = import ./lib/packages/xone.nix; }; in flake-utils.lib.eachDefaultSystem ( diff --git a/lib/packages/aliae.nix b/lib/packages/aliae.nix new file mode 100644 index 0000000..aa4761b --- /dev/null +++ b/lib/packages/aliae.nix @@ -0,0 +1,27 @@ +{ buildGoModule, fetchFromGitHub, installShellFiles, ... }: + buildGoModule rec { + name = "aliae"; + version = "0.21.0"; + + src = fetchFromGitHub { + owner = "JanDeDobbeleer"; + repo = name; + rev = "v${version}"; + sha256 = "Xg3fJs10euju26iJky5UGGGKov47Q16IZQP28ubNca0="; + }; + + nativeBuildInputs = [ + installShellFiles + ]; + + sourceRoot = "${src.name}/src"; + vendorHash = "sha256-sXZ6Rdqy6VtYlQ3UoNWpgdri61b6aX+uAzLVa/y1lbU="; + + postInstall = '' + mv $out/bin/{src,aliae} + installShellCompletion --cmd aliae \ + --bash <($out/bin/aliae completion bash) \ + --fish <($out/bin/aliae completion fish) \ + --zsh <($out/bin/aliae completion zsh) + ''; + } diff --git a/lib/packages/ttf-ms-win11.nix b/lib/packages/ttf-ms-win11.nix new file mode 100644 index 0000000..ba5a5bb --- /dev/null +++ b/lib/packages/ttf-ms-win11.nix @@ -0,0 +1,62 @@ +{ fetchgit, fetchurl, p7zip, stdenv, ... }: + let + name = "ttf-ms-win11"; + iso = "win11.iso"; + version = "10.0.22631.2428-2"; + fonts = ''"''${_ttf_ms_win11[@]}"''; + + ttf-ms-win11-auto = + stdenv.mkDerivation { + name = "${name}-auto"; + inherit version; + + src = fetchgit { + url = "https://aur.archlinux.org/ttf-ms-win11-auto.git"; + rev = "aee165d1396b34000b07294d36f9c19812a186f7"; + sha256 = "3QZP5j/q/BTwBLSULVACKJ7DRVh3w/wxKEOZc1Fo9Io="; + }; + + buildPhase = '' + mkdir $out + cp PKGBUILD $out + ''; + }; + in + # Borrowed from https://aur.archlinux.org/packages/ttf-ms-win11-auto + stdenv.mkDerivation rec { + inherit + name + version + ; + + src = fetchurl { + url = "https://software-static.download.prss.microsoft.com/dbazure/888969d5-f34g-4e03-ac9d-1f9786c66749/22631.2428.231001-0608.23H2_NI_RELEASE_SVC_REFRESH_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso"; + name = "${name}.tar"; + sha256 = "KpxK+LCq6FCwV607YH7nqQa415+jVYQ5lUnCL4MSXxk="; + downloadToTemp = true; + + nativeBuildInputs = [ + p7zip + ]; + + postFetch = '' + mv $downloadedFile "${iso}" + 7z x "${iso}" sources/install.wim + 7z e sources/install.wim Windows/{Fonts/"*".{ttf,ttc},System32/Licenses/neutral/"*"/"*"/license.rtf} + . ${ttf-ms-win11-auto}/PKGBUILD + mkdir "${name}" + cp ${fonts} license.rtf "${name}" + tar -czvf $out \ + --sort=name --format=posix --pax-option='delete=atime,delete=ctime' --clamp-mtime --mtime="$SOURCE_EPOCH" --numeric-owner --owner=0 --group=0 --mode='go+u,go-w' \ + "${name}" + ''; + }; + + installPhase = '' + runHook preInstall + . ${ttf-ms-win11-auto}/PKGBUILD + install -vDm644 ${fonts} -t $out/share/fonts/truetype + install -vDm644 license.rtf -t $out/share/licenses/${name}/ + runHook postInstall + ''; + } diff --git a/lib/packages/xone.nix b/lib/packages/xone.nix new file mode 100644 index 0000000..8174766 --- /dev/null +++ b/lib/packages/xone.nix @@ -0,0 +1,17 @@ +{ pkgs, fetchFromGitHub, ... }: + let + xonePatcher = { xone, fetchFromGitHub }: + xone.overrideAttrs ( + final: prev: { + src = fetchFromGitHub { + owner = "manuth"; + repo = "xone"; + rev = "954fc823fbaa429ad6e1c1a06a4a006598ef35ae"; + sha256 = "lsfm7WDXTB6t05AI/pp17yZvkNvnM2WBMUHL1eVO6qw="; + }; + }); + in + xonePatcher { + inherit fetchFromGitHub; + inherit (pkgs.linuxPackages_latest) xone; + }