diff --git a/.gitignore b/.gitignore index e453cba..558f2f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ elm-stuff index.html +result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1458f55 --- /dev/null +++ b/default.nix @@ -0,0 +1,26 @@ +{ sources ? import ./nix/sources.nix { }, nixpkgs ? import sources.nixpkgs { } +}: +let gitignore = nixpkgs.callPackage sources.gitignore { }; +in nixpkgs.stdenv.mkDerivation { + name = "bad-datalog"; + + src = gitignore.gitignoreSource ./.; + buildInputs = [ nixpkgs.elmPackages.elm ]; + + buildPhase = nixpkgs.elmPackages.fetchElmDeps { + elmPackages = import ./nix/elm-srcs.nix; + elmVersion = "0.19.1"; + registryDat = ./nix/registry.dat; + }; + + # it's a little weird that elm2nix says it's fine to build in the install + # phase, but who am I to judge? + installPhase = '' + mkdir -p $out/share/bad-datalog + + ( + cd sample-app + elm make src/Main.elm --output $out/share/bad-datalog/index.html + ) + ''; +} diff --git a/nix/sources.json b/nix/sources.json index eb48b0d..5e8a728 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,4 +1,16 @@ { + "gitignore": { + "branch": "master", + "description": "Nix function for filtering local git sources", + "homepage": "", + "owner": "hercules-ci", + "repo": "gitignore", + "rev": "211907489e9f198594c0eb0ca9256a1949c9d412", + "sha256": "06j7wpvj54khw0z10fjyi31kpafkr6hi1k0di13k1xp8kywvfyx8", + "type": "tarball", + "url": "https://github.com/hercules-ci/gitignore/archive/211907489e9f198594c0eb0ca9256a1949c9d412.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "niv": { "branch": "master", "description": "Easy dependency management for Nix projects",