Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions docs/release-notes/2605.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,31 @@ No breaking change were introduced in this EPNix release.

## New features and highlights

### IOC development

- With this release,
you can pass a function
as argument to the `mkEpicsPackage` function.
This means that you can use the [`finalAttrs` pattern],
for example:

```nix
# ...
mkEpicsPackage (finalAttrs: {
pname = "my-package";
version = "1.0.0";

src = fetchFromGitHub {
owner = "my-owner";
repo = "my-repo";
rev = finalAttrs.version;
hash = "...";
};

# ...
})
```

[`finalAttrs` pattern]: https://nixos.org/manual/nixpkgs/stable/#mkderivation-recursive-attributes

## Documentation
8 changes: 4 additions & 4 deletions pkgs/by-name/ca-gateway/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
python3Packages,
pcas,
}:
mkEpicsPackage rec {
mkEpicsPackage (finalAttrs: {
pname = "ca-gateway";
version = "2.1.3";
varname = "CA_GATEWAY";

src = fetchFromGitHub {
owner = "epics-extensions";
repo = pname;
rev = "v${version}";
repo = finalAttrs.pname;
tag = "v${finalAttrs.version}";
hash = "sha256-PUe/MPvmBUFOKsrgIZvz65K1/HhD/ugmldKGY6SnMck=";
};

Expand All @@ -30,4 +30,4 @@ mkEpicsPackage rec {
license = epnixLib.licenses.epics;
maintainers = with epnixLib.maintainers; [ minijackson ];
};
}
})
122 changes: 65 additions & 57 deletions pkgs/by-name/mkEpicsPackage/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,73 +8,81 @@
readline,
...
}:
{
pname,
varname,
epics-base ? epnix.epics-base,
local_config_site ? { },
local_release ? { },
isEpicsBase ? false,
depsBuildBuild ? [ ],
nativeBuildInputs ? [ ],
buildInputs ? [ ],
shellHook ? "",
...
}@attrs:

let
# remove non standard attributes that cannot be coerced to strings
overridable = builtins.removeAttrs attrs [
"local_config_site"
"local_release"
];
generateConf = (buildPackages.epnixLib.formats.make { }).generate;
in
stdenv.mkDerivation (
overridable
// {
strictDeps = true;

# When cross-compiling,
# epics will build every project twice,
# once "build -> build", and once "build -> host",
# so we need a compiler for the "build -> build" compilation.
depsBuildBuild = depsBuildBuild ++ [ buildPackages.stdenv.cc ];
lib.makeOverridable (
lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;

nativeBuildInputs = nativeBuildInputs ++ [
makeWrapper
perl
readline
epnix.epicsSetupHook
excludeDrvArgNames = [
"epics-base"
"local_config_site"
"local_release"
"isEpicsBase"
];

# Also add perl into the non-native build inputs
# so that shebangs gets patched
buildInputs =
buildInputs
++ [
perl
readline
]
++ (lib.optional (!isEpicsBase) epics-base);
extendDrvArgs =
finalAttrs:
{
varname,
epics-base ? epnix.epics-base,
local_config_site ? { },
local_release ? { },
isEpicsBase ? false,

depsBuildBuild ? [ ],
nativeBuildInputs ? [ ],
buildInputs ? [ ],
shellHook ? "",
...
}@attrs:
{
strictDeps = true;

# When cross-compiling,
# epics will build every project twice,
# once "build -> build", and once "build -> host",
# so we need a compiler for the "build -> build" compilation.
depsBuildBuild = depsBuildBuild ++ [ buildPackages.stdenv.cc ];

nativeBuildInputs = nativeBuildInputs ++ [
makeWrapper
perl
readline
epnix.epicsSetupHook
];

# Also add perl into the non-native build inputs
# so that shebangs gets patched
buildInputs =
buildInputs
++ [
perl
readline
]
++ (lib.optional (!isEpicsBase) epics-base);

setupHook = ./setup-hook.sh;
setupHook = ./setup-hook.sh;

local_config_site = generateConf local_config_site;
local_release = generateConf local_release;
local_config_site = generateConf local_config_site;
local_release = generateConf local_release;

doCheck = attrs.doCheck or true;
checkTarget = "runtests";
doCheck = attrs.doCheck or true;
checkTarget = "runtests";

shellHook = ''
${lib.optionalString (!isEpicsBase) ''
# epics-base is considered a "buildInputs",
# not a "nativeBuildInputs",
# so it needs to be manually added in to the PATH
# in a development shell,
addToSearchPath PATH "${epics-base}/bin"
''}
shellHook = ''
${lib.optionalString (!isEpicsBase) ''
# epics-base is considered a "buildInputs",
# not a "nativeBuildInputs",
# so it needs to be manually added in to the PATH
# in a development shell,
addToSearchPath PATH "${epics-base}/bin"
''}

${shellHook}
'';
${shellHook}
'';
};
}
)
8 changes: 4 additions & 4 deletions pkgs/by-name/pcas/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
mkEpicsPackage,
fetchFromGitHub,
}:
mkEpicsPackage rec {
mkEpicsPackage (finalAttrs: {
pname = "pcas";
version = "4.13.3";
varname = "PCAS";

src = fetchFromGitHub {
owner = "epics-modules";
repo = pname;
rev = "v${version}";
repo = finalAttrs.pname;
rev = "v${finalAttrs.version}";
hash = "sha256-wwU2/4CHI/dExqfFL1AzK7d+cMRGU1oxSlhb/3xY7xs=";
};

Expand All @@ -21,4 +21,4 @@ mkEpicsPackage rec {
license = epnixLib.licenses.epics;
maintainers = with epnixLib.maintainers; [ minijackson ];
};
}
})
8 changes: 4 additions & 4 deletions pkgs/by-name/procServ/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
autoreconfHook,
epnixLib,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "procServ";
version = "2.8.0";

src = fetchFromGitHub {
owner = "ralphlange";
repo = pname;
rev = "v${version}";
repo = finalAttrs.pname;
tag = "v${finalAttrs.version}";
hash = "sha256-MVifC4mq8tM71YpXFu0u0fGwq6vtbK/jofCJShjfq3Q=";
};

Expand All @@ -31,4 +31,4 @@ stdenv.mkDerivation rec {
license = lib.licenses.gpl3Plus;
maintainers = with epnixLib.maintainers; [ minijackson ];
};
}
})
Loading