From 7fd400b1c548b275ea925fcbdd7618a4160302d8 Mon Sep 17 00:00:00 2001 From: Peter Becich Date: Sat, 22 Jun 2024 23:38:37 -0700 Subject: [PATCH] more simplification of Nix Flake https://github.com/srid/haskell-flake/discussions/330#discussioncomment-9848411 --- flake.nix | 58 ++++++++++++++++++++++--------------------------------- 1 file changed, 23 insertions(+), 35 deletions(-) diff --git a/flake.nix b/flake.nix index e37e52c4..4064f78b 100644 --- a/flake.nix +++ b/flake.nix @@ -15,42 +15,30 @@ inputs.flake-root.flakeModule ]; perSystem = { self', system, lib, config, pkgs, ... }: { - apps.default = { - type = "app"; - program = - let - run-hackage-server = pkgs.writeShellApplication { - name = "run-hackage-server"; - runtimeInputs = [ config.packages.default ]; - text = '' - if [ ! -d "state" ]; then - hackage-server init --static-dir=datafiles --state-dir=state - else - echo "'state' state-dir already exists" - fi - hackage-server run \ - --static-dir=datafiles \ - --state-dir=state \ - --base-uri=http://127.0.0.1:8080 - ''; - }; - in "${lib.getExe run-hackage-server}"; + apps.default.program = pkgs.writeShellApplication { + name = "run-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + if [ ! -d "state" ]; then + hackage-server init --static-dir=datafiles --state-dir=state + else + echo "'state' state-dir already exists" + fi + hackage-server run \ + --static-dir=datafiles \ + --state-dir=state \ + --base-uri=http://127.0.0.1:8080 + ''; }; - apps.mirror-hackage-server = { - type = "app"; - program = - let - mirror-hackage-server = pkgs.writeShellApplication { - name = "mirror-hackage-server"; - runtimeInputs = [ config.packages.default ]; - text = '' - echo 'Copying packages from real Hackage Server into local Hackage Server.' - echo 'This assumes the local Hackage Server uses default credentials;' - echo 'otherwise, override in nix-default-servers.cfg' - hackage-mirror nix-default-servers.cfg - ''; - }; - in "${lib.getExe mirror-hackage-server}"; + apps.mirror-hackage-server.program = pkgs.writeShellApplication { + name = "mirror-hackage-server"; + runtimeInputs = [ config.packages.default ]; + text = '' + echo 'Copying packages from real Hackage Server into local Hackage Server.' + echo 'This assumes the local Hackage Server uses default credentials;' + echo 'otherwise, override in nix-default-servers.cfg' + hackage-mirror nix-default-servers.cfg + ''; }; packages.default = config.packages.hackage-server; haskellProjects.default = {