Skip to content
Snippets Groups Projects
flake.nix 2.66 KiB
Newer Older
  • Learn to ignore specific revisions
  • {
      description = "A Haskell implementation of the Tahoe-LAFS SSK cryptographic protocols";
    
      inputs = {
        # Nix Inputs
        flake-utils.url = github:numtide/flake-utils;
        hs-flake-utils.url = "git+https://whetstone.private.storage/jcalderone/hs-flake-utils.git?ref=main";
        nixpkgs.follows = "hs-flake-utils/nixpkgs";
    
          url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-chk?ref=refs/tags/0.2.0.0";
    
          inputs.nixpkgs.follows = "hs-flake-utils/nixpkgs";
        };
    
        tahoe-capabilities = {
          url = "git+https://whetstone.private.storage/PrivateStorage/tahoe-capabilities";
          inputs.nixpkgs.follows = "hs-flake-utils/nixpkgs";
        };
    
      };
    
      outputs = {
        self,
        nixpkgs,
        flake-utils,
        hs-flake-utils,
    
      }: let
        ulib = flake-utils.lib;
        ghcVersion = "ghc8107";
      in
        ulib.eachSystem ["x86_64-linux" "aarch64-darwin"] (system: let
          # Get a nixpkgs customized for this system
          pkgs = import nixpkgs {
            inherit system;
          };
          hslib = hs-flake-utils.lib {
            inherit pkgs;
            src = ./.;
            compilerVersion = ghcVersion;
            packageName = "tahoe-ssk";
    
            hsPkgsOverrides = hprev: hfinal: {
              tahoe-chk = tahoe-chk.outputs.packages.${system}.default;
    
              tahoe-capabilities = tahoe-capabilities.outputs.packages.${system}.default;
    
          };
        in {
          checks = hslib.checks {};
          devShells = hslib.devShells {
    
              nix run .#generate-cabal-project
    
            extraBuildInputs = pkgs:
              with pkgs; [
                zlib
              ];
          };
          packages = hslib.packages {};
    
          apps.hlint = hslib.apps.hlint {};
    
    
          apps.generate-cabal-project = {
            type = "app";
            program = "${
              pkgs.writeShellApplication {
                name = "generate-cabal-project";
                text = ''
                  cat >cabal.project.local <<EOF
                  -- This file is auto-generated by the flake devShell's shellHook.  Do
                  -- not edit this file.  Make changes in flake.nix.
                  tests: true
                  packages:
                    -- These aren't released on hackage yet so we have to get them
                    -- another way.  Here, we get them from the Nix store.
                    -- tahoe-chk
                    ${tahoe-chk}
    
                    -- tahoe-capabilities
                    ${tahoe-capabilities}
    
          apps.cabal-test = hslib.apps.cabal-test {
            preBuild = "nix run .#generate-cabal-project";
    
    
          apps.release = hslib.apps.release {};