chore: make flake simpler
Some checks failed
build / tests (push) Has been cancelled

This commit is contained in:
Callum Leslie 2026-04-21 09:14:32 +01:00
parent 512135e90e
commit 70b141fc8a
Signed by: cleslie
GPG key ID: D382C4AFEECEAA90
3 changed files with 48 additions and 123 deletions

113
flake.lock generated
View file

@ -1,69 +1,17 @@
{ {
"nodes": { "nodes": {
"advisory-db": {
"flake": false,
"locked": {
"lastModified": 1750151065,
"narHash": "sha256-il+CAqChFIB82xP6bO43dWlUVs+NlG7a4g8liIP5HcI=",
"owner": "rustsec",
"repo": "advisory-db",
"rev": "7573f55ba337263f61167dbb0ea926cdc7c8eb5d",
"type": "github"
},
"original": {
"owner": "rustsec",
"repo": "advisory-db",
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1751562746,
"narHash": "sha256-smpugNIkmDeicNz301Ll1bD7nFOty97T79m4GUMUczA=",
"owner": "ipetkov",
"repo": "crane",
"rev": "aed2020fd3dc26e1e857d4107a5a67a33ab6c1fd",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"fenix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1751870679,
"narHash": "sha256-aP4korVsN5Yy+PB9zjjm8Qbo3a69/m8vlFXS5mdVXtk=",
"owner": "nix-community",
"repo": "fenix",
"rev": "95606d64662a730da5d3031ed798dd6315d35f33",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1696426674, "lastModified": 1767039857,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
"owner": "edolstra", "owner": "NixOS",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "edolstra", "owner": "NixOS",
"repo": "flake-compat", "repo": "flake-compat",
"type": "github" "type": "github"
} }
@ -75,11 +23,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1751413152, "lastModified": 1775087534,
"narHash": "sha256-Tyw1RjYEsp5scoigs1384gIg6e0GoBVjms4aXFfRssQ=", "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "77826244401ea9de6e3bac47c2db46005e1f30b5", "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -111,11 +59,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1751792365, "lastModified": 1776548001,
"narHash": "sha256-J1kI6oAj25IG4EdVlg2hQz8NZTBNYvIS0l4wpr9KcUo=", "narHash": "sha256-ZSK0NL4a1BwVbbTBoSnWgbJy9HeZFXLYQizjb2DPF24=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1fd8bada0b6117e6c7eb54aad5813023eed37ccb", "rev": "b12141ef619e0a9c1c84dc8c684040326f27cdcc",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -134,11 +82,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1750779888, "lastModified": 1775585728,
"narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=", "narHash": "sha256-8Psjt+TWvE4thRKktJsXfR6PA/fWWsZ04DVaY6PUhr4=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d", "rev": "580633fa3fe5fc0379905986543fd7495481913d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -149,30 +97,31 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"advisory-db": "advisory-db",
"crane": "crane",
"fenix": "fenix",
"flake-parts": "flake-parts", "flake-parts": "flake-parts",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks", "pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay",
"systems": "systems", "systems": "systems",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
} }
}, },
"rust-analyzer-src": { "rust-overlay": {
"flake": false, "inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1751792916, "lastModified": 1776741231,
"narHash": "sha256-YjyurHKMrUYKjnujSqjpFtHGYFCGr2Xpo1Xc1AYT1+M=", "narHash": "sha256-k9G98qzn+7npROUaks8VqCFm7cFtEG8ulQLBBo5lItg=",
"owner": "rust-lang", "owner": "oxalica",
"repo": "rust-analyzer", "repo": "rust-overlay",
"rev": "0ac65592a833bf40238831dd10e15283d63c46d5", "rev": "02061303f7c4c964f7b4584dabd9e985b4cd442b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "rust-lang", "owner": "oxalica",
"ref": "nightly", "repo": "rust-overlay",
"repo": "rust-analyzer",
"type": "github" "type": "github"
} }
}, },
@ -198,11 +147,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1750931469, "lastModified": 1775636079,
"narHash": "sha256-0IEdQB1nS+uViQw4k3VGUXntjkDp7aAlqcxdewb/hAc=", "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=",
"owner": "numtide", "owner": "numtide",
"repo": "treefmt-nix", "repo": "treefmt-nix",
"rev": "ac8e6f32e11e9c7f153823abc3ab007f2a65d3e1", "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -5,15 +5,8 @@
flake-parts.url = "github:hercules-ci/flake-parts"; flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs"; flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
fenix.inputs.nixpkgs.follows = "nixpkgs"; rust-overlay.url = "github:oxalica/rust-overlay";
fenix.url = "github:nix-community/fenix"; rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
crane.url = "github:ipetkov/crane";
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
systems.url = "github:nix-systems/default"; systems.url = "github:nix-systems/default";
@ -27,7 +20,6 @@
}; };
outputs = { outputs = {
self, self,
nixpkgs,
flake-parts, flake-parts,
... ...
} @ inputs: } @ inputs:
@ -41,51 +33,36 @@
perSystem = { perSystem = {
pkgs, pkgs,
inputs', inputs',
self',
config, config,
... ...
}: let }: let
rustToolchain = inputs'.fenix.packages.fromToolchainFile { rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
file = ./rust-toolchain.toml; rustPlatform = pkgs.makeRustPlatform {
sha256 = "sha256-zC8E38iDVJ1oPIzCqTk/Ujo9+9kx9dXq7wAwPMpkpg0="; cargo = rustToolchain;
}; rustc = rustToolchain;
craneLib = (inputs.crane.mkLib pkgs).overrideToolchain rustToolchain;
src = craneLib.cleanCargoSource (craneLib.path ./.);
nativeBuildInputs = with pkgs; [rustToolchain pkg-config];
buildInputs = with pkgs; [udev];
commonArgs = {
inherit src buildInputs nativeBuildInputs;
}; };
cargoArtifacts = craneLib.buildDepsOnly commonArgs; bin = rustPlatform.buildRustPackage {
bin = craneLib.buildPackage (commonArgs // {inherit cargoArtifacts;}); pname = "nish";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs = with pkgs; [pkg-config];
buildInputs = with pkgs; [udev];
};
in { in {
_module.args.pkgs = inputs'.nixpkgs.legacyPackages.extend inputs.fenix.overlays.default; _module.args.pkgs = inputs'.nixpkgs.legacyPackages.extend inputs.rust-overlay.overlays.default;
checks = { checks = {
inherit bin; inherit bin;
clippy = craneLib.cargoClippy (commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
coverage = craneLib.cargoTarpaulin (commonArgs // {inherit cargoArtifacts;});
fmt = craneLib.cargoFmt {inherit src;};
audit = craneLib.cargoAudit {
inherit src;
inherit (inputs) advisory-db;
};
}; };
packages = { packages = {
default = bin; default = bin;
}; };
devShells.default = craneLib.devShell { devShells.default = pkgs.mkShell {
inherit (self') checks;
inputsFrom = [config.pre-commit.devShell config.treefmt.build.devShell]; inputsFrom = [config.pre-commit.devShell config.treefmt.build.devShell];
packages = []; packages = [rustToolchain pkgs.pkg-config pkgs.udev];
}; };
pre-commit = { pre-commit = {

View file

@ -37,7 +37,6 @@ fn preprocess(s: &str) -> Result<Installable, String> {
async fn main() -> Result<(), runix::default::NixCommandLineRunError> { async fn main() -> Result<(), runix::default::NixCommandLineRunError> {
let cli = Args::parse(); let cli = Args::parse();
std::env::set_var("NIXPKGS_ALLOW_UNFREE", "1"); std::env::set_var("NIXPKGS_ALLOW_UNFREE", "1");
Shell { Shell {
flake: FlakeArgs::default(), flake: FlakeArgs::default(),
eval: EvaluationArgs { eval: EvaluationArgs {