Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: simplify build / reproducable builds using nix flake #271

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
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
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,8 @@ crash-info/
.rds_delta

*.apk
keystore.properties
keystore.properties


#nix related
**/result
78 changes: 78 additions & 0 deletions flake.lock

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

27 changes: 27 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
description = "vicc emulates a smart card and makes it accessible through PC/SC";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
};

outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
in rec {
packages = rec {
vicc = ((import ./virtualsmartcard/flake.nix).outputs{
self = ./virtualsmartcard;
inherit nixpkgs;
inherit flake-utils;
nixpkgs-stable = inputs.nixpkgs-stable;
}).packages.${system}.vicc;
};

defaultPackage = packages.vicc;
});
}
16 changes: 8 additions & 8 deletions virtualsmartcard/configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.64])
AC_INIT([Virtual Smart Card], [0.10], [https://github.com/frankmorgner/vsmartcard/issues], [virtualsmartcard], [http://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html])
AC_PREREQ([2.72])
AC_INIT([Virtual Smart Card],[0.10],[https://github.com/frankmorgner/vsmartcard/issues],[virtualsmartcard],[http://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html])
AC_CONFIG_SRCDIR([src/vpcd/vpcd.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
Expand Down Expand Up @@ -70,12 +70,12 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])

# --enable-infoplist
AC_ARG_ENABLE(infoplist,
AC_HELP_STRING([--enable-infoplist],[Builds Info.plist for OSX @<:@default=no@:>@]),
AS_HELP_STRING([--enable-infoplist],[Builds Info.plist for OSX @<:@default=no@:>@]),
[infoplist="yes"], [infoplist=no])

# --enable-libpcsclite
AC_ARG_ENABLE(libpcsclite,
AC_HELP_STRING([--enable-libpcsclite],[Build a lightweight version of
AS_HELP_STRING([--enable-libpcsclite],[Build a lightweight version of
libpcsclite, conflicts with PCSC-Lite @<:@default=no@:>@]),
[libpcsclite="${enableval}"], [libpcsclite=no])
if test "${libpcsclite}" = no ; then
Expand All @@ -102,7 +102,7 @@ if test "${libpcsclite}" = no ; then

# --enable-serialdropdir=DIR
AC_ARG_ENABLE(serialdropdir,
AC_HELP_STRING([--enable-serialdropdir=DIR],[directory to install the
AS_HELP_STRING([--enable-serialdropdir=DIR],[directory to install the
serial wrapper driver (default to pcscd config or $(prefix)/pcsc/drivers/serial)]),
[serialdropdir="${enableval}"], [serialdropdir=no])
if test "${serialdropdir}" = no ; then
Expand Down Expand Up @@ -148,7 +148,7 @@ if test "${libpcsclite}" = no ; then

# --enable-serialconfdir=DIR
AC_ARG_ENABLE(serialconfdir,
AC_HELP_STRING([--enable-serialconfdir=DIR],[directory to install the
AS_HELP_STRING([--enable-serialconfdir=DIR],[directory to install the
serial wrapper driver (default to pcscd config or /etc/reader.conf.d)]),
[serialconfdir="${enableval}"], [serialconfdir=no])
if test "${serialconfdir}" = no ; then
Expand Down Expand Up @@ -202,7 +202,7 @@ fi

# --enable-vpcdhost
AC_ARG_ENABLE(vpcdhost,
AC_HELP_STRING([--enable-vpcdhost=ADDRESS],[Default address to connect to when
AS_HELP_STRING([--enable-vpcdhost=ADDRESS],[Default address to connect to when
communicating with vicc. Use "/dev/null" if vpcd shall open
the socket and wait for an incoming connection.
@<:@default=/dev/null@:>@]),
Expand All @@ -217,7 +217,7 @@ fi

# --enable-vpcdslots
AC_ARG_ENABLE(vpcdslots,
AC_HELP_STRING([--enable-vpcdslots=COUNT],[Default number of slots to open.
AS_HELP_STRING([--enable-vpcdslots=COUNT],[Default number of slots to open.
vpcd will open one socket for each slot incrementing the
port number each time. @<:@default=2@:>@]),
[vpcdslots="${enableval}"], [vpcdslots=2])
Expand Down
2 changes: 1 addition & 1 deletion virtualsmartcard/doc/install.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
================================================================================
Istalling |vpcd| on Windows
Installing |vpcd| on Windows
================================================================================

1. To import the installer's test signing certificate, double click
Expand Down
78 changes: 78 additions & 0 deletions virtualsmartcard/flake.lock

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

67 changes: 67 additions & 0 deletions virtualsmartcard/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
description = "vicc emulates a smart card and makes it accessible through PC/SC";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
};

outputs = inputs@{ self, nixpkgs, flake-utils, ... }:
with flake-utils.lib; eachSystem allSystems (system:
let
pkgs = import nixpkgs { inherit system; };
pkgs-stable = import inputs.nixpkgs-stable { inherit system; };
in rec {
packages = rec {

vicc = pkgs.stdenv.mkDerivation {
name = "vicc";
src = self;
buildInputs = with pkgs; [
pcsclite
];
propagatedBuildInputs = with pkgs; [
(python3.withPackages (ps: with ps; [
pyscard
pillow
readline
pbkdf2
pycryptodome
]))
qrencode
];
nativeBuildInputs = with pkgs; [
autoconf
automake
libtool
pkg-config
help2man
python3Packages.setuptools
python3Packages.wrapPython
];
buildPhase = ''
autoreconf -vfi
./configure --prefix=$out --sysconfdir=$out/etc
make
'';
installPhase = ''
make install
'';
postFixup = ''
wrapProgram "$out/bin/vicc" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix PYTHONPATH : "$out/${pkgs.python3.sitePackages}" \
--prefix PATH : "${pkgs.python3}/bin"
'';
};

};

shell = pkgs.mkShell {
buildInputs = with pkgs; [ autoconf automake libtool pkg-config help2man pcsclite python3 ];
};

defaultPackage = packages.vicc;
});
}