Compare commits
No commits in common. "83f8b7c051d87d4fe43bc8d0041bd68e61ec3240" and "4ade2ae9e949b184ba2d47495ec348f385ab0300" have entirely different histories.
83f8b7c051
...
4ade2ae9e9
12
flake.lock
12
flake.lock
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1669597967,
|
||||
"narHash": "sha256-R+2NaDkXsYkOpFOhmVR8jBZ77Pq55Z6ilaqwFLLn000=",
|
||||
"lastModified": 1655122334,
|
||||
"narHash": "sha256-Rwwvo9TDCH0a4m/Jvoq5wZ3FLSLiVLBD1FFfN/3XawA=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "be9e3762e719211368d186f547f847737baad720",
|
||||
"rev": "e1a1cfb56504d1b82a3953bfb0632b37a1ca8d30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -24,11 +24,11 @@
|
|||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"lastModified": 1653893745,
|
||||
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
37
flake.nix
37
flake.nix
|
@ -10,13 +10,18 @@
|
|||
utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
sources = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
buildAdoptLike = with import nixpkgs { system = system; };
|
||||
name: value:
|
||||
buildAdoptLike = with import nixpkgs { system = system; }; name: value:
|
||||
let
|
||||
cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
||||
runtimeDependencies = [ pkgs.cups pkgs.cairo pkgs.glib pkgs.gtk3 ];
|
||||
runtimeDependencies = [
|
||||
pkgs.cups
|
||||
pkgs.cairo
|
||||
pkgs.glib
|
||||
pkgs.gtk3
|
||||
];
|
||||
runtimeLibraryPath = lib.makeLibraryPath runtimeDependencies;
|
||||
in stdenv.mkDerivation rec {
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "jdk${toString value.major_version}";
|
||||
src = builtins.fetchurl {
|
||||
url = value.link;
|
||||
|
@ -35,7 +40,10 @@
|
|||
xorg.libXtst
|
||||
zlib
|
||||
];
|
||||
nativeBuildInputs = with pkgs; [ autoPatchelfHook makeWrapper ];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
autoPatchelfHook
|
||||
makeWrapper
|
||||
];
|
||||
dontStrip = 1;
|
||||
installPhase = ''
|
||||
cd ..
|
||||
|
@ -64,9 +72,7 @@
|
|||
for bin in $( find "$out" -executable -type f -not -name jspawnhelper ); do
|
||||
if patchelf --print-interpreter "$bin" &> /dev/null; then
|
||||
wrapProgram "$bin" --prefix LD_LIBRARY_PATH : "${runtimeLibraryPath}" \
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath [ pkgs.util-linux ]
|
||||
}
|
||||
--prefix PATH : ${lib.makeBinPath [ pkgs.util-linux ]}
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
@ -75,9 +81,13 @@
|
|||
patchelf --add-needed libfontconfig.so {} \;
|
||||
'';
|
||||
};
|
||||
in with import nixpkgs { system = system; }; {
|
||||
packages.temurin =
|
||||
(builtins.mapAttrs (name: value: buildAdoptLike name value)
|
||||
in
|
||||
with import nixpkgs { system = system; };
|
||||
{
|
||||
packages.temurin = (builtins.mapAttrs
|
||||
(name: value:
|
||||
buildAdoptLike name value
|
||||
)
|
||||
sources.${system}.temurin.versions) // {
|
||||
latest = buildAdoptLike "latest" sources.${system}.temurin.latest;
|
||||
stable = buildAdoptLike "stable" sources.${system}.temurin.stable;
|
||||
|
@ -88,8 +98,9 @@
|
|||
packages.temurin-stable = self.packages.${system}.temurin.stable;
|
||||
packages.temurin-lts = self.packages.${system}.temurin.lts;
|
||||
|
||||
packages.semeru =
|
||||
(builtins.mapAttrs (name: value: buildAdoptLike name value)
|
||||
packages.semeru = (builtins.mapAttrs
|
||||
(name: value:
|
||||
buildAdoptLike name value)
|
||||
sources.${system}.semeru.versions) // {
|
||||
latest = buildAdoptLike "latest" sources.${system}.semeru.latest;
|
||||
stable = buildAdoptLike "stable" sources.${system}.semeru.stable;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
# reload when these files change
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
# load the flake devShell
|
||||
eval "$(nix print-dev-env)"
|
|
@ -1,135 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"advisory-db": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1669556130,
|
||||
"narHash": "sha256-6qRQVSgpw+Tw17TroiUg8nAte9/KVDH+v30MOOd+pQU=",
|
||||
"owner": "RustSec",
|
||||
"repo": "advisory-db",
|
||||
"rev": "a66a3049c98395410a2afadf0382882b0a04d8b1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "RustSec",
|
||||
"repo": "advisory-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1668681692,
|
||||
"narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "009399224d5e398d03b22badca40a37ac85412a1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1662220400,
|
||||
"narHash": "sha256-9o2OGQqu4xyLZP9K6kNe1pTHnyPz0Wr3raGYnr9AIgY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"rev": "6944160c19cb591eb85bbf9b2f2768a935623ed3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "naersk",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1669597967,
|
||||
"narHash": "sha256-R+2NaDkXsYkOpFOhmVR8jBZ77Pq55Z6ilaqwFLLn000=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "be9e3762e719211368d186f547f847737baad720",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"advisory-db": "advisory-db",
|
||||
"flake-compat": "flake-compat",
|
||||
"naersk": "naersk",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay",
|
||||
"utils": "utils"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1669689198,
|
||||
"narHash": "sha256-YsWu3C9IGbH3+xguTzEDyQorFe/igr6FGZ+Q5T2ocxE=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "4e093ce661a63aca4bcbace33695225eae4ef4e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,188 +0,0 @@
|
|||
{
|
||||
description = "updater";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://nix-cache.mccarty.io/" ];
|
||||
extra-trusted-public-keys =
|
||||
[ "nathan-nix-cache:R5/0GiItBM64sNgoFC/aSWuAopOAsObLcb/mwDf335A=" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
utils.url = "github:numtide/flake-utils";
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
naersk = {
|
||||
url = "github:nix-community/naersk";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Used for rust compiler
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# Advisory db from rust-sec
|
||||
advisory-db = {
|
||||
url = "github:RustSec/advisory-db";
|
||||
flake = false;
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{ self, nixpkgs, flake-compat, utils, naersk, rust-overlay, advisory-db }:
|
||||
utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
crateName = "updater";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
overlays = [ (import rust-overlay) ];
|
||||
|
||||
};
|
||||
rust = pkgs.rust-bin.stable.latest.default.override {
|
||||
extensions = [ "llvm-tools-preview" ];
|
||||
};
|
||||
naersk-lib = naersk.lib."${system}".override {
|
||||
rustc = rust;
|
||||
cargo = rust;
|
||||
};
|
||||
cargo-llvm-cov = naersk-lib.buildPackage {
|
||||
pname = "cargo-llvm-cov";
|
||||
src = pkgs.fetchzip {
|
||||
url =
|
||||
"https://crates.io/api/v1/crates/cargo-llvm-cov/0.5.0/download";
|
||||
extension = ".tar.gz";
|
||||
sha256 = "sha256-ifnwiOuFnpryYxLgescpxN8CzgFzSZlY+RlbyW7ND6g=";
|
||||
};
|
||||
};
|
||||
cargo-nextest = naersk-lib.buildPackage {
|
||||
pname = "cargo-nextest";
|
||||
src = pkgs.fetchzip {
|
||||
url =
|
||||
"https://crates.io/api/v1/crates/cargo-nextest/0.9.37/download";
|
||||
extension = ".tar.gz";
|
||||
sha256 = "sha256-1tEEZipJ8GqQqESKD9664Pax4evIp+G2tOpZuh6xN3U=";
|
||||
};
|
||||
};
|
||||
devBase = with pkgs; [
|
||||
# Build tools
|
||||
openssl
|
||||
pkg-config
|
||||
rust-analyzer
|
||||
cmake
|
||||
gnuplot
|
||||
# git tooling
|
||||
gitFull
|
||||
pre-commit
|
||||
git-lfs
|
||||
git-cliff
|
||||
# Cargo addons
|
||||
cargo-llvm-cov
|
||||
cargo-nextest
|
||||
cargo-release
|
||||
cargo-udeps
|
||||
cargo-audit
|
||||
# Formatters
|
||||
nixpkgs-fmt
|
||||
python39Packages.mdformat
|
||||
# for ci reasons
|
||||
bash
|
||||
cacert
|
||||
# Sourcehut
|
||||
hut
|
||||
];
|
||||
sharedDeps = with pkgs;
|
||||
[
|
||||
|
||||
];
|
||||
sharedNativeDeps = with pkgs;
|
||||
[
|
||||
|
||||
];
|
||||
in rec {
|
||||
# Main binary
|
||||
packages.${crateName} = naersk-lib.buildPackage {
|
||||
pname = "${crateName}";
|
||||
buildInputs = sharedDeps;
|
||||
nativeBuildInputs = sharedNativeDeps;
|
||||
root = ./.;
|
||||
};
|
||||
# binary + tests
|
||||
packages.tests.${crateName} = naersk-lib.buildPackage {
|
||||
pname = "${crateName}";
|
||||
buildInputs = sharedDeps;
|
||||
nativeBuildInputs = sharedNativeDeps;
|
||||
root = ./.;
|
||||
doCheck = true;
|
||||
};
|
||||
|
||||
packages.docs.${crateName} = naersk-lib.buildPackage {
|
||||
pname = "${crateName}";
|
||||
buildInputs = sharedDeps;
|
||||
nativeBuildInputs = sharedNativeDeps;
|
||||
root = ./.;
|
||||
dontBuild = true;
|
||||
doDoc = true;
|
||||
doDocFail = true;
|
||||
};
|
||||
|
||||
defaultPackage = packages.${crateName};
|
||||
|
||||
# Make some things eaiser to do in CI
|
||||
packages.lints = {
|
||||
# lint formatting
|
||||
format.${crateName} = with import nixpkgs { inherit system; };
|
||||
stdenv.mkDerivation {
|
||||
name = "format lint";
|
||||
src = self;
|
||||
nativeBuildInputs = with pkgs;
|
||||
[ rust-bin.stable.latest.default ] ++ sharedNativeDeps;
|
||||
buildInputs = sharedDeps;
|
||||
buildPhase = "cargo fmt -- --check";
|
||||
installPhase = "mkdir -p $out; echo 'done'";
|
||||
};
|
||||
# audit against stored advisory db
|
||||
audit.${crateName} = with import nixpkgs { inherit system; };
|
||||
stdenv.mkDerivation {
|
||||
name = "format lint";
|
||||
src = self;
|
||||
nativeBuildInputs = with pkgs;
|
||||
[ rust-bin.stable.latest.default cargo-audit ]
|
||||
++ sharedNativeDeps;
|
||||
buildInputs = sharedDeps;
|
||||
buildPhase = ''
|
||||
export HOME=$TMP
|
||||
mkdir -p ~/.cargo
|
||||
cp -r ${advisory-db} ~/.cargo/advisory-db
|
||||
cargo audit -n
|
||||
'';
|
||||
installPhase = "mkdir -p $out; echo 'done'";
|
||||
};
|
||||
# Clippy
|
||||
clippy.${crateName} = naersk-lib.buildPackage {
|
||||
pname = "${crateName}";
|
||||
root = ./.;
|
||||
buildInputs = sharedDeps;
|
||||
nativeBuildInputs = sharedNativeDeps;
|
||||
cargoTestCommands = (old: [ "cargo $cargo_options clippy" ]);
|
||||
doCheck = true;
|
||||
dontBuild = true;
|
||||
};
|
||||
};
|
||||
|
||||
devShell = pkgs.mkShell {
|
||||
inputsFrom = builtins.attrValues self.packages.${system};
|
||||
buildInputs = [ rust ] ++ devBase ++ sharedDeps ++ sharedNativeDeps;
|
||||
};
|
||||
|
||||
packages.nightlyRustShell = pkgs.mkShell {
|
||||
buildInputs = [
|
||||
(pkgs.rust-bin.selectLatestNightlyWith (toolchain:
|
||||
toolchain.default.override {
|
||||
extensions = [ "rust-src" "clippy" "llvm-tools-preview" ];
|
||||
}))
|
||||
] ++ devBase ++ sharedDeps ++ sharedNativeDeps;
|
||||
};
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue