diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c02a406 --- /dev/null +++ b/flake.lock @@ -0,0 +1,64 @@ +{ + "nodes": { + "easy-hls": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1637250802, + "narHash": "sha256-/crlHEVB148PGQLZCsHOR9L5qgvCAfRSocIoKgmMAhA=", + "owner": "jkachmar", + "repo": "easy-hls-nix", + "rev": "7c123399ef8a67dc0e505d9cf7f2c7f64f1cd847", + "type": "github" + }, + "original": { + "owner": "jkachmar", + "repo": "easy-hls-nix", + "type": "github" + } + }, + "flake-utils": { + "locked": { + "lastModified": 1637014545, + "narHash": "sha256-26IZAc5yzlD9FlDT54io1oqG/bBoyka+FJk5guaX4x4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "bba5dcc8e0b20ab664967ad83d24d64cb64ec4f4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1637841632, + "narHash": "sha256-QYqiKHdda0EOnLGQCHE+GluD/Lq2EJj4hVTooPM55Ic=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "73369f8d0864854d1acfa7f1e6217f7d6b6e3fa1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "easy-hls": "easy-hls", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4b72597 --- /dev/null +++ b/flake.nix @@ -0,0 +1,51 @@ +{ + description = "rauhala.info"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + easy-hls = { + url = "github:jkachmar/easy-hls-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, flake-utils, easy-hls }: + { + overlay = final: prev: { + build-rauhala-info = final.haskellPackages.build-rauhala-info; + rauhala-info = final.callPackage ./rauhala.info { site = final.build-rauhala-info; }; + haskellPackages = prev.haskellPackages.override ( old: { + overrides = final.lib.composeExtensions ( old.overrides or (_: _: {})) (f: p: { + build-rauhala-info = f.callPackage ./site {}; + }); + } ); + }; + } + // + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; overlays = [ self.overlay ]; }; + hp = pkgs.haskellPackages; + hls = easy-hls.defaultPackage.${system}; + in + rec { + packages = { inherit (pkgs) build-rauhala-info rauhala-info; }; + applications.build-rauhala-info = flake-utils.lib.mkApp { + drv = packages.build-rauhala-info; + exePath = "/bin/site"; + }; + defaultPackage = packages.rauhala-info; + defaultApp = applications.build-rauhala-info; + devShell = hp.shellFor { + packages = h: [h.build-rauhala-info]; + buildInputs = with pkgs; [ + ghcid + cabal-install + stylish-haskell + entr + hls + ]; + }; + }); +} diff --git a/rauhala.info/.envrc b/rauhala.info/.envrc deleted file mode 100644 index 1d953f4..0000000 --- a/rauhala.info/.envrc +++ /dev/null @@ -1 +0,0 @@ -use nix diff --git a/rauhala.info/shell.nix b/rauhala.info/shell.nix deleted file mode 100644 index a3eb7d3..0000000 --- a/rauhala.info/shell.nix +++ /dev/null @@ -1,10 +0,0 @@ -with (import {}); - -let site = haskellPackages.callPackage ../site {}; - -in - -mkShell { - buildInputs = [ site ]; -} - diff --git a/site/.envrc b/site/.envrc deleted file mode 100644 index 1d953f4..0000000 --- a/site/.envrc +++ /dev/null @@ -1 +0,0 @@ -use nix diff --git a/site/default.nix b/site/default.nix index d5a9adf..dd9385e 100644 --- a/site/default.nix +++ b/site/default.nix @@ -1,4 +1,4 @@ -{ mkDerivation, base, filepath, hakyll, stdenv, time }: +{ mkDerivation, base, filepath, hakyll, lib, time }: mkDerivation { pname = "site"; version = "0.1.0.0"; @@ -6,5 +6,5 @@ mkDerivation { isLibrary = false; isExecutable = true; executableHaskellDepends = [ base filepath hakyll time ]; - license = stdenv.lib.licenses.bsd3; + license = lib.licenses.bsd3; } diff --git a/site/shell.nix b/site/shell.nix deleted file mode 100644 index cbf6d05..0000000 --- a/site/shell.nix +++ /dev/null @@ -1,16 +0,0 @@ -with (import {}); - -let site = haskellPackages.callPackage ./. {}; - -in - -mkShell { - buildInputs = [ - ghcid - stylish-haskell - haskellPackages.cabal-install - hlint - (haskellPackages.ghcWithPackages (_: site.buildInputs ++ site.propagatedBuildInputs)) - ]; -} -