add flake.nix

This commit is contained in:
DavHau 2022-03-10 10:49:23 +07:00
parent f0f16b98b7
commit 44cff913ca
2 changed files with 82 additions and 0 deletions

42
flake.lock Normal file
View File

@ -0,0 +1,42 @@
{
"nodes": {
"nix": {
"flake": false,
"locked": {
"lastModified": 1570712626,
"narHash": "sha256-R3yyxSlyz41cLbB6F54etKNkusPNPGHU0WZkSrfJoKU=",
"owner": "NixOS",
"repo": "nix",
"rev": "61e816217bfdfffd39c130c7cd24f07e640098fc",
"type": "github"
},
"original": {
"id": "nix",
"rev": "61e816217bfdfffd39c130c7cd24f07e640098fc",
"type": "indirect"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1635792138,
"narHash": "sha256-D79GqaYrwgyM4wvOPbQeKveAHROnVh97F36iSGZO9uA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b165ce0c4efbb74246714b5c66b6bcdce8cde175",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"nix": "nix",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

40
flake.nix Normal file
View File

@ -0,0 +1,40 @@
{
description = "A Haskell re-implementation of the Nix expression language";
inputs = {
nixpkgs.url = "nixpkgs";
nix = {
url = "nix/61e816217bfdfffd39c130c7cd24f07e640098fc";
flake = false;
};
};
outputs = {
nix,
nixpkgs,
self,
} @ inp: let
l = builtins //nixpkgs.lib;
supportedSystems = ["x86_64-linux"];
forAllSystems = f: l.genAttrs supportedSystems
(system: f system (nixpkgs.legacyPackages.${system}));
in {
defaultPackage = forAllSystems
(system: pkgs: import ./default.nix {
inherit pkgs;
withHoogle = true;
compiler = "ghc8107";
packageRoot = pkgs.runCommand "hnix-src" {} ''
cp -r ${./.} $out
chmod -R +w $out
cp -r ${nix} $out/data/nix
'';
});
devShell = forAllSystems (system: pkgs: self.defaultPackage.${system}.env);
};
}