messing with nix again

This commit is contained in:
rhiannon morris 2022-06-19 14:22:58 +02:00
parent da91f7d95e
commit 220a87f8a6
2 changed files with 46 additions and 51 deletions

View file

@ -114,11 +114,11 @@
},
"flake-utils": {
"locked": {
"lastModified": 1652776076,
"narHash": "sha256-gzTw/v1vj4dOVbpBSJX4J0DwUR6LIyXo7/SuuTJp1kM=",
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "04c1b180862888302ddfb2e3ad9eaa63afc60cf8",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
@ -250,6 +250,7 @@
"effect": "effect",
"elab-util": "elab-util",
"flake-utils": [
"tap",
"flake-utils"
],
"frex": "frex",
@ -266,6 +267,7 @@
"katla": "katla",
"lsp": "lsp",
"nixpkgs": [
"tap",
"nixpkgs"
],
"odf": "odf",
@ -485,9 +487,18 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"idris2-pkgs": "idris2-pkgs",
"nixpkgs": "nixpkgs",
"flake-utils": [
"tap",
"flake-utils"
],
"idris2-pkgs": [
"tap",
"idris2-pkgs"
],
"nixpkgs": [
"tap",
"nixpkgs"
],
"tap": "tap"
}
},
@ -541,15 +552,9 @@
},
"tap": {
"inputs": {
"flake-utils": [
"flake-utils"
],
"idris2-pkgs": [
"idris2-pkgs"
],
"nixpkgs": [
"nixpkgs"
]
"flake-utils": "flake-utils",
"idris2-pkgs": "idris2-pkgs",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1653664911,

View file

@ -1,57 +1,47 @@
{ description = "quox: quantitative extensional type theory";
inputs = {
nixpkgs.url = "nixpkgs/21.11";
flake-utils = {
url = "github:numtide/flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
idris2-pkgs = {
url = "github:claymager/idris2-pkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.nixpkgs.follows = "nixpkgs";
};
tap = {
url = "git+https://git.rhiannon.website/rhi/idris2-tap?ref=main";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
inputs.idris2-pkgs.follows = "idris2-pkgs";
};
tap.url = "git+https://git.rhiannon.website/rhi/idris2-tap?ref=main";
nixpkgs.follows = "tap/nixpkgs";
flake-utils.follows = "tap/flake-utils";
idris2-pkgs.follows = "tap/idris2-pkgs";
};
outputs = { self, nixpkgs, idris2-pkgs, flake-utils, tap }:
let systems = with flake-utils.lib.system;
let
packagePaths = {
quox-lib = ./lib;
quox = ./exe;
quox-tests = ./tests;
};
extraDeps = [ tap ];
systems = with flake-utils.lib.system;
[ x86_64-darwin x86_64-linux i686-linux ];
in
with builtins;
flake-utils.lib.eachSystem systems (system:
let
pkgs = import nixpkgs {
basePkgs = import nixpkgs {
inherit system;
overlays = [ idris2-pkgs.overlay ];
};
builders = pkgs.idris2-pkgs._builders;
builders = basePkgs.idris2-pkgs._builders;
testDeps = tap.packages.${system};
extraDepPkgs =
foldl' (acc: pkg: acc // pkg.packages.${system}) { } extraDeps;
mkPackage = name: path:
builders.idrisPackage path { extraPkgs = extraDepPkgs // packages; };
mkDevShell = _: pkg:
basePkgs.mkShell { buildInputs = [ (builders.devEnv pkg) ]; };
packages = let ipkg = builders.idrisPackage; in rec {
quox-lib = ipkg ./lib { };
quox = ipkg ./exe { extraPkgs = packages; };
quox-tests = ipkg ./tests { extraPkgs = packages // testDeps; };
};
devShells =
let mkDevShell = _: pkg:
pkgs.mkShell { buildInputs = [ (builders.devEnv pkg) ]; };
shells = packages // (with packages;
{ exe = quox; lib = quox-lib; tests = quox-tests; });
in builtins.mapAttrs mkDevShell shells;
packages = mapAttrs mkPackage packagePaths;
devShells = mapAttrs mkDevShell packages;
in {
inherit packages devShells;
defaultPackage = packages.quox;
devShell = devShells.lib;
devShell = devShells.quox-lib;
}
);
}