Compare commits

...

2 Commits

Author SHA1 Message Date
xenofem 61653794e1 ditch crate2nix, use fenix instead of oxalica/rust-overlay 2022-12-09 16:06:50 -05:00
xenofem c4019f7b74 option missing? 2022-12-09 16:06:28 -05:00
3 changed files with 71 additions and 86 deletions

View File

@ -1,43 +1,47 @@
{
"nodes": {
"crate2nix": {
"flake": false,
"fenix": {
"inputs": {
"nixpkgs": "nixpkgs",
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
"lastModified": 1668031227,
"narHash": "sha256-WSiooiJ2gtQGkZE0JBJkkqVz5wi3SETwygU4NuBHdgw=",
"owner": "kolloch",
"repo": "crate2nix",
"rev": "ad27c9f88eca7fcbaaa25194d51787715041ec30",
"lastModified": 1670566996,
"narHash": "sha256-M+KsSE2D8ByDf3HZhnvLRpytg8aXScoWhg+NrdHjeeE=",
"owner": "nix-community",
"repo": "fenix",
"rev": "ab24d0ad17a733624b99f5d6466e71b8c239a001",
"type": "github"
},
"original": {
"owner": "kolloch",
"repo": "crate2nix",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"owner": "nix-community",
"repo": "fenix",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1667991831,
"narHash": "sha256-DHgEsLZI044B9T4AjA3K6+yB9/DqLr4dyA7OIx0FG7o=",
"lastModified": 1670332253,
"narHash": "sha256-O5SmhlIUt1s+vK4NXeGYqwcBIMwbBPAEZ3GHE3XT28c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "1c9ffcf70786f0966982ce0fc76ec05df2e1dec2",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1670507980,
"narHash": "sha256-riNZa0xzM1it3pzxciwALeMs+0CsBMWIW2FqulzK8vM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "872fceeed60ae6b7766cc0a4cd5bf5901b9098ec",
"rev": "2787fc7d1e51404678614bf0fe92fc296746eec0",
"type": "github"
},
"original": {
@ -47,46 +51,27 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1665296151,
"narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "14ccaaedd95a488dd7ae142757884d8e125b3363",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"crate2nix": "crate2nix",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay",
"fenix": "fenix",
"nixpkgs": "nixpkgs_2",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"rust-analyzer-src": {
"flake": false,
"locked": {
"lastModified": 1668048396,
"narHash": "sha256-SUWQlSa/H5XKPeuF9XmWzmwIJrgK42Lak6/1jBAwyd0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "859fefb532bb957f51a9b5e8e3ba2e48394c9353",
"lastModified": 1670426523,
"narHash": "sha256-Zh+pAuj4PmBmISXCz+54yVSwSXZwbn+ZELgM85xVUE0=",
"owner": "rust-lang",
"repo": "rust-analyzer",
"rev": "6e8a54d0f68702cf7981c8299357838eb0f4d5b2",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"owner": "rust-lang",
"ref": "nightly",
"repo": "rust-analyzer",
"type": "github"
}
},

View File

@ -4,14 +4,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
crate2nix = {
url = "github:kolloch/crate2nix";
flake = false;
};
fenix.url = "github:nix-community/fenix";
};
outputs = { self, nixpkgs, utils, rust-overlay, crate2nix }: let
outputs = { self, nixpkgs, utils, fenix }: let
name = "transbeam";
in
utils.lib.eachDefaultSystem
@ -19,22 +15,13 @@
let
pkgs = import nixpkgs {
inherit system;
overlays = [
rust-overlay.overlays.default
(final: prev: {
rustc = final.rust-bin.stable.latest.default;
cargo = final.rust-bin.stable.latest.default;
})
];
overlays = [ fenix.overlays.default ];
};
fenixStable = fenix.packages.${system}.stable;
fenixPlatform = pkgs.makeRustPlatform {
cargo = fenixStable.toolchain;
rustc = fenixStable.toolchain;
};
inherit (import "${crate2nix}/tools.nix" { inherit pkgs; })
generatedCargoNix;
project = import
(generatedCargoNix {
inherit name;
src = ./.;
})
{ inherit pkgs; };
in rec {
packages.${name} = pkgs.symlinkJoin {
inherit name;
@ -49,7 +36,14 @@
defaultPackage = packages.${name};
packages."${name}-unwrapped" = project.rootCrate.build;
packages."${name}-unwrapped" = let
cargoTOML = builtins.fromTOML (builtins.readFile ./Cargo.toml);
in fenixPlatform.buildRustPackage {
pname = name;
inherit (cargoTOML.package) version;
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
};
packages."${name}-cli" = with pkgs.python3Packages; buildPythonApplication {
pname = "${name}-cli";
@ -61,11 +55,18 @@
src = ./cli;
};
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
devShell = with pkgs; let
fenixWith = fenixStable.withComponents [
"cargo"
"clippy"
"rust-src"
"rustc"
"rustfmt"
];
in mkShell {
nativeBuildInputs = [
stdenv.cc
rustc
cargo
fenixWith
cargo-audit
cargo-flamegraph
(python3.withPackages (p: with p; [
@ -73,7 +74,6 @@
websockets
]))
];
RUST_SRC_PATH = "${pkgs.rust.packages.stable.rustPlatform.rustLibSrc}";
};
}
);

View File

@ -395,7 +395,7 @@ mod tests {
let mut zipgen = ZipGenerator::new(
FileSet {
files: vec![],
directory_name: "test".to_owned(),
directory_name: Some("test".to_owned()),
},
Box::new(std::io::Cursor::new(&mut output)),
);