-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from jurraca/flakify
Flakify
- Loading branch information
Showing
4 changed files
with
164 additions
and
20 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 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 |
---|---|---|
@@ -1,41 +1,43 @@ | ||
{ pkgs ? import <nixpkgs> { } }: | ||
|
||
{ | ||
pkgs, | ||
rpki-client-src, | ||
rpki-openbsd-src, | ||
}: | ||
# build the package | ||
pkgs.stdenv.mkDerivation rec { | ||
name = "rpki-client"; | ||
version = "8.2"; | ||
|
||
src = pkgs.fetchFromGitHub { | ||
owner = "rpki-client"; | ||
repo = "rpki-client-portable"; | ||
rev = version; | ||
hash = "sha256-oErUjZn/a/Ka70+Z8Wb2L7UIulGPjF81bYAQ2wPvWfo="; | ||
}; | ||
version = "8.6"; | ||
|
||
openbsd_src = pkgs.fetchFromGitHub { | ||
owner = "rpki-client"; | ||
repo = "rpki-client-openbsd"; | ||
rev = "rpki-client-8.2"; | ||
hash = "sha256-zC3vbQLLWgImS+lYNWbHzkLrZTJvgPfH+W+FiSnH8Aw="; | ||
}; | ||
src = rpki-client-src; | ||
|
||
# Dependencies required at build time | ||
buildInputs = with pkgs; [ | ||
libressl | ||
expat | ||
automake | ||
autoconf | ||
libtool | ||
rsync | ||
zlib | ||
]; | ||
|
||
# Prepare the source directory before configuring and building. | ||
# In this case, we set up the openbsd directory, which rpki-client-portable expects, | ||
# with the rpki-openbsd-src attribute we set up as a flake input. | ||
unpackPhase = '' | ||
mkdir -p openbsd | ||
cp -R ${openbsd_src}/* openbsd | ||
cp -R ${rpki-openbsd-src}/* openbsd | ||
cp -R ${src}/* . | ||
chmod 700 -R . | ||
''; | ||
|
||
# Configure with the given scripts, but point to our nix-specific $out directory | ||
configurePhase = '' | ||
./autogen.sh | ||
./configure --prefix=$out | ||
''; | ||
|
||
# The default buildPhase for stdenv.mkDerivation is "make" | ||
# which is what the project wants in this case. | ||
# So we don't need to modify the buildPhase. | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
description = "RPKI Client v8.6"; | ||
|
||
# To build the package, run "nix build" in the current directory. | ||
# This will build the rpki-client binary and put it in 'result/bin/'. | ||
|
||
inputs = { | ||
# We pin to a set nixpkgs version | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; | ||
# A lib to help build packages for multiple target systems | ||
utils.url = "github:numtide/flake-utils"; | ||
# The RPKI portable client source, pinned to a specific version | ||
rpki-client-src = { | ||
url = "github:rpki-client/rpki-client-portable/aa554ab91add82bb68de00d323e02c9d20621aee"; # v8.6 | ||
flake = false; | ||
}; | ||
# The openbsd shim of rpki-client-portable, which gets pulled into rpki-client at build time | ||
# Since Nix can't fetch external sources (or access the Internet) at build time, we pull it in explicitly. | ||
# See https://github.com/rpki-client/rpki-client-portable/blob/master/update.sh | ||
rpki-openbsd-src = { | ||
url = "github:rpki-client/rpki-client-openbsd/082ed00f2b1f8b1b578b2bc9eae84a5fc1923d68"; # v8.6 | ||
flake = false; | ||
}; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
nixpkgs, | ||
utils, | ||
rpki-client-src, | ||
rpki-openbsd-src, | ||
}: | ||
# Read as: for each system, use nixpkgs and run the default.nix build instructions with these args. | ||
utils.lib.eachDefaultSystem (system: let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
rpki-client = import ./default.nix {inherit pkgs rpki-client-src rpki-openbsd-src;}; | ||
in rec { | ||
# This exposes a package under the namespace rpki-client.defaultPackage.<system> | ||
defaultPackage = rpki-client; | ||
|
||
# To run locally without cloning this repo, create a `cachedir` locally to hold RPKI data. | ||
# Then run "nix run github:fjahr/rpki-client-nix -- -d cachedir" | ||
apps.rpki-client = utils.lib.mkApp {drv = rpki-client;}; | ||
}); | ||
} |