Remove sources from flake, everything is defined in default.nix now

This includes re-adding the garage build ourselves, rather than using
their flake.
This commit is contained in:
Brian Picciano 2023-02-15 13:56:22 +01:00
parent b7d49bff5b
commit 8e800951a6
5 changed files with 58 additions and 183 deletions

View File

@ -1,24 +1,13 @@
# TODO
# - allow injecting a bootstrap file
# - try stripping flake of source info
# - Revert to not using flake for garage, we'll need to compile it ourselves
# because flakes don't actually support cross-compilation in a nice way.
#
# - Set ARCH arg for appimagetool target in default.nix
let
flakeCompat = import (builtins.fetchGit {
url = "https://github.com/edolstra/flake-compat.git";
rev = "009399224d5e398d03b22badca40a37ac85412a1";
});
pkgsNix = (import ./nix/pkgs.nix);
# if this gets updated then flake.nix needs to be updated as well
garageSrc = builtins.fetchGit {
url = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git";
rev = "76230f20282e73a5a5afa33af68152acaf732cf5";
shallow = true;
pkgs = pkgsNix.default {
inherit buildSystem hostSystem;
};
in {
@ -26,18 +15,11 @@ in {
buildSystem ? builtins.currentSystem,
hostSystem ? builtins.currentSystem,
pkgs ? (import ./nix/pkgs.nix).default {
inherit buildSystem hostSystem;
},
garage ? (flakeCompat { src = garageSrc; }).defaultNix.packages."${hostSystem}".default,
selfRev ? "",
releaseName ? "debug",
}: rec {
inherit garage;
version = pkgs.stdenv.mkDerivation {
name = "cryptic-net-version";
@ -49,7 +31,8 @@ in {
# TODO it'd be nice to be able to call `go version`, but that doesn't work
# when crossSystem is being used for some unknown reason.
goVersion = pkgs.go.version;
garageVersion = garage.version;
#garageVersion = garage.version;
garageVersion = "TODO";
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
@ -80,6 +63,18 @@ in {
nebula = pkgs.callPackage ./nix/nebula.nix {};
garage = let
hostPlatform = pkgs.stdenv.hostPlatform.parsed;
in pkgs.callPackage (import ./nix/garage.nix) {
inherit buildSystem;
hostSystem = "${hostPlatform.cpu.name}-unknown-${hostPlatform.kernel.name}-musl";
pkgsSrc = pkgsNix.src;
};
appDir = pkgs.buildEnv {
name = "cryptic-net-AppDir";
paths = [
@ -89,6 +84,7 @@ in {
dnsmasq
nebula
garage
pkgs.minio-client
entrypoint
];

View File

@ -1,147 +1,10 @@
{
"nodes": {
"cargo2nix": {
"inputs": {
"flake-compat": "flake-compat",
"flake-utils": "flake-utils",
"nixpkgs": [
"garage",
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1666087781,
"narHash": "sha256-trKVdjMZ8mNkGfLcY5LsJJGtdV3xJDZnMVrkFjErlcs=",
"owner": "Alexis211",
"repo": "cargo2nix",
"rev": "a7a61179b66054904ef6a195d8da736eaaa06c36",
"type": "github"
},
"original": {
"owner": "Alexis211",
"repo": "cargo2nix",
"rev": "a7a61179b66054904ef6a195d8da736eaaa06c36",
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"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"
}
},
"garage": {
"inputs": {
"cargo2nix": "cargo2nix",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1672666365,
"narHash": "sha256-lpNp/jw4YaczG3NM3pVWR0cZ8u/KBQCWvvfAswO4+Do=",
"ref": "main",
"rev": "76230f20282e73a5a5afa33af68152acaf732cf5",
"revCount": 1007,
"type": "git",
"url": "https://git.deuxfleurs.fr/Deuxfleurs/garage.git"
},
"original": {
"ref": "main",
"rev": "76230f20282e73a5a5afa33af68152acaf732cf5",
"type": "git",
"url": "https://git.deuxfleurs.fr/Deuxfleurs/garage.git"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1665657542,
"narHash": "sha256-mojxNyzbvmp8NtVtxqiHGhRfjCALLfk9i/Uup68Y5q8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a3073c49bc0163fea6a121c276f526837672b555",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "a3073c49bc0163fea6a121c276f526837672b555",
"type": "github"
}
},
"pkgsSrc": {
"locked": {
"lastModified": 1674868155,
"narHash": "sha256-eFNm2h6fNbgD7ZpO4MHikCB5pSnCJ7DTmwPisjetmwc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ce20e9ebe1903ea2ba1ab006ec63093020c761cb",
"type": "github"
},
"original": {
"id": "nixpkgs",
"ref": "nixos-22.11",
"type": "indirect"
}
},
"root": {
"inputs": {
"garage": "garage",
"pkgsSrc": "pkgsSrc",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": [
"garage",
"cargo2nix",
"flake-utils"
],
"nixpkgs": [
"garage",
"cargo2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1664247556,
"narHash": "sha256-J4vazHU3609ekn7dr+3wfqPo5WGlZVAgV7jfux352L0=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "524db9c9ea7bc7743bb74cdd45b6d46ea3fcc2ab",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"utils": {
"locked": {
"lastModified": 1667395993,

View File

@ -1,21 +1,10 @@
{
# If this gets updated then nix/pkgs.nix needs to be updated as well
inputs.pkgsSrc.url = "nixpkgs/nixos-22.11";
inputs.utils.url = "github:numtide/flake-utils";
# v0.8.1
# if this gets updated then default.nix needs to be updated as well
inputs.garage.url = "git+https://git.deuxfleurs.fr/Deuxfleurs/garage.git?ref=main&rev=76230f20282e73a5a5afa33af68152acaf732cf5";
description = "cryptic-net provides the foundation for an autonomous community cloud infrastructure";
outputs = {
self, utils,
pkgsSrc, garage,
}: let
supportedSystems = [
@ -27,19 +16,8 @@
mkPkg = (buildSystem: hostSystem: let
pkgs = import pkgsSrc {
system = buildSystem;
crossSystem = {
config = hostSystem;
};
overlays = (import ./nix/pkgs.nix).overlays;
};
defaultAttrs = (import ./default.nix) {
inherit pkgs hostSystem buildSystem;
garage = garage.packages."${hostSystem}".default;
inherit hostSystem buildSystem;
selfRev = if self ? rev then self.rev else "dirty";
releaseName = "flake";
};

39
nix/garage.nix Normal file
View File

@ -0,0 +1,39 @@
{
pkgsSrc,
buildSystem,
hostSystem,
fetchgit,
buildEnv,
minio-client,
}: let
version = "0.8.1";
src = fetchgit {
name = "garage-v${version}";
url = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git";
rev = "76230f20282e73a5a5afa33af68152acaf732cf5";
sha256 = "sha256-lpNp/jw4YaczG3NM3pVWR0cZ8u/KBQCWvvfAswO4+Do=";
};
compiled = (import "${src}/nix/compile.nix") {
system = buildSystem;
target = hostSystem;
pkgsSrc = pkgsSrc;
cargo2nixOverlay = (import "${src}/nix/common.nix").cargo2nixOverlay;
release = true;
git_version = version;
};
in
compiled.workspace.garage {
compileMode = "build";
}

View File

@ -26,7 +26,6 @@ rec {
];
# if this changes then flake.nix needs to be updated as well.
version = "22.11";
rev = "ce20e9ebe1903ea2ba1ab006ec63093020c761cb";