From 1280e65031f6aa35b86c0235bdbe3ac5238fa177 Mon Sep 17 00:00:00 2001 From: Marty Sluijtman Date: Sun, 10 Mar 2024 18:55:58 +0100 Subject: [PATCH] Less lazy packaging --- flake.nix | 33 +++------------------------------ package.nix | 11 +++++++++++ 2 files changed, 14 insertions(+), 30 deletions(-) create mode 100644 package.nix diff --git a/flake.nix b/flake.nix index 67032c5..32a949d 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,4 @@ -# SPDX-FileCopyrightText: 2021 Serokell -# -# SPDX-License-Identifier: CC0-1.0 - -{ - description = "generate a index of gemtext files"; +{ description = "generate a index of gemtext files"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs"; @@ -15,30 +10,8 @@ let pkgs = nixpkgs.legacyPackages.${system}; - haskellPackages = pkgs.haskellPackages; - - jailbreakUnbreak = pkg: - pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; })); - - # DON'T FORGET TO PUT YOUR PACKAGE NAME HERE, REMOVING `throw` - packageName = "twin"; + compiler = "ghc94"; in { - packages.${packageName} = - haskellPackages.callCabal2nix packageName self rec { - # Dependency overrides go here - }; - - packages.default = self.packages.${system}.${packageName}; - defaultPackage = self.packages.${system}.default; - - devShells.default = pkgs.mkShell { - buildInputs = with pkgs; [ - haskellPackages.haskell-language-server # you must build it with your ghc to work - ghcid - cabal-install - ]; - inputsFrom = map (__getAttr "env") (__attrValues self.packages.${system}); - }; - devShell = self.devShells.${system}.default; + packages.default = pkgs.haskell.packages.${compiler}.callPackage ./package.nix { }; }); } diff --git a/package.nix b/package.nix new file mode 100644 index 0000000..5076c50 --- /dev/null +++ b/package.nix @@ -0,0 +1,11 @@ +{ mkDerivation, base, directory, lib, optparse-applicative }: +mkDerivation { + pname = "twin"; + version = "0.1.0.0"; + src = ./.; + isLibrary = false; + isExecutable = true; + executableHaskellDepends = [ base directory optparse-applicative ]; + license = lib.licenses.agpl3Plus; + mainProgram = "twin"; +}