Attempt to package up the helpers alongside yama and datman
This commit is contained in:
parent
5fd9a72de8
commit
ef70e0998e
50
flake.lock
generated
50
flake.lock
generated
@ -1,5 +1,20 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1653893745,
|
||||||
|
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"naersk": {
|
"naersk": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs"
|
||||||
@ -46,10 +61,45 @@
|
|||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_3": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1654176133,
|
||||||
|
"narHash": "sha256-XhjUlU+q9LPFM8Z7X3h504vS2FUToCyKhaf5hVF6nsw=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "63f15db5291aec276924d907d3e083e74d68e8b9",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"poetry2nix": {
|
||||||
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs_3"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1653561148,
|
||||||
|
"narHash": "sha256-JzAttqACdvMOTwkzkJ0jFF8MWIo8Uau4w/XUMyqpnd8=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "poetry2nix",
|
||||||
|
"rev": "3b01c3e3dc57d511848d8433153ab67db79640e1",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "poetry2nix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"naersk": "naersk",
|
"naersk": "naersk",
|
||||||
"nixpkgs": "nixpkgs_2",
|
"nixpkgs": "nixpkgs_2",
|
||||||
|
"poetry2nix": "poetry2nix",
|
||||||
"utils": "utils"
|
"utils": "utils"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
49
flake.nix
49
flake.nix
@ -4,15 +4,15 @@
|
|||||||
inputs = {
|
inputs = {
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
naersk.url = "github:nix-community/naersk";
|
naersk.url = "github:nix-community/naersk";
|
||||||
|
poetry2nix.url = "github:nix-community/poetry2nix";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils, naersk }:
|
outputs = { self, nixpkgs, utils, naersk, poetry2nix }:
|
||||||
utils.lib.eachDefaultSystem (system: let
|
utils.lib.eachDefaultSystem (system: let
|
||||||
pkgs = nixpkgs.legacyPackages."${system}";
|
pkgs = nixpkgs.legacyPackages."${system}";
|
||||||
naersk-lib = naersk.lib."${system}";
|
naersk-lib = naersk.lib."${system}";
|
||||||
in rec {
|
|
||||||
# `nix build`
|
rustComponents = naersk-lib.buildPackage {
|
||||||
packages.yama = naersk-lib.buildPackage {
|
|
||||||
pname = "yama";
|
pname = "yama";
|
||||||
root = ./.;
|
root = ./.;
|
||||||
|
|
||||||
@ -23,6 +23,45 @@
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mysqlHelper = pkgs.poetry2nix.mkPoetryApplication {
|
||||||
|
projectDir = ./datman-helper-mysql;
|
||||||
|
};
|
||||||
|
|
||||||
|
postgresHelper = pkgs.poetry2nix.mkPoetryApplication {
|
||||||
|
projectDir = ./datman-helper-postgres;
|
||||||
|
};
|
||||||
|
|
||||||
|
# We want to produce a package with all of these together, with wrappers that let them
|
||||||
|
# refer to each other by name (i.e. have each other on the path).
|
||||||
|
# ATM it's just Datman that needs them on the PATH.
|
||||||
|
allInOne = pkgs.stdenv.mkDerivation {
|
||||||
|
name = "datman-aio";
|
||||||
|
|
||||||
|
src = "${pkgs.emptyDirectory}";
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
# set -eu
|
||||||
|
mkdir $out $out/bin
|
||||||
|
ln -s ${rustComponents}/bin/{yama,datman} $out/bin
|
||||||
|
ln -s ${mysqlHelper}/bin/datman-helper-mysql-{backup,restore} $out/bin
|
||||||
|
ln -s ${postgresHelper}/bin/datman-helper-postgres-{backup,restore} $out/bin
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
|
||||||
|
postInstall = ''
|
||||||
|
set -eu
|
||||||
|
#for fn in $out/bin/{datman,yama,datman-helper-{mysql,postgres}-{backup,restore}}; do
|
||||||
|
# wrapProgram $fn --suffix PATH : $out/bin
|
||||||
|
#done
|
||||||
|
wrapProgram $out/bin/datman --suffix PATH : $out/bin
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in rec {
|
||||||
|
# `nix build`
|
||||||
|
packages.yama = allInOne;
|
||||||
|
|
||||||
defaultPackage = packages.yama;
|
defaultPackage = packages.yama;
|
||||||
|
|
||||||
# NixOS Modules
|
# NixOS Modules
|
||||||
@ -32,7 +71,7 @@
|
|||||||
|
|
||||||
# `nix run`
|
# `nix run`
|
||||||
apps.yama = utils.lib.mkApp {
|
apps.yama = utils.lib.mkApp {
|
||||||
drv = packages.yama;
|
drv = rustComponents;
|
||||||
};
|
};
|
||||||
defaultApp = apps.yama;
|
defaultApp = apps.yama;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user