diff --git a/.gitignore b/.gitignore index 101933f..a11b5a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /.nix-script-cache +/dist-newstyle /result diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a49e634 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for nix-script + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2dac132 --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright 2021 Brian Hicks + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/nix-script.hs b/Main.hs similarity index 99% rename from nix-script.hs rename to Main.hs index 5abc41e..771fd01 100755 --- a/nix-script.hs +++ b/Main.hs @@ -1,5 +1,3 @@ -#!/usr/bin/env runghc - {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE NoImplicitPrelude #-} diff --git a/Setup.hs b/Setup.hs new file mode 100644 index 0000000..9a994af --- /dev/null +++ b/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..f564b1d --- /dev/null +++ b/default.nix @@ -0,0 +1,3 @@ +{ sources ? import ./nix/sources.nix { }, pkgs ? import sources.nixpkgs { }, ... +}: +pkgs.haskellPackages.callCabal2nix "nix-script" ./. { } diff --git a/nix-script.cabal b/nix-script.cabal new file mode 100644 index 0000000..e98eda4 --- /dev/null +++ b/nix-script.cabal @@ -0,0 +1,35 @@ +cabal-version: >=1.10 +-- Initial package description 'nix-script.cabal' generated by 'cabal +-- init'. For further documentation, see +-- http://haskell.org/cabal/users-guide/ + +name: nix-script +version: 0.1.0.0 +-- synopsis: +-- description: +-- bug-reports: +-- license: +license-file: LICENSE +author: Brian Hicks +maintainer: brian@brianthicks.com +-- copyright: +-- category: +build-type: Simple +extra-source-files: CHANGELOG.md + +executable nix-script + main-is: Main.hs + -- other-modules: + -- other-extensions: + build-depends: base >=4.12 && <4.13 + , base16-bytestring == 0.1.1.6 + , cryptohash-sha256 == 0.11.101.0 + , directory == 1.3.3.0 + , filepath == 1.4.2.1 + , neat-interpolation == 0.3.2.6 + , process == 1.6.5.0 + , relude == 0.5.0 + , text == 1.2.3.1 + , utf8-string == 1.0.1.1 + -- hs-source-dirs: + default-language: Haskell2010 diff --git a/shell.nix b/shell.nix index caa499b..63bbeb9 100644 --- a/shell.nix +++ b/shell.nix @@ -4,19 +4,7 @@ let nixpkgs = import sources.nixpkgs { }; niv = import sources.niv { }; in with nixpkgs; -stdenv.mkDerivation { - name = "nix-script"; - buildInputs = [ - niv.niv - git - (haskellPackages.ghcWithPackages (ps: [ - ps.base16-bytestring - ps.cryptohash-sha256 - ps.neat-interpolation - ps.relude - ps.text - ps.utf8-string - ])) - haskellPackages.ormolu - ]; +pkgs.mkShell { + inputsFrom = [ (haskellPackages.callCabal2nix "nix-script" ./. { }).env ]; + buildInputs = [ niv.niv git cabal-install haskellPackages.ormolu ]; }