summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--default.nix58
-rw-r--r--flake.lock25
-rw-r--r--flake.nix54
-rw-r--r--shell.nix3
4 files changed, 84 insertions, 56 deletions
diff --git a/default.nix b/default.nix
index f280a118..71d1a80a 100644
--- a/default.nix
+++ b/default.nix
@@ -1,57 +1,3 @@
-{ packages ? "llvmPackages_9"
-
-, rev ? "1fe82110febdf005d97b2927610ee854a38a8f26"
-, sha256 ? "08x6saa7iljyq2m0j6p9phy0v17r3p8l7vklv7y7gvhdc7a85ppi"
-
-, pkgs ? import (builtins.fetchTarball {
- url = "https://github.com/NixOS/nixpkgs/archive/${rev}.tar.gz";
- inherit sha256; }) {
- config.allowUnfree = true;
- config.allowBroken = false;
- overlays = [
- (self: super: {})
- ];
- }
-}:
-
-let
- version = "3.2.1";
- rev = "20200518";
-in
-
-pkgs.stdenv.mkDerivation {
- name = "ledger-${version}-${rev}";
-
+(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
src = ./.;
-
- nativeBuildInputs = with pkgs; [ cmake ];
- buildInputs = with pkgs; [ boost gmp mpfr libedit python3 texinfo gnused gpgme ];
-
- enableParallelBuilding = true;
-
- cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DUSE_GPGME=1" ];
-
- buildPhase = "make -j$NIX_BUILD_CORES";
- checkPhase = ''
- export LD_LIBRARY_PATH=$PWD
- ctest -j$NIX_BUILD_CORES
- '';
-
- doCheck = true;
-
- meta = {
- homepage = "http://ledger-cli.org/";
- description = "A double-entry accounting system with a command-line reporting interface";
- license = pkgs.stdenv.lib.licenses.bsd3;
-
- longDescription = ''
- Ledger is a powerful, double-entry accounting system that is accessed
- from the UNIX command-line. This may put off some users, as there is
- no flashy UI, but for those who want unparalleled reporting access to
- their data, there really is no alternative.
- '';
-
- platforms = pkgs.stdenv.lib.platforms.all;
- maintainers = with pkgs.stdenv.lib.maintainers; [ jwiegley ];
- };
-}
+}).defaultNix
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 00000000..7d78eb63
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,25 @@
+{
+ "nodes": {
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1638407071,
+ "narHash": "sha256-xbveILjgtBVh6B5F6i2k3T0IrE8lZp1vsqfDY+Df/cg=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "971b383a28f4baee8ea3931af4840fa221929fd6",
+ "type": "github"
+ },
+ "original": {
+ "id": "nixpkgs",
+ "type": "indirect"
+ }
+ },
+ "root": {
+ "inputs": {
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 00000000..dc35830a
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,54 @@
+{
+ description = "A double-entry accounting system with a command-line reporting interface";
+
+ outputs = { self, nixpkgs }: let
+ forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
+ nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
+ systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
+ in {
+
+ packages = forAllSystems (system: let
+ pkgs = nixpkgsFor.${system};
+ in {
+ ledger = pkgs.stdenv.mkDerivation {
+ pname = "ledger";
+ version = "3.2.1-${self.shortRev or "dirty"}";
+
+ src = self;
+
+ nativeBuildInputs = with pkgs; [ cmake ];
+ buildInputs = with pkgs; [ boost gmp mpfr libedit python3 texinfo gnused gpgme ];
+
+ enableParallelBuilding = true;
+
+ cmakeFlags = [ "-DCMAKE_INSTALL_LIBDIR=lib" "-DUSE_GPGME=1" ];
+
+ checkPhase = ''
+ export LD_LIBRARY_PATH=$PWD
+ ctest -j$NIX_BUILD_CORES
+ '';
+
+ doCheck = true;
+
+ meta = {
+ homepage = "http://ledger-cli.org/";
+ description = "A double-entry accounting system with a command-line reporting interface";
+ license = pkgs.lib.licenses.bsd3;
+
+ longDescription = ''
+ Ledger is a powerful, double-entry accounting system that is accessed
+ from the UNIX command-line. This may put off some users, as there is
+ no flashy UI, but for those who want unparalleled reporting access to
+ their data, there really is no alternative.
+ '';
+
+ platforms = pkgs.lib.platforms.all;
+ maintainers = with pkgs.lib.maintainers; [ jwiegley ];
+ };
+ };
+ });
+
+ defaultPackage = forAllSystems (system: self.packages.${system}.ledger);
+
+ };
+}
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 00000000..330df0ab
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,3 @@
+(import (fetchTarball https://github.com/edolstra/flake-compat/archive/master.tar.gz) {
+ src = ./.;
+}).shellNix