Skip to content
Draft
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -194,3 +194,6 @@ misc/selinux/cfengine-enterprise.pp
misc/selinux/cfengine-enterprise.if
misc/selinux/cfengine-enterprise.te
misc/selinux/tmp

# nix
contrib/nix/result
76 changes: 76 additions & 0 deletions contrib/nix/core.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{ stdenv
, pkg-config
, autoreconfHook
, bison
, flex
, diffutils
, coreutils
, acl
, attr
, curl
, libxml2
, libyaml
, lmdb
, openssl
, pcre2
, zlib
, librsync
, pam
, perl
, shadow
, version
}:

stdenv.mkDerivation {
pname = "cfengine-core";
version = version;
src = ../../.;
outputs = [ "out" "buildTree" ];

postPatch = ''
echo "${version}" > CFVERSION
'';

preBuild = ''
patchShebangs .
'';

nativeBuildInputs = [
pkg-config
autoreconfHook
bison
flex
diffutils
perl
shadow
];

buildInputs = [
acl
attr
curl
libxml2
libyaml
lmdb
openssl
pcre2
zlib
pam
librsync
];

enableParallelBuilding = true;

configureFlags = [
"--with-lmdb"
"--enable-debug"
];

postInstall = ''
cp ${coreutils}/bin/date $out/bin/date
cp ${diffutils}/bin/diff $out/bin/diffutils

mkdir -p "$buildTree"
cp -a . "$buildTree"/
'';
}
61 changes: 61 additions & 0 deletions contrib/nix/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions contrib/nix/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
description = "CFEngine Core";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
self.submodules = true;
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
lib = pkgs.lib;

baseVersion = lib.strings.trim (builtins.readFile ../../.CFVERSION);
shortSha =
if self ? rev then builtins.substring 0 9 self.rev
else if self ? dirtyRev then builtins.substring 0 9 self.dirtyRev
else "unknown0";
version = "${baseVersion}a.${shortSha}";

core = pkgs.callPackage ./core.nix { version = version; };
in
{
packages = {
default = core;
buildTree = core.buildTree;
};
}
);
}
Loading