2022-09-02 23:03:57 +00:00
|
|
|
{
|
2024-04-02 21:40:06 +00:00
|
|
|
description = "The Lix Installer";
|
2022-09-02 23:03:57 +00:00
|
|
|
|
|
|
|
inputs = {
|
2024-04-02 21:40:06 +00:00
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2022-09-02 23:03:57 +00:00
|
|
|
|
|
|
|
fenix = {
|
2024-04-02 21:40:06 +00:00
|
|
|
url = "github:nix-community/fenix";
|
2022-09-02 23:03:57 +00:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
|
|
|
|
naersk = {
|
|
|
|
url = "github:nix-community/naersk";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2022-12-23 19:07:14 +00:00
|
|
|
|
|
|
|
nix = {
|
2024-03-07 18:51:15 +00:00
|
|
|
url = "https://flakehub.com/f/NixOS/nix/=2.20.5.tar.gz";
|
2023-02-08 19:41:36 +00:00
|
|
|
# Omitting `inputs.nixpkgs.follows = "nixpkgs";` on purpose
|
2022-12-23 19:07:14 +00:00
|
|
|
};
|
|
|
|
|
2023-10-03 17:47:17 +00:00
|
|
|
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.0.0.tar.gz";
|
2022-09-02 23:03:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs =
|
|
|
|
{ self
|
|
|
|
, nixpkgs
|
|
|
|
, fenix
|
|
|
|
, naersk
|
2022-12-23 19:07:14 +00:00
|
|
|
, nix
|
2022-09-02 23:03:57 +00:00
|
|
|
, ...
|
|
|
|
} @ inputs:
|
|
|
|
let
|
2023-02-06 15:50:23 +00:00
|
|
|
supportedSystems = [ "i686-linux" "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
2022-09-02 23:03:57 +00:00
|
|
|
|
2022-12-23 19:07:14 +00:00
|
|
|
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: (forSystem system f));
|
|
|
|
|
|
|
|
forSystem = system: f: f rec {
|
2022-09-02 23:03:57 +00:00
|
|
|
inherit system;
|
2023-02-13 23:33:30 +00:00
|
|
|
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
|
2022-09-02 23:03:57 +00:00
|
|
|
lib = pkgs.lib;
|
2022-12-23 19:07:14 +00:00
|
|
|
};
|
2022-09-02 23:03:57 +00:00
|
|
|
|
|
|
|
fenixToolchain = system: with fenix.packages.${system};
|
|
|
|
combine ([
|
|
|
|
stable.clippy
|
|
|
|
stable.rustc
|
|
|
|
stable.cargo
|
|
|
|
stable.rustfmt
|
|
|
|
stable.rust-src
|
|
|
|
] ++ nixpkgs.lib.optionals (system == "x86_64-linux") [
|
|
|
|
targets.x86_64-unknown-linux-musl.stable.rust-std
|
2023-02-06 15:50:23 +00:00
|
|
|
] ++ nixpkgs.lib.optionals (system == "i686-linux") [
|
|
|
|
targets.i686-unknown-linux-musl.stable.rust-std
|
2022-09-02 23:03:57 +00:00
|
|
|
] ++ nixpkgs.lib.optionals (system == "aarch64-linux") [
|
|
|
|
targets.aarch64-unknown-linux-musl.stable.rust-std
|
|
|
|
]);
|
|
|
|
in
|
|
|
|
{
|
2022-12-16 18:32:30 +00:00
|
|
|
overlays.default = final: prev:
|
|
|
|
let
|
2023-03-20 16:38:44 +00:00
|
|
|
toolchain = fenixToolchain final.stdenv.system;
|
2022-12-16 18:32:30 +00:00
|
|
|
naerskLib = final.callPackage naersk {
|
|
|
|
cargo = toolchain;
|
|
|
|
rustc = toolchain;
|
|
|
|
};
|
|
|
|
sharedAttrs = {
|
2024-04-02 21:40:06 +00:00
|
|
|
pname = "lix-installer";
|
2024-03-07 19:47:08 +00:00
|
|
|
version = "0.17.1";
|
2022-12-23 19:07:14 +00:00
|
|
|
src = builtins.path {
|
2024-04-02 21:40:06 +00:00
|
|
|
name = "lix-installer-source";
|
2022-12-23 19:07:14 +00:00
|
|
|
path = self;
|
2023-03-09 17:29:49 +00:00
|
|
|
filter = (path: type: baseNameOf path != "nix" && baseNameOf path != ".github");
|
2022-12-23 19:07:14 +00:00
|
|
|
};
|
2022-12-16 18:32:30 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = with final; [ ];
|
|
|
|
buildInputs = with final; [ ] ++ lib.optionals (final.stdenv.isDarwin) (with final.darwin.apple_sdk.frameworks; [
|
|
|
|
SystemConfiguration
|
|
|
|
]);
|
|
|
|
|
2023-04-10 16:24:13 +00:00
|
|
|
copyBins = true;
|
|
|
|
copyDocsToSeparateOutput = true;
|
|
|
|
|
2022-12-16 18:32:30 +00:00
|
|
|
doCheck = true;
|
|
|
|
doDoc = true;
|
|
|
|
doDocFail = true;
|
|
|
|
RUSTFLAGS = "--cfg tokio_unstable";
|
|
|
|
cargoTestOptions = f: f ++ [ "--all" ];
|
|
|
|
|
|
|
|
override = { preBuild ? "", ... }: {
|
|
|
|
preBuild = preBuild + ''
|
|
|
|
# logRun "cargo clippy --all-targets --all-features -- -D warnings"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
postInstall = ''
|
2024-04-02 21:40:06 +00:00
|
|
|
cp lix-installer.sh $out/bin/lix-installer.sh
|
2022-12-16 18:32:30 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
in
|
|
|
|
rec {
|
2024-04-02 21:40:06 +00:00
|
|
|
lix-installer = naerskLib.buildPackage sharedAttrs;
|
2023-03-20 16:38:44 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (prev.stdenv.system == "x86_64-linux") rec {
|
2024-04-02 21:40:06 +00:00
|
|
|
default = lix-installer-static;
|
|
|
|
lix-installer-static = naerskLib.buildPackage
|
2022-12-16 18:32:30 +00:00
|
|
|
(sharedAttrs // {
|
|
|
|
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
|
|
|
|
});
|
2023-03-20 16:38:44 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (prev.stdenv.system == "i686-linux") rec {
|
2024-04-02 21:40:06 +00:00
|
|
|
default = lix-installer-static;
|
|
|
|
lix-installer-static = naerskLib.buildPackage
|
2023-02-06 15:50:23 +00:00
|
|
|
(sharedAttrs // {
|
|
|
|
CARGO_BUILD_TARGET = "i686-unknown-linux-musl";
|
|
|
|
});
|
2023-03-20 16:38:44 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (prev.stdenv.system == "aarch64-linux") rec {
|
2024-04-02 21:40:06 +00:00
|
|
|
default = lix-installer-static;
|
|
|
|
lix-installer-static = naerskLib.buildPackage
|
2022-12-16 18:32:30 +00:00
|
|
|
(sharedAttrs // {
|
|
|
|
CARGO_BUILD_TARGET = "aarch64-unknown-linux-musl";
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2022-09-28 20:49:07 +00:00
|
|
|
devShells = forAllSystems ({ system, pkgs, ... }:
|
2022-09-02 23:03:57 +00:00
|
|
|
let
|
|
|
|
toolchain = fenixToolchain system;
|
2023-06-28 17:40:44 +00:00
|
|
|
check = import ./nix/check.nix { inherit pkgs toolchain; };
|
2022-09-02 23:03:57 +00:00
|
|
|
in
|
2022-09-28 20:49:07 +00:00
|
|
|
{
|
|
|
|
default = pkgs.mkShell {
|
|
|
|
name = "nix-install-shell";
|
|
|
|
|
|
|
|
RUST_SRC_PATH = "${toolchain}/lib/rustlib/src/rust/library";
|
|
|
|
|
2022-12-12 16:18:29 +00:00
|
|
|
nativeBuildInputs = with pkgs; [ ];
|
2022-09-28 20:49:07 +00:00
|
|
|
buildInputs = with pkgs; [
|
2024-04-12 07:12:37 +00:00
|
|
|
zig
|
|
|
|
xonsh
|
|
|
|
awscli2
|
2022-09-28 20:49:07 +00:00
|
|
|
toolchain
|
|
|
|
rust-analyzer
|
2022-11-01 16:32:14 +00:00
|
|
|
cargo-outdated
|
2024-04-12 07:12:37 +00:00
|
|
|
cargo-zigbuild
|
2023-05-03 18:01:34 +00:00
|
|
|
cacert
|
2023-02-24 21:07:11 +00:00
|
|
|
cargo-audit
|
2023-10-16 18:50:33 +00:00
|
|
|
cargo-watch
|
2022-09-28 20:49:07 +00:00
|
|
|
nixpkgs-fmt
|
2022-12-05 18:27:12 +00:00
|
|
|
check.check-rustfmt
|
|
|
|
check.check-spelling
|
|
|
|
check.check-nixpkgs-fmt
|
|
|
|
check.check-editorconfig
|
2023-03-29 17:24:08 +00:00
|
|
|
check.check-semver
|
2023-08-14 17:00:34 +00:00
|
|
|
check.check-clippy
|
2022-09-28 20:49:07 +00:00
|
|
|
]
|
2023-06-14 20:41:10 +00:00
|
|
|
++ lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [
|
|
|
|
libiconv
|
|
|
|
darwin.apple_sdk.frameworks.Security
|
2023-10-16 18:50:33 +00:00
|
|
|
darwin.apple_sdk.frameworks.SystemConfiguration
|
2023-06-14 20:41:10 +00:00
|
|
|
])
|
2023-05-18 17:14:03 +00:00
|
|
|
++ lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [
|
2023-06-14 20:41:10 +00:00
|
|
|
checkpolicy
|
|
|
|
semodule-utils
|
2023-05-18 17:14:03 +00:00
|
|
|
/* users are expected to have a system docker, too */
|
|
|
|
]);
|
2022-09-28 20:49:07 +00:00
|
|
|
};
|
2022-09-02 23:03:57 +00:00
|
|
|
});
|
|
|
|
|
2022-10-13 16:11:23 +00:00
|
|
|
checks = forAllSystems ({ system, pkgs, ... }:
|
|
|
|
let
|
2022-12-05 18:27:12 +00:00
|
|
|
toolchain = fenixToolchain system;
|
2023-06-28 17:40:44 +00:00
|
|
|
check = import ./nix/check.nix { inherit pkgs toolchain; };
|
2022-10-13 16:11:23 +00:00
|
|
|
in
|
|
|
|
{
|
2022-12-05 18:27:12 +00:00
|
|
|
check-rustfmt = pkgs.runCommand "check-rustfmt" { buildInputs = [ check.check-rustfmt ]; } ''
|
|
|
|
cd ${./.}
|
|
|
|
check-rustfmt
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
check-spelling = pkgs.runCommand "check-spelling" { buildInputs = [ check.check-spelling ]; } ''
|
|
|
|
cd ${./.}
|
|
|
|
check-spelling
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
check-nixpkgs-fmt = pkgs.runCommand "check-nixpkgs-fmt" { buildInputs = [ check.check-nixpkgs-fmt ]; } ''
|
|
|
|
cd ${./.}
|
|
|
|
check-nixpkgs-fmt
|
|
|
|
touch $out
|
|
|
|
'';
|
|
|
|
check-editorconfig = pkgs.runCommand "check-editorconfig" { buildInputs = [ pkgs.git check.check-editorconfig ]; } ''
|
|
|
|
cd ${./.}
|
|
|
|
check-editorconfig
|
|
|
|
touch $out
|
2022-10-13 16:11:23 +00:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
|
2022-12-16 18:32:30 +00:00
|
|
|
packages = forAllSystems ({ system, pkgs, ... }:
|
|
|
|
{
|
2024-04-02 21:40:06 +00:00
|
|
|
inherit (pkgs) lix-installer;
|
2022-12-16 18:32:30 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (system == "x86_64-linux") {
|
2024-04-02 21:40:06 +00:00
|
|
|
inherit (pkgs) lix-installer-static;
|
|
|
|
default = pkgs.lix-installer-static;
|
2023-02-06 15:50:23 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (system == "i686-linux") {
|
2024-04-02 21:40:06 +00:00
|
|
|
inherit (pkgs) lix-installer-static;
|
|
|
|
default = pkgs.lix-installer-static;
|
2022-12-16 18:32:30 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (system == "aarch64-linux") {
|
2024-04-02 21:40:06 +00:00
|
|
|
inherit (pkgs) lix-installer-static;
|
|
|
|
default = pkgs.lix-installer-static;
|
2022-12-16 18:32:30 +00:00
|
|
|
} // nixpkgs.lib.optionalAttrs (pkgs.stdenv.isDarwin) {
|
2024-04-02 21:40:06 +00:00
|
|
|
default = pkgs.lix-installer;
|
2022-12-16 18:32:30 +00:00
|
|
|
});
|
2022-12-23 19:07:14 +00:00
|
|
|
|
|
|
|
hydraJobs = {
|
|
|
|
vm-test = import ./nix/tests/vm-test {
|
|
|
|
inherit forSystem;
|
|
|
|
inherit (nix.hydraJobs) binaryTarball;
|
2023-04-05 15:12:38 +00:00
|
|
|
inherit (nixpkgs) lib;
|
2022-12-23 19:07:14 +00:00
|
|
|
};
|
2023-02-01 20:35:52 +00:00
|
|
|
container-test = import ./nix/tests/container-test {
|
|
|
|
inherit forSystem;
|
|
|
|
inherit (nix.hydraJobs) binaryTarball;
|
|
|
|
};
|
2022-12-23 19:07:14 +00:00
|
|
|
};
|
2022-09-02 23:03:57 +00:00
|
|
|
};
|
|
|
|
}
|