Various flake improvements

axtloss/rework-partitioning
Michal S 2 years ago committed by Michal
parent 36ae6401d7
commit 306ffc58c0

@ -0,0 +1 @@
use flake

2
.gitignore vendored

@ -1,2 +1,2 @@
/target /target
Cargo.lock /.direnv

@ -1,8 +1,31 @@
{ {
"nodes": { "nodes": {
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1662533965,
"narHash": "sha256-56td0N02VeIOuzyesNWLCwTcoVwP0wuQauUbzh6RpMg=",
"owner": "nix-community",
"repo": "fenix",
"rev": "b5b70debeb3c2f93186eaed7de13674b9783b9d2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"naersk": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": [
"nixpkgs"
]
}, },
"locked": { "locked": {
"lastModified": 1662220400, "lastModified": 1662220400,
@ -19,20 +42,6 @@
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": {
"lastModified": 1662096612,
"narHash": "sha256-R+Q8l5JuyJryRPdiIaYpO5O3A55rT+/pItBrKcy7LM4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "21de2b973f9fee595a7a1ac4693efff791245c34",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1662410893, "lastModified": 1662410893,
"narHash": "sha256-jmZjdA/n92OpUdaEjU7QJNsa1np+u+JWDj300x3K3XY=", "narHash": "sha256-jmZjdA/n92OpUdaEjU7QJNsa1np+u+JWDj300x3K3XY=",
@ -49,11 +58,29 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"fenix": "fenix",
"naersk": "naersk", "naersk": "naersk",
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"utils": "utils" "utils": "utils"
} }
}, },
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1662377094,
"narHash": "sha256-0bvOQxEe8nzk/VlhHBrUn/Mz3DlE92Us7JqveVjTe0A=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "6dfd8aebdfa1ee1824446f01daf5bdb229b32f92",
"type": "github"
},
"original": {
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},
"utils": { "utils": {
"locked": { "locked": {
"lastModified": 1659877975, "lastModified": 1659877975,

@ -2,38 +2,66 @@
inputs = { inputs = {
nixpkgs.url = "github:nixos/nixpkgs"; nixpkgs.url = "github:nixos/nixpkgs";
utils.url = "github:numtide/flake-utils"; utils.url = "github:numtide/flake-utils";
naersk.url = "github:nix-community/naersk"; naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { self, nixpkgs, utils, naersk }: outputs = {
utils.lib.eachDefaultSystem (system: self,
let nixpkgs,
pkgs = nixpkgs.legacyPackages."${system}"; utils,
naersk-lib = naersk.lib."${system}"; naersk,
in rec fenix,
{ ...
packages.jade = naersk-lib.buildPackage { }:
pname = "jade"; utils.lib.eachDefaultSystem (system: let
root = ./.; pkgs = nixpkgs.legacyPackages."${system}";
}; toolchain = with fenix.packages."${system}";
combine [
packages.default = packages.jade; latest.rustc
latest.cargo
latest.clippy
latest.rustfmt
latest.rust-analyzer
latest.rust-src
];
naersk-lib = naersk.lib."${system}".override {
cargo = toolchain;
rustc = toolchain;
clippy = toolchain;
rustfmt = toolchain;
rust-analyzer = toolchain;
rust-src = toolchain;
};
in rec
{
packages.jade = naersk-lib.buildPackage {
pname = "Jade";
root = ./.;
};
apps.jade = utils.lib.mkApp { packages.default = packages.jade;
drv = packages.jade;
};
apps.default = apps.jade;
devShells.default = pkgs.mkShell { apps.jade = utils.lib.mkApp {
nativeBuildInputs = with pkgs; [ drv = packages.jade;
rustc };
cargo
rustfmt apps.default = apps.jade;
cargo-audit
clippy
];
};
});
}
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
toolchain
];
# For rust-analyzer
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
formatter = pkgs.alejandra;
});
}

Loading…
Cancel
Save