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

View file

@ -1,57 +1,47 @@
{ description = "quox: quantitative extensional type theory"; { description = "quox: quantitative extensional type theory";
inputs = { inputs = {
nixpkgs.url = "nixpkgs/21.11"; tap.url = "git+https://git.rhiannon.website/rhi/idris2-tap?ref=main";
nixpkgs.follows = "tap/nixpkgs";
flake-utils = { flake-utils.follows = "tap/flake-utils";
url = "github:numtide/flake-utils"; idris2-pkgs.follows = "tap/idris2-pkgs";
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";
};
}; };
outputs = { self, nixpkgs, idris2-pkgs, flake-utils, tap }: 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 ]; [ x86_64-darwin x86_64-linux i686-linux ];
in in
with builtins;
flake-utils.lib.eachSystem systems (system: flake-utils.lib.eachSystem systems (system:
let let
pkgs = import nixpkgs { basePkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ idris2-pkgs.overlay ]; 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 { packages = mapAttrs mkPackage packagePaths;
quox-lib = ipkg ./lib { }; devShells = mapAttrs mkDevShell packages;
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;
in { in {
inherit packages devShells; inherit packages devShells;
defaultPackage = packages.quox; defaultPackage = packages.quox;
devShell = devShells.lib; devShell = devShells.quox-lib;
} }
); );
} }