-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathflake.nix
80 lines (72 loc) · 2.56 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
{
description = "A Pacman inspired frontend for Nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs = { self, nixpkgs }:
let
lib = nixpkgs.lib;
allSystems = lib.systems.flakeExposed;
forAllSystems = lib.genAttrs allSystems;
in
{
packages = forAllSystems (system:
let
manifest = builtins.fromTOML (builtins.readFile ./Cargo.toml);
pinix =
{ rustPlatform
, installShellFiles
, lib
}:
rustPlatform.buildRustPackage {
pname = manifest.package.name;
version = manifest.package.version;
src = ./.;
nativeBuildInputs = [ installShellFiles ];
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"console-0.16.0" = "sha256-dydgMgkqvBNW7eJntFIhBBWqOQnGnpQsVPRIBdqf0fY=";
"indicatif-0.17.8" = "sha256-KaTEGLU904ZVz2tEFZ/ls6B3LKCxhOVVuWSSLOifSAk=";
};
};
meta = with lib; {
description = "A Pacman inspired frontend for Nix";
homepage = "https://github.com/remi-dupre/pinix";
license = licenses.lgpl3;
mainProgram = "pinix";
};
postInstall =
let
wrappers = [ "nix" "nix-collect-garbage" "nixos-rebuild" "nix-shell" ];
install-wrappers =
lib.lists.forEach
wrappers
(nix-cmd:
let
pix-cmd = "pix" + (lib.strings.removePrefix "nix" nix-cmd);
pkg = pkgs.writeShellApplication {
name = pix-cmd;
text = ''pinix --pix-command ${nix-cmd} "$@"'';
};
in
''
cat ${pkg}/bin/${pix-cmd} > $out/bin/${pix-cmd}
chmod +x $out/bin/${pix-cmd}
''
);
in
lib.lists.foldl
(acc: line: acc + "\n" + line) ""
install-wrappers;
cargoSha256 = "sha256-6hKbAL3a1t1mHNUvvi65e/BkFoJQmvpZQlU58csmol4=";
};
pkgs = nixpkgs.legacyPackages.${system};
in
{
pinix = pkgs.callPackage pinix { };
default = self.packages.${system}.pinix;
}
);
};
}