container-tool: init
This commit is contained in:
@@ -1,7 +1,12 @@
|
||||
{
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
inputs = {
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
|
||||
outputs = { self, nixpkgs }: let
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, rust-overlay }: let
|
||||
inherit (nixpkgs) lib;
|
||||
|
||||
systems = [
|
||||
@@ -9,9 +14,21 @@
|
||||
"aarch64-linux"
|
||||
];
|
||||
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system nixpkgs.legacyPackages.${system});
|
||||
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: let
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(import rust-overlay)
|
||||
];
|
||||
};
|
||||
|
||||
rust-bin = rust-overlay.lib.mkRustBin { } pkgs.buildPackages;
|
||||
toolchain = rust-bin.stable.latest.default.override {
|
||||
extensions = [ "rust-src" ];
|
||||
};
|
||||
in f system pkgs toolchain);
|
||||
in {
|
||||
apps = forAllSystems (system: pkgs: {
|
||||
apps = forAllSystems (system: pkgs: _: {
|
||||
default = self.apps.${system}.vm;
|
||||
vm = {
|
||||
type = "app";
|
||||
@@ -19,9 +36,47 @@
|
||||
};
|
||||
});
|
||||
|
||||
devShell = forAllSystems (system: pkgs: toolchain: pkgs.mkShell {
|
||||
nativeBuildInputs = with pkgs; [
|
||||
toolchain
|
||||
cargo-edit
|
||||
];
|
||||
|
||||
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
||||
});
|
||||
|
||||
overlays = {
|
||||
default = self.overlays.container-tool;
|
||||
container-tool = final: prev: {
|
||||
inherit (self.packages.${prev.stdenv.hostPlatform.system}) container-tool;
|
||||
};
|
||||
};
|
||||
|
||||
packages = forAllSystems (system: pkgs: _: {
|
||||
default = self.packages.${system}.container-tool;
|
||||
container-tool = let
|
||||
cargoToml = builtins.fromTOML (builtins.readFile ./container-tool/Cargo.toml);
|
||||
in pkgs.callPackage ({
|
||||
lib,
|
||||
rustPlatform,
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = cargoToml.package.name;
|
||||
version = cargoToml.package.version;
|
||||
src = pkgs.lib.cleanSource ./container-tool;
|
||||
|
||||
cargoLock.lockFile = ./container-tool/Cargo.lock;
|
||||
meta = with lib; {
|
||||
license = licenses.mit;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
mainProgram = (lib.head (cargoToml.bin)).name;
|
||||
};
|
||||
}) { };
|
||||
});
|
||||
|
||||
nixosModules.default = ./modules/user-jails.nix;
|
||||
|
||||
nixosConfigurations = lib.mapAttrs' (n: v: lib.nameValuePair "vm-${n}" v) (forAllSystems (system: pkgs:
|
||||
nixosConfigurations = lib.mapAttrs' (n: v: lib.nameValuePair "vm-${n}" v) (forAllSystems (system: pkgs: _:
|
||||
lib.nixosSystem {
|
||||
inherit system pkgs;
|
||||
modules = [
|
||||
|
||||
Reference in New Issue
Block a user