From 8f5e85b203560fa7866ae2e5c011485a24265c9e Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Tue, 17 May 2022 16:42:14 +0200 Subject: [PATCH] flake copied over from puzzld --- flake.lock | 42 ++++++++++++++++++++++++++++++++++++++++++ flake.nix | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..ee33796 --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1649676176, + "narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1650974676, + "narHash": "sha256-s1l10UXYd6EIBWm7s3h7oeRFGssv+LOtYqeDDW0gz4Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5f3eeb9c5282b8c0f3cfe3397b8dc500dfc420b4", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b5c18db --- /dev/null +++ b/flake.nix @@ -0,0 +1,43 @@ +{ + inputs = { + nixpkgs.url = "github:nixos/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = nixpkgs.legacyPackages.${system}; + t = pkgs.lib.trivial; + hl = pkgs.haskell.lib; + + name = "puzzld"; + + project = devTools: + let addBuildTools = (t.flip hl.addBuildTools) devTools; + in pkgs.haskellPackages.developPackage { + root = pkgs.lib.sourceFilesBySuffices ./. [ ".cabal" ".hs" "LICENSE" ]; + name = name; + returnShellEnv = !(devTools == [ ]); + + modifier = (t.flip t.pipe) [ + addBuildTools + hl.dontHaddock + hl.enableStaticLibraries + hl.justStaticExecutables + hl.disableLibraryProfiling + hl.disableExecutableProfiling + ]; + }; + + in { + packages.puzzle-draw = project [ ]; + + defaultPackage = self.packages.${system}.puzzle-draw; + + devShell = project (with pkgs.haskellPackages; [ + pkgs.haskellPackages.cabal-fmt + pkgs.haskellPackages.cabal-install + ]); + }); +}