Skip to content

Commit

Permalink
Add initial nix flake
Browse files Browse the repository at this point in the history
  • Loading branch information
cortex committed Mar 26, 2023
1 parent 0f3d1b8 commit 8579d6f
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/build_nix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "Build legacy Nix package on Ubuntu"

on:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: cachix/install-nix-action@v12
- name: Building package
run: nix-build . -A defaultPackage.x86_64-linux
7 changes: 7 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).defaultNix
77 changes: 77 additions & 0 deletions flake.lock

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

50 changes: 50 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, utils, naersk }:

utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
naersk-lib = pkgs.callPackage naersk { };
in
{
formatter.x86_64-linux = nixpkgs.legacyPackages.nixfmt;
defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs; mkShell {
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang}/lib/libclang.so";

nativeBuildInputs = [
openssl
];

# necessary to override nix's defaults which cannot be overriden as others are
shellHook = ''
export CC="${pkgs.clang}/bin/clang"
export CXX="${pkgs.clang}/bin/clang++"
export LIBCLANG_PATH="${pkgs.libclang.lib}/lib"
rustup override set stable
'';

buildInputs = [
cargo
rustc
rustfmt
pre-commit
rustPackages.clippy
openssl
pkg-config
libgpg-error
clang
nettle
libclang
gpgme
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
};
});
}
7 changes: 7 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(import (
fetchTarball {
url = "https://github.com/edolstra/flake-compat/archive/99f1c2157fba4bfe6211a321fd0ee43199025dbf.tar.gz";
sha256 = "0x2jn3vrawwv9xp15674wjz9pixwjyj3j771izayl962zziivbx2"; }
) {
src = ./.;
}).shellNix

0 comments on commit 8579d6f

Please sign in to comment.