From c082385a7fb2f4c98e59d7642090b3096a66fc51 Mon Sep 17 00:00:00 2001 From: Sridhar Ratnakumar Date: Sun, 22 May 2022 14:53:04 -0400 Subject: [PATCH] readme: mention 'nix run' --- README.md | 1 + flake.nix | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 86de45a..5cc06c3 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ git add . && git commit -m rename - Run `nix flake update` to update all flake inputs. - Run `treefmt` in nix shell to autoformat the project. This uses [treefmt](https://github.com/numtide/treefmt), which uses `./treefmt.toml` (where fourmolu and nixpkgs-fmt are specified). - Run `bin/hoogle` to start Hoogle with packages in your cabal file. +- Run the application without installing: `nix run github:srid/haskell-template` (or `nix run .` from checkout) ## Alternatives diff --git a/flake.nix b/flake.nix index ea7c969..39edc8f 100644 --- a/flake.nix +++ b/flake.nix @@ -21,6 +21,8 @@ inputs.flake-utils.lib.eachDefaultSystem (system: let + name = "haskell-template"; + # Because: https://zimbatm.com/notes/1000-instances-of-nixpkgs pkgs = inputs.nixpkgs.legacyPackages.${system}; inherit (pkgs.lib.lists) optionals; @@ -46,8 +48,7 @@ , withHoogle ? false }: hp.developPackage { - inherit returnShellEnv withHoogle; - name = "haskell-template"; + inherit returnShellEnv withHoogle name; root = ./.; overrides = self: super: with pkgs.haskell.lib; { # Use callCabal2nix to override Haskell dependencies here @@ -74,7 +75,7 @@ apps = { default = { type = "app"; - program = "${inputs.self.packages.${system}.default}/bin/haskell-template"; + program = "${inputs.self.packages.${system}.default}/bin/${name}"; }; }; # Used by `nix develop ...`