nix flake

This commit is contained in:
xenofem 2022-04-15 23:27:29 -04:00
parent b63e8865e3
commit 69e44b9cbe
2 changed files with 160 additions and 0 deletions

111
flake.lock Normal file
View file

@ -0,0 +1,111 @@
{
"nodes": {
"crate2nix": {
"flake": false,
"locked": {
"lastModified": 1646322090,
"narHash": "sha256-Jtqd5Ory+1LgMMTY0tNJKd/U2mOiPRd/oYnuyTHE08o=",
"owner": "kolloch",
"repo": "crate2nix",
"rev": "c4a479172ebafdd3baf36aa274b2168b4fd42f40",
"type": "github"
},
"original": {
"owner": "kolloch",
"repo": "crate2nix",
"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": 1650078108,
"narHash": "sha256-DcbBWvbO8o/kKUbJd06goMlltmE2rk0v3flFO9I9U/E=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "66c99f5c6037655e4388091728d9c6b0735d5f8e",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "66c99f5c6037655e4388091728d9c6b0735d5f8e",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1637453606,
"narHash": "sha256-Gy6cwUswft9xqsjWxFYEnx/63/qzaFUwatcbV5GF/GQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8afc4e543663ca0a6a4f496262cd05233737e732",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crate2nix": "crate2nix",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1650076354,
"narHash": "sha256-HgHeh+VOuvSBSM7kAORcy4aMJ4LuOiWBegOGSIzi7nI=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "d154de7dae2da8b52084ddbfe95ce6e5b0ba0a37",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1649676176,
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

49
flake.nix Normal file
View file

@ -0,0 +1,49 @@
{
description = "Better web UI for COVID wastewater data";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/66c99f5c6037655e4388091728d9c6b0735d5f8e";
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
crate2nix = {
url = "github:kolloch/crate2nix";
flake = false;
};
};
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix }: let
name = "poop-graph";
in
utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlay
(final: prev: {
rustc = final.rust-bin.stable.latest.default;
cargo = final.rust-bin.stable.latest.default;
})
];
};
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
generatedCargoNix;
project = import
(generatedCargoNix {
inherit name;
src = ./.;
})
{ inherit pkgs; };
in rec {
packages.${name} = project.rootCrate.build;
defaultPackage = packages.${name};
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [ rustc cargo cargo-audit stdenv.cc ];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);
}