-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflake.nix
39 lines (38 loc) · 1.12 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{
description = "4dl - 4chan image downloader written in bash";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
};
outputs = { self, nixpkgs, ... }@inputs: let
systems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ];
forSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
nixpkgsFor = forSystems (system: import nixpkgs { inherit system; });
in {
defaultApp = forSystems (system: {
type = "app";
program = "${self.defaultPackage.${system}}/bin/4dl";
});
defaultPackage = forSystems (system:
let
pkgs = nixpkgsFor.${system};
deps = with pkgs; [
coreutils gnused gawk gnugrep
findutils # for xargs
ncurses # for tput
util-linuxMinimal # for column
fd
curl jq wget
dateutils
recode
];
binPath = nixpkgs.lib.makeBinPath deps;
in pkgs.runCommandLocal "4dl" {
nativeBuildInputs = [ pkgs.makeWrapper ];
} ''
mkdir -p $out/bin
cp ${./4dl} $out/bin/4dl
patchShebangs $out/bin/4dl
wrapProgram $out/bin/4dl --prefix PATH : ${binPath}
'');
};
}