Skip to content

refactoring: reintroduce nix #19

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

Draft
wants to merge 2 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
21 changes: 21 additions & 0 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: nix build

on:
- push
- pull_request
jobs:
check_nix:
name: Check nix build
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: system-features = nixos-test benchmark big-parallel kvm
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v4
- name: Build lib
run: nix build -L
270 changes: 270 additions & 0 deletions flake.lock

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

52 changes: 52 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
description = "one-time-password";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
flake-utils.url = "github:numtide/flake-utils";
libsodium-bindings.url = "github:haskell-cryptography/libsodium-bindings";
chronos = {
url = "github:byteverse/chronos";
flake = false;
};
};

outputs = { self, nixpkgs, flake-utils, ... }@inputs:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs{inherit system;};
in
rec
{
packages.one-time-password =
pkgs.haskellPackages.callCabal2nix "one-time-password" ./.
{
base32 = pkgs.haskellPackages.base32_0_4;
chronos = pkgs.haskellPackages.callCabal2nix "chronos" inputs.chronos {};
sel = inputs.libsodium-bindings.packages.${system}.sel;
};

defaultPackage = packages.one-time-password;

devShell =
let
scripts = pkgs.symlinkJoin {
name = "scripts";
paths = pkgs.lib.mapAttrsToList pkgs.writeShellScriptBin {
};
};
in
pkgs.mkShell {
buildInputs = with pkgs.haskellPackages; [
pkgs.libsodium
haskell-language-server
ghcid
cabal-install
scripts
];
inputsFrom = [
self.defaultPackage.${system}.env
];
};
});
}
2 changes: 1 addition & 1 deletion one-time-password.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ library
, cryptohash-sha1 ^>=0.11
, network-uri ^>=2.6
, sel ^>=0.0
, text ^>=2.1
, text >=2.0 && <2.2
, text-display ^>=0.0

ghc-options: -Wall
Expand Down