packaging: convert split derivation to hybrid split/multi-derivation
This commit is contained in:
parent
4aac9a8dba
commit
f46c2a9934
1 changed files with 26 additions and 13 deletions
39
package.nix
39
package.nix
|
|
@ -27,13 +27,6 @@ in {
|
|||
doCheck = true;
|
||||
doInstallCheck = true;
|
||||
|
||||
modulesSrc = lib.fileset.toSource {
|
||||
root = ./modules/dynamicism;
|
||||
fileset = lib.fileset.unions [
|
||||
./modules/dynamicism
|
||||
];
|
||||
};
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
|
|
@ -43,6 +36,26 @@ in {
|
|||
];
|
||||
};
|
||||
|
||||
dynixModules = stdenv.mkDerivation (modulesSelf: {
|
||||
pname = "dynix-modules";
|
||||
inherit (self) version;
|
||||
src = lib.fileset.toSource {
|
||||
root = ./modules/dynamicism;
|
||||
fileset = lib.fileset.unions [
|
||||
./modules/dynamicism
|
||||
];
|
||||
};
|
||||
|
||||
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
|
||||
|
||||
modulesOut = "${placeholder "out"}/share/nixos/modules/dynix";
|
||||
|
||||
installPhase = lib.dedent ''
|
||||
mkdir -p "$modulesOut"
|
||||
cp -r "$src/"* "$modulesOut/"
|
||||
'';
|
||||
});
|
||||
|
||||
cargoDeps = rustPlatform.importCargoLock {
|
||||
lockFile = ./Cargo.lock;
|
||||
};
|
||||
|
|
@ -55,11 +68,9 @@ in {
|
|||
versionCheckHook
|
||||
];
|
||||
|
||||
modulesOut = "${placeholder "modules"}/share/nixos/modules/dynix";
|
||||
|
||||
postInstall = lib.dedent ''
|
||||
mkdir -p "$modulesOut"
|
||||
cp -r "$modulesSrc/"* "$modulesOut/"
|
||||
postFixup = lib.dedent ''
|
||||
mkdir -p "$modules"
|
||||
cp -r --reflink=auto "$dynixModules/"* "$modules/"
|
||||
'';
|
||||
|
||||
passthru.mkDevShell = {
|
||||
|
|
@ -97,8 +108,10 @@ in {
|
|||
|
||||
meta = {
|
||||
longDescription = lib.dedent ''
|
||||
Default output contains the modules at top-level, meant for `import`.
|
||||
Default output contains the Rust binary.
|
||||
The `modules` output contains the modules prefixed under `/share/nixos/modules/dynix`.
|
||||
The `dynix` passthru attr is a shortcut for the modules output *with* the modules prefix,
|
||||
and thus `dynix.dynix` can be passed directly to `imports = [`.
|
||||
'';
|
||||
mainProgram = "dynix";
|
||||
outputsToInstall = [ "out" "modules" ];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue