Compare commits

..

No commits in common. "61653794e1be63213bf08d72f1409d259476c2ad" and "c283ebb75bf26e200da38ba5be9f7b25d220e59e" have entirely different histories.

3 changed files with 76 additions and 61 deletions

View file

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

View file

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

View file

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