This commit is contained in:
Hamcha 2023-11-28 20:03:29 +01:00
parent 081beb9c79
commit 70489ddf74
5 changed files with 196 additions and 54 deletions

View file

@ -1,4 +1,5 @@
README.md
LICENSE.txt
/dist
/target
/target
/result

3
.gitignore vendored
View file

@ -1,4 +1,5 @@
/target
/dist
.env
.vscode
.vscode
/result

148
flake.lock Normal file
View file

@ -0,0 +1,148 @@
{
"nodes": {
"flake-parts": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1698882062,
"narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "8c9fa2545007b49a5db5f650ae91f227672c3877",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1701040486,
"narHash": "sha256-vawYwoHA5CwvjfqaT3A5CT9V36Eq43gxdwpux32Qkjw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "45827faa2132b8eade424f6bdd48d8828754341a",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"nixpkgs-lib": {
"locked": {
"dir": "lib",
"lastModified": 1698611440,
"narHash": "sha256-jPjHjrerhYDy3q9+s5EAsuhyhuknNfowY6yt6pjn9pc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "0cbe9f69c234a7700596e943bfae7ef27a31b735",
"type": "github"
},
"original": {
"dir": "lib",
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-parts": "flake-parts",
"nixpkgs": "nixpkgs",
"rust-crate2nix": "rust-crate2nix",
"rust-overlay": "rust-overlay"
}
},
"rust-crate2nix": {
"flake": false,
"locked": {
"lastModified": 1701048361,
"narHash": "sha256-MIAFa7npdx7a3mSXrlzwrxNY7GyfRdEfgLgHzQUjfrA=",
"owner": "kolloch",
"repo": "crate2nix",
"rev": "08a455fb7dee71720a9bb413fe498d5304708380",
"type": "github"
},
"original": {
"owner": "kolloch",
"repo": "crate2nix",
"type": "github"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1701137803,
"narHash": "sha256-0LcPAdql5IhQSUXJx3Zna0dYTgdIoYO7zUrsKgiBd04=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "9dd940c967502f844eacea52a61e9596268d4f70",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

View file

@ -1,61 +1,50 @@
{
description = "staxman";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05";
flake-utils.url = "github:numtide/flake-utils";
nix-naersk.url = "github:nix-community/naersk";
nixpkgs-mozilla = {
url = "github:mozilla/nixpkgs-mozilla";
flake-parts.url = "github:hercules-ci/flake-parts";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-crate2nix = {
url = "github:kolloch/crate2nix";
flake = false;
};
};
outputs =
{ self
, nixpkgs
, flake-utils
, nix-naersk
, nixpkgs-mozilla
}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import nixpkgs-mozilla)
];
};
outputs = inputs @ {
self,
nixpkgs,
flake-parts,
rust-overlay,
rust-crate2nix,
...
} : flake-parts.lib.mkFlake { inherit inputs; } {
systems = [
"x86_64-linux"
];
perSystem = { system, pkgs, ... }: let
overlays = [
(import rust-overlay)
(self: super: let
toolchain = super.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
in {
rustc = toolchain;
})
];
pkgs = import nixpkgs { inherit system overlays; };
toolchain = (pkgs.rustChannelOf {
rustToolchain = ./rust-toolchain.toml;
sha256 = "sha256-ks0nMEGGXKrHnfv4Fku+vhQ7gx76ruv6Ij4fKZR3l78=";
}).rust;
naersk = pkgs.callPackage nix-naersk {
cargo = toolchain;
rustc = toolchain;
project = let
crateTools = pkgs.callPackage "${rust-crate2nix}/tools.nix" { inherit pkgs; };
in import (crateTools.generatedCargoNix {
name = "staxman";
src = ./.;
}) {
inherit pkgs;
};
in
{
packages = rec {
default = staxman;
staxman = import ./package.nix {
inherit naersk pkgs;
version = self.rev or "dirty";
};
in rec {
packages = {
staxman = project.rootCrate.build;
default = packages.staxman;
};
apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
exePath = "/bin/staxman";
};
formatter = pkgs.nixpkgs-fmt;
shell = pkgs.mkShell {
buildInputs = with pkgs; [
arion
docker-client
];
};
});
}
};
};
}

View file

@ -13,6 +13,9 @@ naersk.buildPackage {
nativeBuildInputs = with pkgs; [
clang
mold
zlib
libgit2
pkg-config
];
buildInputs = with pkgs; [ ];