bento: use flake-utils to support all systems

This commit is contained in:
Solène Rapenne 2023-06-24 11:46:41 +02:00
parent 05c95104a9
commit 6418bd64ec
Signed by: solene
GPG Key ID: 8CD42DFD57F0A909
2 changed files with 62 additions and 22 deletions

View File

@ -1,5 +1,23 @@
{
"nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1687171271,
"narHash": "sha256-BJlq+ozK2B1sJDQXS3tzJM5a+oVZmi1q0FlBK/Xqv7M=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "abfb11bd1aec8ced1c9bb9adfe68018230f4fb3c",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1664883812,
@ -18,8 +36,24 @@
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -2,30 +2,36 @@
description = "bento: an asynchronous NixOS deployment tool";
inputs.nixpkgs.url = github:NixOS/nixpkgs/nixos-22.05;
inputs.flake-utils.url = "github:numtide/flake-utils";
outputs = { self, nixpkgs }: {
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.default = pkgs.stdenv.mkDerivation {
name = "bento";
src = self;
packages.x86_64-linux.default =
with import nixpkgs { system = "x86_64-linux"; };
stdenv.mkDerivation {
name = "bento";
src = self;
patchPhase = ''
patchPhase = ''
substituteInPlace bento --replace 'inotifywait' "${pkgs.inotify-tools}/bin/inotifywait";
'';
'';
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share
install -Dm555 bento $out/bin/
install -Dm444 fleet.nix $out/share/
install -Dm444 config.sh.sample $out/share/
install -Dm444 LICENSE $out/share/
install -Dm444 README.md $out/share/
install -Dm444 utils/bento.nix $out/share/
'';
};
};
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/share
install -Dm555 bento $out/bin/
install -Dm444 fleet.nix $out/share/
install -Dm444 config.sh.sample $out/share/
install -Dm444 LICENSE $out/share/
install -Dm444 README.md $out/share/
install -Dm444 utils/bento.nix $out/share/
'';
};
}
);
}