Merge pull request 'Enable nix flake' (#1) from dev into main
Some checks failed
Haskell-CI / Haskell-CI - Linux - ghc-8.10.7 (push) Has been cancelled
Haskell-CI / Haskell-CI - Linux - ghc-8.6.5 (push) Has been cancelled
Haskell-CI / Haskell-CI - Linux - ghc-8.8.4 (push) Has been cancelled
Haskell-CI / Haskell-CI - Linux - ghc-9.0.2 (push) Has been cancelled
Haskell-CI / Haskell-CI - Linux - ghc-9.2.7 (push) Has been cancelled
Haskell-CI / Haskell-CI - Linux - ghc-9.4.4 (push) Has been cancelled

Reviewed-on: #1
This commit is contained in:
pitmutt 2025-04-10 18:00:37 +00:00
commit 1b06cbcd98
5 changed files with 182 additions and 19 deletions

View file

@ -1,5 +1,11 @@
# Revision history for foreign-rust
## 0.1.0.0 -- YYYY-mm-dd
## 0.2.0.0
### Added
- Nix flake infrastructure
## 0.1.0.0 --
* First version. Released on an unsuspecting world.

View file

@ -1,4 +0,0 @@
packages: .
package foreign-rust
tests: true

94
flake.lock generated Normal file
View file

@ -0,0 +1,94 @@
{
"nodes": {
"borsh": {
"flake": false,
"locked": {
"lastModified": 1716294836,
"narHash": "sha256-dEv3m7U7buQr9kX68U+r5Ro4KRXesGsSpqBs2CLddaY=",
"owner": "khazaddum",
"repo": "borsh",
"rev": "b8e5cfd6ed875707fa82698d5c356ac062203e71",
"type": "github"
},
"original": {
"owner": "khazaddum",
"repo": "borsh",
"type": "github"
}
},
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1743550720,
"narHash": "sha256-hIshGgKZCgWh6AYJpJmRgFdR3WUbkY04o82X05xqQiY=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "c621e8422220273271f52058f618c94e405bb0f5",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"haskell-flake": {
"locked": {
"lastModified": 1743922999,
"narHash": "sha256-Wh+Zak8sZUgair4pnZR0mLrLIhhInHS8izj7C1H10B8=",
"owner": "srid",
"repo": "haskell-flake",
"rev": "d102e0f8a1773b1a63a616faef670cf5e129f9e9",
"type": "github"
},
"original": {
"owner": "srid",
"repo": "haskell-flake",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1744157173,
"narHash": "sha256-bWSjxDwq7iVePrhmA7tY2dyMWHuNJo8knkO4y+q4ZkY=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "6a39c6e495eefabc935d8ddf66aa45d85b85fa3f",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1743296961,
"narHash": "sha256-b1EdN3cULCqtorQ4QeWgLMrd5ZGOjLSLemfa00heasc=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "e4822aea2a6d1cdd36653c134cacfd64c97ff4fa",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"root": {
"inputs": {
"borsh": "borsh",
"flake-parts": "flake-parts",
"haskell-flake": "haskell-flake",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

66
flake.nix Normal file
View file

@ -0,0 +1,66 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
borsh.url = "github:khazaddum/borsh";
borsh.flake = false;
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule ];
perSystem = { self', pkgs, ... }: {
# Typically, you just want a single project named "default". But
# multiple projects are also possible, each using different GHC version.
haskellProjects.default = {
# The base package set representing a specific GHC version.
# By default, this is pkgs.haskellPackages.
# You may also create your own. See https://community.flake.parts/haskell-flake/package-set
# basePackages = pkgs.haskellPackages;
# Extra package information. See https://community.flake.parts/haskell-flake/dependency
#
# Note that local packages are automatically included in `packages`
# (defined by `defaults.packages` option).
#
# packages = {
# aeson.source = "1.5.0.0"; # Hackage version override
# shower.source = inputs.shower;
# };
packages = {
borsh.source = inputs.borsh;
};
settings = {
# aeson = {
# check = false;
# };
# relude = {
# haddock = false;
# broken = false;
# };
foreign-rust = {
check = false;
};
};
# devShell = {
# # Enabled by default
# enable = true;
#
# # Programs you want to make available in the shell.
# # Default programs can be disabled by setting to 'null'
# tools = hp: { fourmolu = hp.fourmolu; ghcid = null; };
#
# hlsCheck.enable = true;
# };
};
# haskell-flake doesn't set the default package, but you can do it here.
packages.default = self'.packages.foreign-rust;
};
};
}

View file

@ -1,6 +1,6 @@
cabal-version: 3.0
name: foreign-rust
version: 0.1.0
version: 0.2.0
license: BSD-3-Clause
license-file: LICENSE
author: Edsko de Vries
@ -14,6 +14,7 @@ tested-with: GHC==8.6.5
, GHC==9.0.2
, GHC==9.2.7
, GHC==9.4.4
, GHC==9.6.6
common lang
build-depends:
@ -76,7 +77,7 @@ library
hs-source-dirs:
src
build-depends:
, aeson
, aeson >= 2.1
, base16-bytestring
, base58-bytestring
, base64-bytestring
@ -121,15 +122,15 @@ test-suite test-foreign-rust
, tasty-hunit
, template-haskell
test-suite demo-annotated
import:
lang
type:
exitcode-stdio-1.0
main-is:
Main.hs
hs-source-dirs:
demo-annotated
build-depends:
, generics-sop
, foreign-rust
--test-suite demo-annotated
--import:
--lang
--type:
--exitcode-stdio-1.0
--main-is:
--Main.hs
--hs-source-dirs:
--demo-annotated
--build-depends:
--, generics-sop
--, foreign-rust