-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor nix flake, based on overriding nixpkgs
Now that umu-launcher-unwrapped is being maintained in nixpkgs, it can be used as a starting point for the nix package here. We just need to override a few things, such as the `src`, and handle any changes that have not yet made it into a release build. Ideally, we would also reuse the nixpkgs umu-launcher wrapper package. However, 1) it is currently not fully overridable and 2) we have a slightly different package-args API that needs to be maintained. The opportunity has been taken to clean up that package-args API: - Renamed `truststore` to `withTruststore` with a warning. - `cbor2` wasn't working, warn when it is used. - Added `withDeltaUpdates` Breaking changes: - The umu-launcher package in the overlay is no longer the unwrapped package (previously in `umu-launcher.nix`). - The derivation attrs for various packages are re-written from scratch, likely breaking users' custom overrides. Non-breaking changes: - The umu & umu-run packages have effectively been renamed umu-launcher. - The flake outputs for all systems supported by the nixpkgs package. - The package version is now derived from the flake's lastModifiedDate.
- Loading branch information
1 parent
83890ba
commit 794f2ed
Showing
6 changed files
with
138 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
# Dependencies: | ||
lib, | ||
buildFHSEnv, | ||
umu-launcher-unwrapped, | ||
python3Packages, | ||
rustPlatform, | ||
cargo, | ||
zstd, | ||
# Public API: | ||
version, | ||
withTruststore ? args.truststore or true, | ||
withDeltaUpdates ? true, | ||
# Deprecated: | ||
# NOTE: this relies on there not being a `pkgs.truststore` or `pkgs.cbor2`... | ||
# If there was, callPackage would provide them, causing our warnings to false-positive. | ||
truststore ? null, | ||
cbor2 ? null, | ||
} @ args: let | ||
checked = { | ||
withTruststore = | ||
lib.warnIf (args ? truststore) | ||
"umu-launcher: the argument `truststore` has been renamed to `withTruststore`." | ||
withTruststore; | ||
withDeltaUpdates = | ||
lib.warnIf (args ? cbor2) | ||
"umu-launcher: the argument `cbor2` has never had any effect. The new argument `withDeltaUpdates` should be used instead." | ||
withDeltaUpdates; | ||
}; | ||
|
||
overridden = umu-launcher-unwrapped.overridePythonAttrs (prev: { | ||
src = ../../.; | ||
inherit version; | ||
|
||
# We can drop old.patches and replace it with the patches we actually need | ||
patches = [ | ||
./0-Makefile-no-vendor.patch | ||
]; | ||
|
||
nativeBuildInputs = | ||
(prev.nativeBuildInputs or []) | ||
++ [ | ||
rustPlatform.cargoSetupHook | ||
cargo | ||
]; | ||
|
||
propagatedBuildInputs = | ||
(prev.propagatedBuildInputs or []) | ||
++ lib.optionals checked.withTruststore [ | ||
python3Packages.truststore | ||
] | ||
++ lib.optionals checked.withDeltaUpdates [ | ||
python3Packages.cbor2 | ||
python3Packages.xxhash | ||
zstd | ||
]; | ||
|
||
cargoDeps = rustPlatform.importCargoLock { | ||
lockFile = ../../Cargo.lock; | ||
}; | ||
}); | ||
in | ||
# We cannot override everything we need to, so re-implement the package | ||
# See https://github.com/NixOS/nixpkgs/pull/375588 | ||
# Tracker https://nixpk.gs/pr-tracker.html?pr=375588 | ||
buildFHSEnv { | ||
pname = "umu-launcher"; | ||
inherit (overridden) version meta; | ||
executableName = overridden.meta.mainProgram; | ||
|
||
targetPkgs = pkgs: [overridden]; | ||
runScript = lib.getExe overridden; | ||
|
||
extraInstallCommands = '' | ||
ln -s ${overridden}/lib $out/lib | ||
ln -s ${overridden}/share $out/share | ||
''; | ||
|
||
# For debugging and to simplify the overlay, | ||
# expose the overridden unwrapped package | ||
passthru.umu-launcher-unwrapped = overridden; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.