Fix building via nix flake

This commit is contained in:
Brian Picciano 2024-12-15 15:33:47 +01:00
parent 886f76fe0b
commit 6aa14bb57c
4 changed files with 47 additions and 22 deletions

View File

@ -16,7 +16,7 @@
hostSystem = buildSystem;
};
garageNix = (import ./nix/garage.nix);
garageNix = (import ./nix/garage);
in rec {
@ -80,11 +80,9 @@ in rec {
garage = let
hostPlatform = pkgs.stdenv.hostPlatform.parsed;
in pkgs.callPackage garageNix.package {
inherit buildSystem;
in garageNix.package {
inherit pkgsNix buildSystem;
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
pkgsSrc = pkgsNix.src;
};
appDirBase = pkgs.buildEnv {

View File

@ -0,0 +1,21 @@
diff --git a/nix/common.nix b/nix/common.nix
index 1ad809bb..47a92038 100644
--- a/nix/common.nix
+++ b/nix/common.nix
@@ -1,4 +1,6 @@
-let
+{
+ system ? builtins.currentSystem,
+}: let
lock = builtins.fromJSON (builtins.readFile ../flake.lock);
inherit (lock.nodes.flake-compat.locked) owner repo rev narHash;
@@ -8,7 +10,7 @@ let
sha256 = narHash;
};
- flake = (import flake-compat { system = builtins.currentSystem; src = ../.; });
+ flake = (import flake-compat { inherit system; src = ../.; });
in
rec {
pkgsSrc = flake.defaultNix.inputs.nixpkgs;

View File

@ -2,25 +2,39 @@ rec {
version = "1.0.0";
src = builtins.fetchGit {
name = "garage-v${version}";
url = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git";
rev = "ff093ddbb8485409f389abe7b5e569cb38d222d2";
};
package = {
pkgsSrc,
pkgsNix,
buildSystem,
hostSystem,
}: let
pkgs = pkgsNix.default {
inherit buildSystem hostSystem;
};
src = pkgs.applyPatches {
name = "garage-v${version}-patched";
src = builtins.fetchGit {
name = "garage-v${version}";
url = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git";
rev = "ff093ddbb8485409f389abe7b5e569cb38d222d2";
};
patches = [
./common-nix-system.patch
];
};
common = (import "${src}/nix/common.nix") {
system = buildSystem;
};
compile = (import "${src}/nix/compile.nix") {
system = buildSystem;
target = hostSystem;
pkgsSrc = pkgsSrc;
pkgsSrc = pkgsNix.src;
cargo2nixOverlay = (import "${src}/nix/common.nix").cargo2nixOverlay;
cargo2nixOverlay = common.cargo2nixOverlay;
release = true;
git_version = version;

View File

@ -1,8 +0,0 @@
---
type: task
---
# Fix `flake.nix`
The `flake.nix` file is currently broken, garage is using
`builtins.currentSystem` for some reason.