/ linuxy / flake.nix
Swadhin Biswas chore(release): bump version to 2.0.4 (#47) · 8/28/2026
fc705d2
134 lines · 3.9 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
{
  description = "Linuxy - Multi-platform Desktop Application Manager";
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
    rust-overlay = {
      url = "github:oxalica/rust-overlay";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { self, nixpkgs, flake-utils, rust-overlay }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        overlays = [ (import rust-overlay) ];
        pkgs = import nixpkgs { inherit system overlays; };
        rustToolchain = pkgs.rust-bin.stable.latest.default.override {
          extensions = [ "rust-src" "rust-analyzer" ];
        };
        bun = pkgs.bun;

        linuxy = pkgs.stdenv.mkDerivation rec {
          pname = "linuxy";
          version = "2.0.4";
          src = self;

          nativeBuildInputs = with pkgs; [
            rustToolchain
            bun
            pkg-config
            wrapGAppsHook
            autoPatchelfHook
            llvmPackages.clangUseLLVM
            makeWrapper
          ];

          buildInputs = with pkgs; [
            webkitgtk_4_1
            gtk3
            libappindicator-gtk3
            librsvg
            openssl
            libxdo
            xdg-utils
            firejail
            glib
            cairo
            pango
            gdk-pixbuf
            atk
            libsoup_3
            harfbuzz
            freetype
            gsettings-desktop-schemas
          ];

          dontWrapGApps = true;

          buildPhase = ''
            export HOME=$TMPDIR
            export BUN_INSTALL_CACHE_DIR=$TMPDIR/bun-cache
            bun install --offline --frozen-lockfile
            bun run build
            cd src-tauri
            cargo build --release --locked
            cd ..
          '';

          installPhase = ''
            mkdir -p $out/bin
            mkdir -p $out/share/applications
            mkdir -p $out/share/icons/hicolor
            mkdir -p $out/share/doc/linuxy

            cp src-tauri/target/release/linuxy $out/bin/linuxy
            cp src-tauri/debian/desktop-template.desktop $out/share/applications/linuxy.desktop

            for size in 32 128 256 512; do
              icon="src-tauri/icons/''${size}x''${size}.png"
              dir="$out/share/icons/hicolor/''${size}x''${size}/apps"
              mkdir -p "$dir"
              [ -f "$icon" ] && cp "$icon" "$dir/linuxy.png"
            done
            [ -f "src-tauri/icons/icon.png" ] && cp "src-tauri/icons/icon.png" \
              "$out/share/icons/hicolor/512x512/apps/linuxy.png"

            cp LICENSE $out/share/doc/linuxy/copyright

            wrapProgram $out/bin/linuxy \
              "''${gappsWrapperArgs[@]}" \
              --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.firejail pkgs.xdg-utils ]} \
              --set WEBKIT_DISABLE_COMPOSITING_MODE 1 \
              --set WEBKIT_FORCE_SANDBOX 0
          '';

          meta = with pkgs.lib; {
            description = "Multi-platform Desktop Application Manager with Firejail sandboxing";
            homepage = "https://github.com/swadhinbiswas/linuxy";
            license = licenses.mit;
            platforms = [ "x86_64-linux" "aarch64-linux" ];
            maintainers = [ ];
            mainProgram = "linuxy";
          };
        };
      in
      {
        packages.default = linuxy;
        packages.linuxy = linuxy;

        devShells.default = pkgs.mkShell {
          buildInputs = with pkgs; [
            rustToolchain
            bun
            pkg-config
            webkitgtk_4_1
            gtk3
            libappindicator-gtk3
            librsvg
            openssl
            libxdo
            firejail
            xdg-utils
          ];
          WEBKIT_DISABLE_COMPOSITING_MODE = "1";
          WEBKIT_FORCE_SANDBOX = "0";
        };

        apps.default = {
          type = "app";
          program = "${linuxy}/bin/linuxy";
        };
      });
}