-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
106 lines (89 loc) · 3.24 KB
/
flake.nix
File metadata and controls
106 lines (89 loc) · 3.24 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{
description = "CodeDown Desktop";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/release-25.11";
outputs = { self, nixpkgs }:
let
systems = [ "x86_64-linux" "aarch64-linux" ];
version = "1.8.4"; # version
forAllSystems = nixpkgs.lib.genAttrs systems;
urlFor = {
x86_64-linux = "https://github.com/codedownio/desktop/releases/download/v${version}/codedown-${version}-linux-amd64-unpacked.tar.gz"; # tarball-url-amd64
aarch64-linux = "https://github.com/codedownio/desktop/releases/download/v${version}/codedown-${version}-linux-arm64-unpacked.tar.gz"; # tarball-url-arm64
};
hashFor = {
x86_64-linux = "sha256-2hly431EMUfcaCjBg0y/T/UmQz4i1nCFc2GLY06NtbE="; # tarball-hash-amd64
aarch64-linux = "sha256-/0arBaZv3oznuzh62p6rWa+r0b67xHq2WuMlsyk+ntE="; # tarball-hash-arm64
};
mkCodedown = system:
let pkgs = import nixpkgs { inherit system; };
in pkgs.stdenv.mkDerivation {
pname = "codedown";
inherit version;
src = pkgs.fetchzip {
url = urlFor.${system};
hash = hashFor.${system};
};
nativeBuildInputs = with pkgs; [ autoPatchelfHook ];
buildInputs = with pkgs; [
alsa-lib
at-spi2-atk
cairo
cups
dbus
expat
gdk-pixbuf
glib
gtk3
libdrm
libxkbcommon
mesa
nspr
nss
pango
xorg.libX11
xorg.libXcomposite
xorg.libXdamage
xorg.libXext
xorg.libXfixes
xorg.libXrandr
xorg.libxcb
];
# The resources dir contains a bundled nix store template with its own
# ELF binaries, static binaries, and shebangs that must not be touched.
# Disable the entire fixup phase and handle autoPatchelf manually.
dontFixup = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/codedown
cp -r . $out/lib/codedown/
# Patch only the top-level Electron binaries/libs, not the bundled
# resources dir (which contains static binaries and a store template).
autoPatchelf --no-recurse $out/lib/codedown
# Remove chrome-sandbox so Electron falls back to the user namespace
# sandbox instead of aborting over the SUID bit (which can't be set
# in the nix store).
rm -f $out/lib/codedown/chrome-sandbox
install -Dm755 ${./wrapper.sh} $out/bin/codedown
patchShebangs $out/bin/codedown
substituteInPlace $out/bin/codedown --replace-fail "@out@" "$out"
runHook postInstall
'';
meta = {
description = "CodeDown Desktop";
mainProgram = "codedown";
platforms = [ system ];
};
};
in {
inherit version;
packages = forAllSystems (system: {
default = mkCodedown system;
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.default}/bin/codedown";
};
});
};
}