@@ -0,0 +1,4 @@ | |||||
result | |||||
result-doc | |||||
*.swp | |||||
@@ -0,0 +1,2 @@ | |||||
if u use dis repo u agree to not be a chud. | |||||
military and corps get out. |
@@ -0,0 +1,4 @@ | |||||
module Main where | |||||
main :: IO () | |||||
main = putStrLn "Hello, Haskell!" |
@@ -0,0 +1,46 @@ | |||||
# Skeleton Haskell Flake | |||||
included is my attempt at a bare bones haskell project, implemented as a nix flake in order to allow reproducible builds. | |||||
## building | |||||
allows usage within `nix shell`, assuming a flakes system, with the followng: | |||||
``` | |||||
nix shell github:techieAgnostic/haskeleton#haskeleton | |||||
``` | |||||
otherwise it can be built normally with: | |||||
``` | |||||
nix build. | |||||
``` | |||||
or added to a system configuration by creating an input: | |||||
``` | |||||
inputs.haskeleton.url = "github:techieAgnostic/haskeleton"; | |||||
``` | |||||
and using the `haskeleton.overlay` attribute to import the program into your pkgset. | |||||
## adding hackage dependencies | |||||
dependencies can be added to the `haskeleton.cabal` file as normal. the `haskeleton.nix` file must be regenerated once this happens. | |||||
> !!!important!!! | |||||
in order for this to work without manual editing of `haskeleton.nix`, the command must be run from the `./nix` directory. | |||||
``` | |||||
cd ./nix | |||||
cabal2nix ../ > haskeleton.nix | |||||
``` | |||||
for packages not in the nixpkgs repository, or that you would like to have a different version of than appears in the repo, you can add them to the `./nix` directory manually like so: | |||||
``` | |||||
cabal2nix cabal://name-version > ./nix/name.nix | |||||
``` | |||||
and in order to disable building tests, documentation, or to jailbreak the dependencies of a package (should the build fail for those reasons), add the packages name to the lists defined in `./release.nix`. |
@@ -0,0 +1,2 @@ | |||||
import Distribution.Simple | |||||
main = defaultMain |
@@ -0,0 +1,43 @@ | |||||
{ | |||||
"nodes": { | |||||
"flake-utils": { | |||||
"locked": { | |||||
"lastModified": 1601282935, | |||||
"narHash": "sha256-WQAFV6sGGQxrRs3a+/Yj9xUYvhTpukQJIcMbIi7LCJ4=", | |||||
"owner": "numtide", | |||||
"repo": "flake-utils", | |||||
"rev": "588973065fce51f4763287f0fda87a174d78bf48", | |||||
"type": "github" | |||||
}, | |||||
"original": { | |||||
"owner": "numtide", | |||||
"repo": "flake-utils", | |||||
"type": "github" | |||||
} | |||||
}, | |||||
"nixpkgs": { | |||||
"locked": { | |||||
"lastModified": 1604368813, | |||||
"narHash": "sha256-UOLaURSO448k+4bGJlaSMYeo2F5F6CuFo9VoYDkhmsk=", | |||||
"owner": "NixOS", | |||||
"repo": "nixpkgs", | |||||
"rev": "d105075a1fd870b1d1617a6008cb38b443e65433", | |||||
"type": "github" | |||||
}, | |||||
"original": { | |||||
"owner": "NixOS", | |||||
"ref": "nixos-20.09", | |||||
"repo": "nixpkgs", | |||||
"type": "github" | |||||
} | |||||
}, | |||||
"root": { | |||||
"inputs": { | |||||
"flake-utils": "flake-utils", | |||||
"nixpkgs": "nixpkgs" | |||||
} | |||||
} | |||||
}, | |||||
"root": "root", | |||||
"version": 7 | |||||
} |
@@ -0,0 +1,19 @@ | |||||
{ | |||||
description = "a skeleton haskell flake"; | |||||
inputs = { | |||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; | |||||
flake-utils.url = "github:numtide/flake-utils"; | |||||
}; | |||||
outputs = { self, nixpkgs, flake-utils, ... }: | |||||
flake-utils.lib.eachDefaultSystem (system: | |||||
let | |||||
pkgs = import nixpkgs { | |||||
overlays = [ (import ./overlay.nix) ]; | |||||
inherit system; | |||||
}; | |||||
in { | |||||
defaultPackage = pkgs.haskeleton; | |||||
}) // { | |||||
overlay = import ./overlay.nix; | |||||
}; | |||||
} |
@@ -0,0 +1,27 @@ | |||||
cabal-version: >=1.10 | |||||
-- Initial package description 'haskeleton.cabal' generated by 'cabal | |||||
-- init'. For further documentation, see | |||||
-- http://haskell.org/cabal/users-guide/ | |||||
name: haskeleton | |||||
version: 0.1.0.0 | |||||
-- synopsis: | |||||
-- description: | |||||
-- bug-reports: | |||||
-- license: | |||||
license-file: LICENSE | |||||
author: Thorn Avery | |||||
maintainer: s@p7.co.nz | |||||
-- copyright: | |||||
-- category: | |||||
build-type: Simple | |||||
executable haskeleton | |||||
main-is: Main.hs | |||||
-- other-modules: | |||||
-- other-extensions: | |||||
build-depends: base >=4.13 && <4.14 | |||||
, text | |||||
, aeson | |||||
-- hs-source-dirs: | |||||
default-language: Haskell2010 |
@@ -0,0 +1,11 @@ | |||||
{ mkDerivation, aeson, base, stdenv, text }: | |||||
mkDerivation { | |||||
pname = "haskeleton"; | |||||
version = "0.1.0.0"; | |||||
src = ./..; | |||||
isLibrary = false; | |||||
isExecutable = true; | |||||
executableHaskellDepends = [ aeson base text ]; | |||||
license = "unknown"; | |||||
hydraPlatforms = stdenv.lib.platforms.none; | |||||
} |
@@ -0,0 +1,3 @@ | |||||
final: prev: { | |||||
haskeleton = (import ./release.nix) prev; | |||||
} |
@@ -0,0 +1,47 @@ | |||||
bspkgs: | |||||
let | |||||
dontCheckPackages = [ ]; | |||||
doJailbreakPackages = [ ]; | |||||
dontHaddockPackages = [ ]; | |||||
config = { | |||||
packageOverrides = pkgs: rec { | |||||
haskellPackages = | |||||
let | |||||
generatedOverrides = haskellPackagesNew: haskellPackagesOld: | |||||
let | |||||
toPackage = file: _: { | |||||
name = builtins.replaceStrings [ ".nix" ] [ "" ] file; | |||||
value = haskellPackagesNew.callPackage | |||||
( ./. + "/nix/${file}") { }; | |||||
}; | |||||
in | |||||
pkgs.lib.mapAttrs' toPackage | |||||
(builtins.readDir ./nix); | |||||
makeOverrides = | |||||
function: names: haskellPackagesNew: haskellPackagesOld: | |||||
let | |||||
toPackage = name: { | |||||
inherit name; | |||||
value = function haskellPackagesOld.${name}; | |||||
}; | |||||
in | |||||
builtins.listToAttrs (map toPackage names); | |||||
composeExtensionsList = | |||||
pkgs.lib.fold pkgs.lib.composeExtensions (_: _: {}); | |||||
manualOverrides = haskellPackagesNew: haskellPackagesOld: { | |||||
}; | |||||
in | |||||
pkgs.haskellPackages.override { | |||||
overrides = composeExtensionsList [ | |||||
generatedOverrides | |||||
(makeOverrides pkgs.haskell.lib.dontCheck dontCheckPackages) | |||||
(makeOverrides pkgs.haskell.lib.doJailbreak doJailbreakPackages) | |||||
(makeOverrides pkgs.haskell.lib.dontHaddock dontHaddockPackages) | |||||
manualOverrides | |||||
]; | |||||
}; | |||||
}; | |||||
}; | |||||
pkgs = import bspkgs.path { inherit config; system = bspkgs.system; }; | |||||
in | |||||
pkgs.haskellPackages.haskeleton |