Compare commits
	
		
			5 Commits
		
	
	
		
			24ee0d7826
			...
			jetbrains
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 8090f42cc2 | |||
| c67b2c2b0e | |||
| af57ecdd22 | |||
| fb2bbf59d0 | |||
| 3c8d8f0347 | 
							
								
								
									
										2
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/dependabot.yml
									
									
									
									
										vendored
									
									
								
							| @@ -4,5 +4,3 @@ updates: | |||||||
|     directory: "/" |     directory: "/" | ||||||
|     schedule: |     schedule: | ||||||
|       interval: "weekly" |       interval: "weekly" | ||||||
|     commit-message: |  | ||||||
|       prefix: "ci" |  | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										46
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,26 +1,14 @@ | |||||||
| name: "CI" | name: "Build and populate cache" | ||||||
| on: | on: | ||||||
|   pull_request: |   pull_request: | ||||||
|   push: |   push: | ||||||
|  |   schedule: | ||||||
|  |     # rebuild everyday at 6:50 | ||||||
|  |     # TIP: Choose a random time here so not all repositories are build at once: | ||||||
|  |     # https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new | ||||||
|  |     - cron:  '50 6 * * *' | ||||||
| jobs: | jobs: | ||||||
|  |   tests: | ||||||
|   checks: |  | ||||||
|     strategy: |  | ||||||
|       matrix: |  | ||||||
|         check: |  | ||||||
|           - nixpkgs-fmt |  | ||||||
|           - deadnix |  | ||||||
|           - nur |  | ||||||
|     runs-on: ubuntu-latest |  | ||||||
|     steps: |  | ||||||
|       - name: Checkout repository |  | ||||||
|         uses: actions/checkout@v4 |  | ||||||
|       - uses: cachix/install-nix-action@v23 |  | ||||||
|       - name: Check ${{ matrix.check }} |  | ||||||
|         # Depends on nixos/nix#7759 to simply `nix flake check` |  | ||||||
|         run: nix run .#checks.$(nix eval --raw --impure --expr "builtins.currentSystem").${{ matrix.check }} |  | ||||||
|  |  | ||||||
|   build-and-update: |  | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         # Set this to notify the global nur package registry that changes are |         # Set this to notify the global nur package registry that changes are | ||||||
| @@ -40,22 +28,30 @@ jobs: | |||||||
|         # in your repository settings in Github found at https://github.com/<your_githubname>/nur-packages/settings/secrets |         # in your repository settings in Github found at https://github.com/<your_githubname>/nur-packages/settings/secrets | ||||||
|         cachixName: |         cachixName: | ||||||
|           - xeals |           - xeals | ||||||
|  |         nixPath: | ||||||
|  |           - nixpkgs=channel:nixos-unstable | ||||||
|  |           - nixpkgs=channel:nixpkgs-unstable | ||||||
|  |           # Disable due to buildGoModule and buildRustPackage | ||||||
|  |           # - nixpkgs=channel:nixos-20.03 | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|     steps: |     steps: | ||||||
|     - name: Checkout repository |     - name: Checkout repository | ||||||
|       uses: actions/checkout@v4 |       uses: actions/checkout@v2.3.4 | ||||||
|     - name: Install nix |     - name: Install nix | ||||||
|       uses: cachix/install-nix-action@v23 |       uses: cachix/install-nix-action@v12 | ||||||
|  |       with: | ||||||
|  |         nix_path: "${{ matrix.nixPath }}" | ||||||
|     - name: Show nixpkgs version |     - name: Show nixpkgs version | ||||||
|       run: nix eval --impure --expr '(import ./flake-compat.nix { src = ./.; }).lib.version' |       run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' | ||||||
|     - name: Setup cachix |     - name: Setup cachix | ||||||
|       uses: cachix/cachix-action@v12 |       uses: cachix/cachix-action@v8 | ||||||
|       if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }} |       if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }} | ||||||
|       with: |       with: | ||||||
|         name: ${{ matrix.cachixName }} |         name: ${{ matrix.cachixName }} | ||||||
|         signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' |         signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | ||||||
|     - name: Build nix packages |     - name: Build nix packages | ||||||
|       run: nix develop .#ci -c nix-build-uncached ci.nix -A cacheOutputs |       # TODO switch to default nixpkgs channel once nix-build-uncached 1.0.0 is in stable | ||||||
|  |       run: nix run -I 'nixpkgs=channel:nixos-unstable' nixpkgs.nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs | ||||||
|     - name: Trigger NUR update |     - name: Trigger NUR update | ||||||
|       if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }} |       if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }} | ||||||
|       run: curl -XPOST "https://nur-update.nix-community.org/update?repo=${{ matrix.nurRepo }}" |       run: curl -XPOST "https://nur-update.herokuapp.com/update?repo=${{ matrix.nurRepo }}" | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										24
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,24 +0,0 @@ | |||||||
| name: "Update flake inputs" |  | ||||||
| on: |  | ||||||
|   workflow_dispatch: |  | ||||||
|   schedule: |  | ||||||
|     # bump weekly at 6:50 |  | ||||||
|     - cron:  '50 6 * * 1' |  | ||||||
| jobs: |  | ||||||
|   update-flake: |  | ||||||
|     runs-on: ubuntu-latest |  | ||||||
|     strategy: |  | ||||||
|       fail-fast: false |  | ||||||
|     steps: |  | ||||||
|       - name: Checkout repository |  | ||||||
|         uses: actions/checkout@v4 |  | ||||||
|       - uses: cachix/install-nix-action@v23 |  | ||||||
|         with: |  | ||||||
|           extra_nix_config: | |  | ||||||
|             access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |  | ||||||
|       - name: "flake: update inputs" |  | ||||||
|         uses: DeterminateSystems/update-flake-lock@v20 |  | ||||||
|         with: |  | ||||||
|           pr-title: "flake: update inputs" |  | ||||||
|           pr-labels: dependencies |  | ||||||
|           commit-msg: "flake: update inputs" |  | ||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| **My personal [NUR](https://github.com/nix-community/NUR) repository** | **My personal [NUR](https://github.com/nix-community/NUR) repository** | ||||||
|  |  | ||||||
| [](https://github.com/xeals/nur-packages/actions) [](https://xeals.cachix.org) | [](https://github.com/xeals/nur-packages/actions) [](https://xeals.cachix.org) | ||||||
|  |  | ||||||
| ## Noteworthy packages | ## Noteworthy packages | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								ci.nix
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								ci.nix
									
									
									
									
									
								
							| @@ -9,7 +9,7 @@ | |||||||
| # then your CI will be able to build and cache only those packages for | # then your CI will be able to build and cache only those packages for | ||||||
| # which this is possible. | # which this is possible. | ||||||
|  |  | ||||||
| { pkgs ? import ./flake-compat.nix { src = ./.; } }: | { pkgs ? import <nixpkgs> {} }: | ||||||
|  |  | ||||||
| with builtins; | with builtins; | ||||||
|  |  | ||||||
| @@ -29,10 +29,10 @@ let | |||||||
|     let |     let | ||||||
|       f = p: |       f = p: | ||||||
|         if shouldRecurseForDerivations p then flattenPkgs p |         if shouldRecurseForDerivations p then flattenPkgs p | ||||||
|         else if isDerivation p then [ p ] |         else if isDerivation p then [p] | ||||||
|         else [ ]; |         else []; | ||||||
|     in |     in | ||||||
|     concatMap f (attrValues s); |       concatMap f (attrValues s); | ||||||
|  |  | ||||||
|   outputsOf = p: map (o: p.${o}) p.outputs; |   outputsOf = p: map (o: p.${o}) p.outputs; | ||||||
|  |  | ||||||
| @@ -40,10 +40,10 @@ let | |||||||
|  |  | ||||||
|   nurPkgs = |   nurPkgs = | ||||||
|     flattenPkgs |     flattenPkgs | ||||||
|       (listToAttrs |     (listToAttrs | ||||||
|         (map (n: nameValuePair n nurAttrs.${n}) |     (map (n: nameValuePair n nurAttrs.${n}) | ||||||
|           (filter (n: !isReserved n) |     (filter (n: !isReserved n) | ||||||
|             (attrNames nurAttrs)))); |     (attrNames nurAttrs)))); | ||||||
|  |  | ||||||
| in | in | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,11 +7,9 @@ | |||||||
| #     nix-build -A mypackage | #     nix-build -A mypackage | ||||||
|  |  | ||||||
| { pkgs ? import <nixpkgs> { } }: | { pkgs ? import <nixpkgs> { } }: | ||||||
| let |  | ||||||
|   system = pkgs.stdenv.hostPlatform.system; | import ./pkgs/top-level/all-packages.nix { inherit pkgs; } | ||||||
|   packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; }; |   // { | ||||||
| in |  | ||||||
| packages // { |  | ||||||
|   # The `lib`, `modules`, and `overlay` names are special |   # The `lib`, `modules`, and `overlay` names are special | ||||||
|   lib = import ./lib { inherit pkgs; }; # functions |   lib = import ./lib { inherit pkgs; }; # functions | ||||||
|   modules = import ./modules; # NixOS modules |   modules = import ./modules; # NixOS modules | ||||||
|   | |||||||
| @@ -1,12 +0,0 @@ | |||||||
| { src, system ? builtins.currentSystem or "unknown-system" }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   lockFilePath = "${src}/flake.lock"; |  | ||||||
|   lockFile = builtins.fromJSON (builtins.readFile lockFilePath); |  | ||||||
|   nixpkgs = lockFile.nodes.nixpkgs.locked; |  | ||||||
|   tarball = fetchTarball { |  | ||||||
|     url = "https://github.com/${nixpkgs.owner}/${nixpkgs.repo}/archive/${nixpkgs.rev}.zip"; |  | ||||||
|     sha256 = nixpkgs.narHash; |  | ||||||
|   }; |  | ||||||
| in |  | ||||||
| import tarball { inherit system; } |  | ||||||
							
								
								
									
										30
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										30
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							| @@ -1,15 +1,12 @@ | |||||||
| { | { | ||||||
|   "nodes": { |   "nodes": { | ||||||
|     "flake-utils": { |     "flake-utils": { | ||||||
|       "inputs": { |  | ||||||
|         "systems": "systems" |  | ||||||
|       }, |  | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1694529238, |         "lastModified": 1605370193, | ||||||
|         "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", |         "narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=", | ||||||
|         "owner": "numtide", |         "owner": "numtide", | ||||||
|         "repo": "flake-utils", |         "repo": "flake-utils", | ||||||
|         "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", |         "rev": "5021eac20303a61fafe17224c087f5519baed54d", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
| @@ -20,11 +17,11 @@ | |||||||
|     }, |     }, | ||||||
|     "nixpkgs": { |     "nixpkgs": { | ||||||
|       "locked": { |       "locked": { | ||||||
|         "lastModified": 1694948089, |         "lastModified": 1611414562, | ||||||
|         "narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=", |         "narHash": "sha256-u002KfYA7Uk3vffnnmLz88BmxOzixYFdh+8II6ZT+Kg=", | ||||||
|         "owner": "NixOS", |         "owner": "NixOS", | ||||||
|         "repo": "nixpkgs", |         "repo": "nixpkgs", | ||||||
|         "rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db", |         "rev": "9d6fd2ba135c5b5c85c3332604d39b43e93b8298", | ||||||
|         "type": "github" |         "type": "github" | ||||||
|       }, |       }, | ||||||
|       "original": { |       "original": { | ||||||
| @@ -39,21 +36,6 @@ | |||||||
|         "flake-utils": "flake-utils", |         "flake-utils": "flake-utils", | ||||||
|         "nixpkgs": "nixpkgs" |         "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", |   "root": "root", | ||||||
|   | |||||||
							
								
								
									
										99
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										99
									
								
								flake.nix
									
									
									
									
									
								
							| @@ -1,72 +1,47 @@ | |||||||
| { | { | ||||||
|   description = "xeals's Nix repository"; |   description = "xeals's flake"; | ||||||
|  |  | ||||||
|   inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |   inputs = { | ||||||
|   inputs.flake-utils.url = "github:numtide/flake-utils"; |     nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||||||
|  |     flake-utils.url = "github:numtide/flake-utils"; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|   outputs = { self, nixpkgs, flake-utils }: |   outputs = { self, nixpkgs, flake-utils }: | ||||||
|     let |     let | ||||||
|       inherit (nixpkgs) lib; |       inherit (flake-utils.lib) eachDefaultSystem flattenTree; | ||||||
|       inherit (flake-utils.lib) mkApp; |       inherit (nixpkgs.lib.attrsets) filterAttrs mapAttrs; | ||||||
|     in |     in | ||||||
|     flake-utils.lib.eachDefaultSystem |     { | ||||||
|       (system: |       nixosModules = mapAttrs (_: path: import path) (import ./modules); | ||||||
|         let |  | ||||||
|           pkgs = import nixpkgs { inherit system; }; |  | ||||||
|         in |  | ||||||
|         { |  | ||||||
|           packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; }; |  | ||||||
|  |  | ||||||
|           checks = { |  | ||||||
|             nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" '' |  | ||||||
|               ${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check . |  | ||||||
|             ''; |  | ||||||
|             deadnix = pkgs.writeShellScriptBin "deadnix-check" '' |  | ||||||
|               ${pkgs.deadnix}/bin/deadnix --fail . |  | ||||||
|             ''; |  | ||||||
|             # Ensures that the NUR bot can evaluate and find all our packages. |  | ||||||
|             # Normally we'd also run with `--option restrict-eval true`, but |  | ||||||
|             # this is incompatible with flakes because reasons. |  | ||||||
|             nur = pkgs.writeShellScriptBin "nur-check" '' |  | ||||||
|               # Prefer nixpkgs channel (actual build), otherwise read from flake.lock (CI) |  | ||||||
|               if ! nixpkgs=$(nix-instantiate --find-file nixpkgs 2>/dev/null); then |  | ||||||
|                 _rev=$(${pkgs.jq}/bin/jq -r .nodes.nixpkgs.locked.rev flake.lock) |  | ||||||
|                 nixpkgs="https://github.com/nixos/nixpkgs/archive/''${_rev}.tar.gz" |  | ||||||
|               fi |  | ||||||
|               nix-env -f . -qa \* --meta \ |  | ||||||
|                 --allowed-uris https://static.rust-lang.org \ |  | ||||||
|                 --option allow-import-from-derivation true \ |  | ||||||
|                 --drv-path --show-trace \ |  | ||||||
|                 -I nixpkgs="$nixpkgs" \ |  | ||||||
|                 -I ./ \ |  | ||||||
|                 --json | ${pkgs.jq}/bin/jq -r 'values | .[].name' |  | ||||||
|             ''; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           devShells.ci = pkgs.mkShellNoCC { |  | ||||||
|             buildInputs = [ pkgs.nix-build-uncached ]; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           apps = { |  | ||||||
|             alacritty = mkApp { drv = pkgs.alacritty-ligatures; exePath = "/bin/alacritty"; }; |  | ||||||
|             protonmail-bridge = mkApp { drv = pkgs.protonmail-bridge; }; |  | ||||||
|             protonmail-bridge-headless = mkApp { drv = pkgs.protonmail-bridge; }; |  | ||||||
|             psst-cli = mkApp { drv = pkgs.psst; exePath = "/bin/psst-cli"; }; |  | ||||||
|             psst-gui = mkApp { drv = pkgs.psst; exePath = "/bin/psst-gui"; }; |  | ||||||
|             samrewritten = mkApp { drv = pkgs.samrewritten; }; |  | ||||||
|             spotify-ripper = mkApp { drv = pkgs.spotify-ripper; }; |  | ||||||
|           }; |  | ||||||
|         }) |  | ||||||
|     // { |  | ||||||
|       nixosModules = lib.mapAttrs (_: path: import path) (import ./modules) // { |  | ||||||
|         default = { |  | ||||||
|           imports = lib.attrValues self.nixosModules; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       overlays = import ./overlays // { |       overlays = import ./overlays // { | ||||||
|         pkgs = _: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; }; |         pkgs = final: prev: import ./pkgs/top-level/all-packages.nix { pkgs = prev; }; | ||||||
|         default = _: _: { xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs; }; |  | ||||||
|       }; |       }; | ||||||
|     }; |  | ||||||
|  |       overlay = final: prev: { | ||||||
|  |         xeals = nixpkgs.lib.composeExtensions self.overlays.pkgs; | ||||||
|  |       }; | ||||||
|  |     } // eachDefaultSystem (system: | ||||||
|  |       let | ||||||
|  |         pkgs = nixpkgs.legacyPackages.${system}; | ||||||
|  |         xPkgs = import ./pkgs/top-level/all-packages.nix { inherit pkgs; }; | ||||||
|  |         mkApp = opts: { type = "app"; } // opts; | ||||||
|  |       in | ||||||
|  |       rec { | ||||||
|  |         packages = filterAttrs | ||||||
|  |           (attr: drv: builtins.elem system (drv.meta.platforms or [ ])) | ||||||
|  |           (flattenTree xPkgs); | ||||||
|  |  | ||||||
|  |         apps = flattenTree { | ||||||
|  |           alacritty = mkApp { program = "${packages.alacritty-ligatures}/bin/alacritty"; }; | ||||||
|  |           protonmail-bridge = mkApp { program = "${packages.protonmail-bridge}/bin/protonmail-bridge"; }; | ||||||
|  |           protonmail-bridge-headless = mkApp { program = "${packages.protonmail-bridge}/bin/protonmail-bridge"; }; | ||||||
|  |           psst = { | ||||||
|  |             cli = mkApp { program = "${packages.psst}/bin/psst-cli"; }; | ||||||
|  |             gui = mkApp { program = "${packages.psst}/bin/psst-gui"; }; | ||||||
|  |           }; | ||||||
|  |           samrewritten = mkApp { program = "${packages.samrewritten}/bin/samrewritten"; }; | ||||||
|  |           spotify-ripper = mkApp { program = "${packages.spotify-ripper}/bin/spotify-ripper"; }; | ||||||
|  |         }; | ||||||
|  |       }); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,8 +2,6 @@ | |||||||
|   amdgpu-common = ./services/hardware/amdgpu-common.nix; |   amdgpu-common = ./services/hardware/amdgpu-common.nix; | ||||||
|   amdgpu-fan = ./services/hardware/amdgpu-fan.nix; |   amdgpu-fan = ./services/hardware/amdgpu-fan.nix; | ||||||
|   amdgpu-pwm = ./services/hardware/amdgpu-pwm.nix; |   amdgpu-pwm = ./services/hardware/amdgpu-pwm.nix; | ||||||
|   betanin = ./services/web-apps/betanin.nix; |  | ||||||
|   dunst = ./services/x11/dunst.nix; |  | ||||||
|   radeon-profile-daemon = ./services/hardware/radeon-profile-daemon.nix; |   radeon-profile-daemon = ./services/hardware/radeon-profile-daemon.nix; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib, ... }: | { config, lib, pkgs, ... }: | ||||||
|  |  | ||||||
| with lib; | with lib; | ||||||
|  |  | ||||||
| @@ -7,7 +7,7 @@ with lib; | |||||||
|     cards = mkOption { |     cards = mkOption { | ||||||
|       type = types.listOf types.str; |       type = types.listOf types.str; | ||||||
|       default = [ "card0" ]; |       default = [ "card0" ]; | ||||||
|       example = [ "card0" "card1" ]; |       example = literalExample ''[ "card0" ]''; | ||||||
|       description = '' |       description = '' | ||||||
|         A list of cards to enable fan configuration for. The identifiers for |         A list of cards to enable fan configuration for. The identifiers for | ||||||
|         each device can be found in /sys/class/drm/ as card0, card1, etc. |         each device can be found in /sys/class/drm/ as card0, card1, etc. | ||||||
|   | |||||||
| @@ -33,12 +33,14 @@ in | |||||||
|         [ 75 89 ] |         [ 75 89 ] | ||||||
|         [ 80 100 ] |         [ 80 100 ] | ||||||
|       ]; |       ]; | ||||||
|       example = [ |       example = literalExample '' | ||||||
|         [ 0 0 ] |         [ | ||||||
|         [ 40 30 ] |           [ 0 0 ] | ||||||
|         [ 60 50 ] |           [ 40 30 ] | ||||||
|         [ 80 100 ] |           [ 60 50 ] | ||||||
|       ]; |           [ 80 100 ] | ||||||
|  |         ] | ||||||
|  |       ''; | ||||||
|       description = '' |       description = '' | ||||||
|         A list of temperature-fan speed pairs. The temperature is specified in |         A list of temperature-fan speed pairs. The temperature is specified in | ||||||
|         degrees celcius, and speed is specified in %. |         degrees celcius, and speed is specified in %. | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| { config, lib, ... }: | { config, lib, pkgs, ... }: | ||||||
|  |  | ||||||
| with lib; | with lib; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,251 +0,0 @@ | |||||||
| { config, lib, pkgs, ... }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   inherit (lib) mkIf mkOption optionalAttrs optionalString types; |  | ||||||
|   cfg = config.services.betanin; |  | ||||||
|  |  | ||||||
|   defaultUser = "betanin"; |  | ||||||
|   defaultGroup = "betanin"; |  | ||||||
|   defaultSettings = { |  | ||||||
|     notifications = { |  | ||||||
|       services = { }; |  | ||||||
|       strings = { |  | ||||||
|         title = "[betanin] torrent `$name` $status"; |  | ||||||
|         body = "@ $time. view/use the console at http://127.0.0.1:${toString cfg.port}/$console_path"; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   finalSettings = |  | ||||||
|     let |  | ||||||
|       base = lib.filterAttrsRecursive (n: _: !(lib.hasSuffix "_file" n)) cfg.settings; |  | ||||||
|       clean = { |  | ||||||
|         frontend.password = |  | ||||||
|           if cfg.settings.frontend.password_file != null |  | ||||||
|           then "@password@" |  | ||||||
|           else cfg.settings.frontend.password; |  | ||||||
|         clients.api_key = |  | ||||||
|           if cfg.settings.clients.api_key_file != null |  | ||||||
|           then "@api_key@" |  | ||||||
|           else cfg.settings.clients.api_key; |  | ||||||
|       }; |  | ||||||
|     in |  | ||||||
|     lib.foldl' lib.recursiveUpdate defaultSettings [ base clean ]; |  | ||||||
|  |  | ||||||
|   settingsFormat = pkgs.formats.toml { }; |  | ||||||
|   settingsFile = settingsFormat.generate "betanin.toml" finalSettings; |  | ||||||
|  |  | ||||||
|   beetsFormat = pkgs.formats.yaml { }; |  | ||||||
|   beetsFile = |  | ||||||
|     if (cfg.beetsFile != null) |  | ||||||
|     then cfg.beetsFile |  | ||||||
|     else if (cfg.beetsConfig != { }) |  | ||||||
|     then beetsFormat.generate "betanin-beets.yaml" cfg.beetsConfig |  | ||||||
|     else null; |  | ||||||
| in |  | ||||||
| { |  | ||||||
|   options = { |  | ||||||
|     services.betanin = { |  | ||||||
|       enable = lib.mkEnableOption "betanin"; |  | ||||||
|  |  | ||||||
|       package = mkOption { |  | ||||||
|         description = "Package containing betanin program."; |  | ||||||
|         type = types.package; |  | ||||||
|         default = pkgs.betanin or (import ../../.. { inherit pkgs; }).betanin; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       openFirewall = mkOption { |  | ||||||
|         description = "Open ports in the firewall for the server."; |  | ||||||
|         type = types.bool; |  | ||||||
|         default = false; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       port = mkOption { |  | ||||||
|         description = "Port to access betanin on."; |  | ||||||
|         type = types.port; |  | ||||||
|         default = 9393; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       user = mkOption { |  | ||||||
|         description = "User that the betanin program should run under."; |  | ||||||
|         type = types.str; |  | ||||||
|         default = defaultUser; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       group = mkOption { |  | ||||||
|         description = "Group that the betanin program should run under."; |  | ||||||
|         type = types.str; |  | ||||||
|         default = defaultGroup; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       dataDir = mkOption { |  | ||||||
|         description = "Directory to store application data."; |  | ||||||
|         type = types.str; |  | ||||||
|         default = "/var/lib/betanin"; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       settings = mkOption { |  | ||||||
|         type = types.submodule { |  | ||||||
|           freeformType = settingsFormat.type; |  | ||||||
|  |  | ||||||
|           options.frontend.username = mkOption { |  | ||||||
|             type = types.str; |  | ||||||
|             default = ""; |  | ||||||
|             description = "Username used to log into the frontend. Must be set."; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           options.frontend.password = mkOption { |  | ||||||
|             type = types.str; |  | ||||||
|             default = ""; |  | ||||||
|             description = '' |  | ||||||
|               Password used to log into the frontend. Either password or |  | ||||||
|               password_file must be set. |  | ||||||
|             ''; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           options.frontend.password_file = mkOption { |  | ||||||
|             type = with types; nullOr (either str path); |  | ||||||
|             default = null; |  | ||||||
|             description = '' |  | ||||||
|               File containing the password used to log into the frontend. The |  | ||||||
|               file must be readable by the betanin user/group. |  | ||||||
|  |  | ||||||
|               Using a password file keeps the password out of the Nix store, but |  | ||||||
|               the password is still stored in plain text in the service data |  | ||||||
|               directory. |  | ||||||
|             ''; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           options.clients.api_key = mkOption { |  | ||||||
|             type = types.nullOr types.str; |  | ||||||
|             default = ""; |  | ||||||
|             description = '' |  | ||||||
|               API key used to access Betanin (e.g., from other services). |  | ||||||
|             ''; |  | ||||||
|           }; |  | ||||||
|  |  | ||||||
|           options.clients.api_key_file = mkOption { |  | ||||||
|             type = with types; nullOr (either str path); |  | ||||||
|             default = null; |  | ||||||
|             description = '' |  | ||||||
|               File containing the API key used to access Betanin (e.g., from |  | ||||||
|               other services). The file must be readable by the betanin |  | ||||||
|               user/group. |  | ||||||
|  |  | ||||||
|               Using a API key file keeps the API key out of the Nix store, but |  | ||||||
|               the API key is still stored in plain text in the service data |  | ||||||
|               directory. |  | ||||||
|             ''; |  | ||||||
|           }; |  | ||||||
|         }; |  | ||||||
|         default = defaultSettings; |  | ||||||
|         example = lib.literalExpression '' |  | ||||||
|           { |  | ||||||
|             frontend = { |  | ||||||
|               username = "foo"; |  | ||||||
|               password_file = "/run/secrets/betaninPasswordFile"; |  | ||||||
|             }; |  | ||||||
|             clients = { |  | ||||||
|               api_key_file = "/run/secrets/betaninApiKeyFile"; |  | ||||||
|             }; |  | ||||||
|             server = { |  | ||||||
|               num_parallel_jobs = 1; |  | ||||||
|             }; |  | ||||||
|           } |  | ||||||
|         ''; |  | ||||||
|         description = "Configuration for betanin."; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       beetsConfig = mkOption { |  | ||||||
|         description = "beets configuration."; |  | ||||||
|         type = beetsFormat.type; |  | ||||||
|         default = { }; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       beetsFile = mkOption { |  | ||||||
|         description = "beets configuration file."; |  | ||||||
|         type = with types; nullOr (either str path); |  | ||||||
|         default = null; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   config = mkIf cfg.enable { |  | ||||||
|     assertions = [ |  | ||||||
|       { |  | ||||||
|         assertion = cfg.settings.frontend.username != ""; |  | ||||||
|         message = "services.betanin.settings.frontend.username is required"; |  | ||||||
|       } |  | ||||||
|       { |  | ||||||
|         assertion = (cfg.settings.frontend.password == "") != (cfg.settings.frontend.password_file == null); |  | ||||||
|         message = "services.betanin.settings.frontend.password or services.betanin.settings.frontend.password_file is required"; |  | ||||||
|       } |  | ||||||
|       { |  | ||||||
|         assertion = (cfg.settings.clients.api_key == "") != (cfg.settings.clients.api_key_file == null); |  | ||||||
|         message = "services.betanin.settings.clients.api_key or services.betanin.settings.clients.api_key_file is required"; |  | ||||||
|       } |  | ||||||
|     ]; |  | ||||||
|  |  | ||||||
|     networking.firewall = mkIf cfg.openFirewall { |  | ||||||
|       allowedTCPPorts = [ cfg.port ]; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     systemd.services.betanin = |  | ||||||
|       let |  | ||||||
|         replaceSecret = secretFile: placeholder: targetFile: |  | ||||||
|           optionalString (secretFile != null) '' |  | ||||||
|             ${pkgs.replace-secret}/bin/replace-secret ${placeholder} ${secretFile} ${targetFile} |  | ||||||
|           ''; |  | ||||||
|         replaceConfigSecret = secretFile: placeholder: |  | ||||||
|           replaceSecret secretFile placeholder "${cfg.dataDir}/.config/betanin/config.toml"; |  | ||||||
|       in |  | ||||||
|       { |  | ||||||
|         description = "Betanin service"; |  | ||||||
|         wantedBy = [ "multi-user.target" ]; |  | ||||||
|         after = [ "networking.target" ]; |  | ||||||
|         environment = { |  | ||||||
|           HOME = cfg.dataDir; |  | ||||||
|         }; |  | ||||||
|         path = [ pkgs.replace-secret ]; |  | ||||||
|  |  | ||||||
|         script = '' |  | ||||||
|           mkdir -p ${cfg.dataDir}/.config/betanin \ |  | ||||||
|             ${cfg.dataDir}/.config/beets \ |  | ||||||
|             ${cfg.dataDir}/.local/share/betanin |  | ||||||
|           cat ${settingsFile} > ${cfg.dataDir}/.config/betanin/config.toml |  | ||||||
|  |  | ||||||
|           ${optionalString (beetsFile != null) '' |  | ||||||
|             ln -sf ${beetsFile} ${cfg.dataDir}/.config/betanin/config.toml |  | ||||||
|           ''} |  | ||||||
|           ${replaceConfigSecret cfg.settings.frontend.password_file "@password@"} |  | ||||||
|           ${replaceConfigSecret cfg.settings.frontend.api_key_file "@api_key@"} |  | ||||||
|  |  | ||||||
|           ${cfg.package}/bin/betanin --port ${toString cfg.port} |  | ||||||
|         ''; |  | ||||||
|  |  | ||||||
|         serviceConfig = lib.mkMerge [ |  | ||||||
|           { |  | ||||||
|             User = cfg.user; |  | ||||||
|             Group = cfg.group; |  | ||||||
|             PrivateTmp = true; |  | ||||||
|             Restart = "always"; |  | ||||||
|             WorkingDirectory = cfg.dataDir; |  | ||||||
|           } |  | ||||||
|           (mkIf (cfg.dataDir == "/var/lib/betanin") { |  | ||||||
|             StateDirectory = "betanin"; |  | ||||||
|           }) |  | ||||||
|         ]; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|     users.users = optionalAttrs (cfg.user == defaultUser) { |  | ||||||
|       ${cfg.user} = { |  | ||||||
|         isSystemUser = true; |  | ||||||
|         group = cfg.group; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     users.groups = optionalAttrs (cfg.group == defaultGroup) { |  | ||||||
|       ${cfg.group} = { }; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -1,68 +0,0 @@ | |||||||
| { config, lib, pkgs, ... }: |  | ||||||
|  |  | ||||||
| with lib; |  | ||||||
| let |  | ||||||
|   cfg = config.services.dunst; |  | ||||||
| in |  | ||||||
| { |  | ||||||
|   options.services.dunst = { |  | ||||||
|     enable = mkEnableOption "dunst"; |  | ||||||
|  |  | ||||||
|     package = mkOption { |  | ||||||
|       type = types.package; |  | ||||||
|       default = pkgs.dunst; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     settings = mkOption { |  | ||||||
|       type = types.nullOr types.attrs; |  | ||||||
|       default = null; |  | ||||||
|       description = '' |  | ||||||
|         Configuration set alternative to <literal>configFile</literal>. |  | ||||||
|       ''; |  | ||||||
|       example = { |  | ||||||
|         global = { |  | ||||||
|           monitor = 0; |  | ||||||
|           follow = "none"; |  | ||||||
|         }; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|     configFile = mkOption { |  | ||||||
|       type = types.nullOr types.path; |  | ||||||
|       default = null; |  | ||||||
|       description = "Path to dunstrc configuration file."; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   config = mkIf cfg.enable { |  | ||||||
|     assertions = [ |  | ||||||
|       { |  | ||||||
|         assertion = !(cfg.settings != null && cfg.configFile != null); |  | ||||||
|         message = "only one of services.dunst.settings or .configFile may be specified"; |  | ||||||
|       } |  | ||||||
|     ]; |  | ||||||
|  |  | ||||||
|     environment.systemPackages = [ (getOutput "man" cfg.package) ]; |  | ||||||
|  |  | ||||||
|     systemd.user.services.dunst = { |  | ||||||
|       description = "Dunst notification daemon"; |  | ||||||
|       documentation = [ "man:dunst(1)" ]; |  | ||||||
|       after = [ "graphical-session-pre.target" ]; |  | ||||||
|       partOf = [ "graphical-session.target" ]; |  | ||||||
|       serviceConfig = { |  | ||||||
|         Type = "dbus"; |  | ||||||
|         BusName = "org.freedesktop.Notifications"; |  | ||||||
|         ExecStart = |  | ||||||
|           let |  | ||||||
|             config = |  | ||||||
|               if (cfg.settings != null) |  | ||||||
|               then pkgs.writeText "dunstrc" (generators.toINI { } cfg.settings) |  | ||||||
|               else if (cfg.configFile != null) |  | ||||||
|               then cfg.configFile |  | ||||||
|               else null; |  | ||||||
|           in |  | ||||||
|           "${cfg.package}/bin/dunst ${optionalString (config != null) "-conf ${config}"}"; |  | ||||||
|       }; |  | ||||||
|     }; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -2,7 +2,7 @@ | |||||||
| # case where you don't want to add the whole NUR namespace to your | # case where you don't want to add the whole NUR namespace to your | ||||||
| # configuration. | # configuration. | ||||||
|  |  | ||||||
| _self: super: | self: super: | ||||||
|  |  | ||||||
| let | let | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| , python3Packages | , python3Packages | ||||||
|  |  | ||||||
| @@ -20,7 +20,7 @@ python3Packages.buildPythonApplication rec { | |||||||
|  |  | ||||||
|   doCheck = false; |   doCheck = false; | ||||||
|  |  | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     homepage = "https://github.com/Prior99/mopidy-subidy"; |     homepage = "https://github.com/Prior99/mopidy-subidy"; | ||||||
|     description = "Mopidy extension for playing music from Subsonic servers"; |     description = "Mopidy extension for playing music from Subsonic servers"; | ||||||
|     license = licenses.bsd3; |     license = licenses.bsd3; | ||||||
|   | |||||||
| @@ -1,10 +1,9 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| , rustPlatform | , rustPlatform | ||||||
| 
 | 
 | ||||||
|  | , cmake | ||||||
| , pkg-config | , pkg-config | ||||||
| , alsaLib |  | ||||||
| , dbus |  | ||||||
| , openssl | , openssl | ||||||
| 
 | 
 | ||||||
|   # GUI |   # GUI | ||||||
| @@ -15,27 +14,27 @@ | |||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
| let | let | ||||||
|   inherit (lib) optional optionals; |   inherit (stdenv.lib) optional optionals; | ||||||
| in | in | ||||||
| 
 | 
 | ||||||
| assert withGui -> gtk3.meta.available; | assert withGui -> gtk3.meta.available; | ||||||
| 
 | 
 | ||||||
| rustPlatform.buildRustPackage rec { | rustPlatform.buildRustPackage rec { | ||||||
|   pname = "psst"; |   pname = "psst"; | ||||||
|   version = "20221012.d70ed81"; |   version = "20210122.gec114ac"; | ||||||
|   src = fetchFromGitHub { |   src = fetchFromGitHub { | ||||||
|     owner = "jpochyla"; |     owner = "jpochyla"; | ||||||
|     repo = "psst"; |     repo = "psst"; | ||||||
|     rev = "d70ed8104533dc15bc36b989ba8428872c9b578f"; |     rev = "ec114ac8299179c8dd51bc026d6060dc75658b83"; | ||||||
|     hash = "sha256-ZKhHN0ruLb6ZVKkrKv/YawRsVop6SP1QF/nrtkmA8P8="; |     sha256 = "02mh6hjnlimadc3w899hccss31p1r4sxgb5880zwn7yiycbq3yyj"; | ||||||
|     fetchSubmodules = true; |     fetchSubmodules = true; | ||||||
|   }; |   }; | ||||||
|   cargoSha256 = "sha256-zH6+EV78FDVOYEFXk0f54pH2Su0QpK1I0bHqzIiMdBo="; |   cargoSha256 = "1m01rycnpy9asspih1x9l5ppfbjnqcfdycmzgkrmdwzah3x8s8xc"; | ||||||
| 
 | 
 | ||||||
|   nativeBuildInputs = [ pkg-config ] |   nativeBuildInputs = [ pkg-config ] | ||||||
|     ++ optional withGui copyDesktopItems; |     ++ optional withGui copyDesktopItems; | ||||||
| 
 | 
 | ||||||
|   buildInputs = [ alsaLib dbus openssl ] |   buildInputs = [ openssl ] | ||||||
|     ++ optional withGui gtk3; |     ++ optional withGui gtk3; | ||||||
| 
 | 
 | ||||||
|   cargoBuildFlags = optionals (!withGui) [ |   cargoBuildFlags = optionals (!withGui) [ | ||||||
| @@ -55,16 +54,16 @@ rustPlatform.buildRustPackage rec { | |||||||
|       name = pname; |       name = pname; | ||||||
|       desktopName = "psst"; |       desktopName = "psst"; | ||||||
|       genericName = "Spotify Player"; |       genericName = "Spotify Player"; | ||||||
|       categories = [ "AudioVideo" "Audio" "Network" "Player" ]; |       categories = "AudioVideo;Audio;Network;Player;"; | ||||||
|       comment = "Spotify client with native GUI"; |       comment = "Spotify client with native GUI"; | ||||||
|       exec = "psst-gui"; |       exec = "psst-gui"; | ||||||
|       keywords = [ "spotify" "music" ]; |       extraEntries = "Keywords=spotify;music;"; | ||||||
|       icon = "spotify"; |       icon = "spotify"; | ||||||
|       type = "Application"; |       type = "Application"; | ||||||
|     }) |     }) | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     description = "Fast and multi-platform Spotify client with native GUI "; |     description = "Fast and multi-platform Spotify client with native GUI "; | ||||||
|     homepage = "https://github.com/jpochyla/psst"; |     homepage = "https://github.com/jpochyla/psst"; | ||||||
|     license = licenses.mit; |     license = licenses.mit; | ||||||
| @@ -1,45 +0,0 @@ | |||||||
| { lib, stdenv, fetchzip }: |  | ||||||
|  |  | ||||||
| self: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|  |  | ||||||
|   commonBuild = import ../../../build-support/jetbrains/plugin.nix { |  | ||||||
|     inherit lib stdenv fetchzip; |  | ||||||
|     jetbrainsPlatforms = [ |  | ||||||
|       "clion" |  | ||||||
|       "datagrip" |  | ||||||
|       "goland" |  | ||||||
|       "idea-community" |  | ||||||
|       "idea-ultimate" |  | ||||||
|       "phpstorm" |  | ||||||
|       "pycharm-community" |  | ||||||
|       "pycharm-professional" |  | ||||||
|       "rider" |  | ||||||
|       "ruby-mine" |  | ||||||
|       "webstorm" |  | ||||||
|     ]; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   generateCommon = lib.makeOverridable ( |  | ||||||
|     { common ? ./manual-common-packages.nix |  | ||||||
|     }: |  | ||||||
|     let |  | ||||||
|  |  | ||||||
|       imported = import common { |  | ||||||
|         inherit (self) callPackage; |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       super = imported; |  | ||||||
|  |  | ||||||
|       overrides = { }; |  | ||||||
|  |  | ||||||
|       jetbrainsPlugins = super // overrides; |  | ||||||
|  |  | ||||||
|     in |  | ||||||
|     jetbrainsPlugins // { inherit commonBuild; } |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
| in |  | ||||||
| generateCommon { } |  | ||||||
|  |  | ||||||
							
								
								
									
										95026
									
								
								pkgs/applications/editors/jetbrains/idea-generated.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95026
									
								
								pkgs/applications/editors/jetbrains/idea-generated.nix
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -9,25 +9,21 @@ let | |||||||
|     jetbrainsPlatforms = [ "idea-community" "idea-ultimate" ]; |     jetbrainsPlatforms = [ "idea-community" "idea-ultimate" ]; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   generateIdea = lib.makeOverridable ( |   generateIdea = lib.makeOverridable ({ | ||||||
|     { idea ? ./manual-idea-packages.nix |     idea ? ./idea-generated.nix | ||||||
|     }: |   }: let | ||||||
|     let |  | ||||||
|  |  | ||||||
|       imported = import idea { |     imported = import idea { | ||||||
|         inherit (self) callPackage; |       inherit (self) callPackage; | ||||||
|       }; |     }; | ||||||
|  |  | ||||||
|       super = imported; |     super = imported; | ||||||
|  |  | ||||||
|       overrides = { }; |     overrides = { }; | ||||||
|  |  | ||||||
|       ideaPlugins = super // overrides; |     ideaPlugins = super // overrides; | ||||||
|  |  | ||||||
|     in |   in ideaPlugins // { inherit ideaBuild; }); | ||||||
|     ideaPlugins // { inherit ideaBuild; } |  | ||||||
|   ); |  | ||||||
|  |  | ||||||
| in | in generateIdea { } | ||||||
| generateIdea { } |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,33 +0,0 @@ | |||||||
| { callPackage }: |  | ||||||
| { |  | ||||||
|   ideavim = callPackage |  | ||||||
|     ({ commonBuild }: commonBuild { |  | ||||||
|       pname = "IdeaVim"; |  | ||||||
|       version = "0.57"; |  | ||||||
|       pluginId = 164; |  | ||||||
|       versionId = 85009; |  | ||||||
|       sha256 = "1rwfwj0b0nwi7jxhzxk1r0xc190nf4i3b59i0zknpmgb4yc5clzw"; |  | ||||||
|     }) |  | ||||||
|     { }; |  | ||||||
|  |  | ||||||
|   checkstyle-idea = callPackage |  | ||||||
|     ({ commonBuild }: commonBuild { |  | ||||||
|       pname = "CheckStyle-IDEA"; |  | ||||||
|       version = "5.42.0"; |  | ||||||
|       pluginId = 1065; |  | ||||||
|       versionId = 95757; |  | ||||||
|       sha256 = "0sji3649n5zz84dlidqaklipq6vaiafxsvg0gzy3j59mvkz6dk14"; |  | ||||||
|     }) |  | ||||||
|     { }; |  | ||||||
|  |  | ||||||
|   google-java-format = callPackage |  | ||||||
|     ({ commonBuild }: commonBuild rec { |  | ||||||
|       pname = "google-java-format"; |  | ||||||
|       version = "1.7.0.4"; |  | ||||||
|       pluginId = 8527; |  | ||||||
|       versionId = 83164; |  | ||||||
|       sha256 = "1pmnn1ksiv44kdga53gi3psrm2sva4bqrxizagbr0if2n0rrvgii"; |  | ||||||
|       filename = "${pname}.zip"; |  | ||||||
|     }) |  | ||||||
|     { }; |  | ||||||
| } |  | ||||||
| @@ -1,12 +0,0 @@ | |||||||
| { callPackage }: |  | ||||||
| { |  | ||||||
|   spring-assistant = callPackage |  | ||||||
|     ({ ideaBuild }: ideaBuild { |  | ||||||
|       pname = "intellij-spring-assistant"; |  | ||||||
|       version = "0.12.0"; |  | ||||||
|       pluginId = 10229; |  | ||||||
|       versionId = 44968; |  | ||||||
|       sha256 = "13cglywzhb4j0qj0bs2jwaz2k8pxrxalv35wgkmgkxr635bxmwsj"; |  | ||||||
|     }) |  | ||||||
|     { }; |  | ||||||
| } |  | ||||||
							
								
								
									
										12
									
								
								pkgs/applications/editors/jetbrains/update-jetbrains
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										12
									
								
								pkgs/applications/editors/jetbrains/update-jetbrains
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | #!/usr/bin/env nix-shell | ||||||
|  | #!nix-shell --show-trace ./updater.nix -i bash | ||||||
|  |  | ||||||
|  | set -e | ||||||
|  |  | ||||||
|  | for app in $APPS; do | ||||||
|  |   ./updater-jetbrains $app -o ${app%-[0-9.]*}-generated.nix | ||||||
|  | done | ||||||
|  |  | ||||||
|  | # Local Variables: | ||||||
|  | # mode: sh | ||||||
|  | # End: | ||||||
| @@ -7,6 +7,7 @@ import re | |||||||
| import requests | import requests | ||||||
| import subprocess as sp | import subprocess as sp | ||||||
| import sys | import sys | ||||||
|  | import unicodedata | ||||||
| import urllib | import urllib | ||||||
| 
 | 
 | ||||||
| from lxml import etree | from lxml import etree | ||||||
| @@ -27,10 +28,15 @@ PRODUCT_CODE = { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | PACKAGE_RE = re.compile("[^0-9A-Za-z._-]") | ||||||
|  | HTML_RE = re.compile("<[^>]+/?>") | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def to_slug(name): | def to_slug(name): | ||||||
|     slug = name.replace(" ", "-").lstrip(".") |     slug = name.replace(" ", "-").lstrip(".") | ||||||
|     for char in ",/;'\\<>:\"|!@#$%^&*()": |     for char in ",/;'\\<>:\"|!@#$%^&*()": | ||||||
|         slug = slug.replace(char, "") |         slug = slug.replace(char, "") | ||||||
|  |     slug = unicodedata.normalize("NFD", slug).encode("ascii", "ignore").decode("utf-8") | ||||||
|     return slug |     return slug | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @@ -59,18 +65,15 @@ class Build: | |||||||
|         return self.code + "-" + self.version |         return self.code + "-" + self.version | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| PACKAGE_RE = re.compile("[^0-9A-Za-z._-]") |  | ||||||
| HTML_RE = re.compile("<[^>]+/?>") |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| class Plugin: | class Plugin: | ||||||
|     def __init__(self, data, category=None): |     def __init__(self, data, build, category=None): | ||||||
|  |         self.build = build | ||||||
|         self.category = category |         self.category = category | ||||||
|         self.name = data.find("name").text |         self.name = data.find("name").text | ||||||
|         self.id = data.find("id").text |         self.xml_id = data.find("id").text | ||||||
|         self._description = data.find("description").text |         self._description = data.find("description").text | ||||||
|         self.url = data.get("url") or data.find("vendor").get("url") |         self.url = data.get("url") or data.find("vendor").get("url") | ||||||
|         self.version = data.find("version").text |         self.version = data.find("version").text.replace(" ", "-") | ||||||
|         self.slug = to_slug(self.name) |         self.slug = to_slug(self.name) | ||||||
|         self.orig_slug = self.slug |         self.orig_slug = self.slug | ||||||
| 
 | 
 | ||||||
| @@ -84,7 +87,7 @@ class Plugin: | |||||||
|     def description(self): |     def description(self): | ||||||
|         return re.sub(HTML_RE, "", self._description or "").strip() |         return re.sub(HTML_RE, "", self._description or "").strip() | ||||||
| 
 | 
 | ||||||
|     def download_url(self, build, deref=True): |     def get_download_url(self, deref=True): | ||||||
|         """ |         """ | ||||||
|         Provides the ZIP download URL for this plugin. |         Provides the ZIP download URL for this plugin. | ||||||
| 
 | 
 | ||||||
| @@ -94,18 +97,52 @@ class Plugin: | |||||||
|         (which it is by default). However, this comes at the cost of requiring |         (which it is by default). However, this comes at the cost of requiring | ||||||
|         an HTTP request. |         an HTTP request. | ||||||
|         """ |         """ | ||||||
|         id = urllib.parse.quote(self.id) |         id = urllib.parse.quote(self.xml_id) | ||||||
|         url = f"https://plugins.jetbrains.com/pluginManager?action=download&id={id}&build={build}" |         url = f"https://plugins.jetbrains.com/pluginManager?action=download&id={id}&build={self.build}" | ||||||
|         if deref: |         if deref: | ||||||
|             res = requests.get(url, allow_redirects=not deref) |             res = requests.get(url, allow_redirects=not deref) | ||||||
|             url = "https://plugins.jetbrains.com" + re.sub( |             url = "https://plugins.jetbrains.com" + re.sub( | ||||||
|                 "\?.*$", "", res.headers["location"] |                 "\?.*$", "", res.headers["location"] | ||||||
|             ) |             ) | ||||||
|  |             self.jetbrains_url = url | ||||||
|             if url.endswith("external"): |             if url.endswith("external"): | ||||||
|                 res = requests.get(url, allow_redirects=not deref) |                 res = requests.get(url, allow_redirects=not deref) | ||||||
|                 url = res.headers["location"] |                 url = res.headers["location"] | ||||||
|         return url |         return url | ||||||
| 
 | 
 | ||||||
|  |     def fetch_external(self, update_only=False): | ||||||
|  |         """ | ||||||
|  |         Performs network calls to update this plugin with information that | ||||||
|  |         cannot be performed from the public XML API. | ||||||
|  | 
 | ||||||
|  |         Additional attributes provided after this method: | ||||||
|  | 
 | ||||||
|  |           download_url : the plugin download location | ||||||
|  |           sha          : the SHA256 of the download source | ||||||
|  | 
 | ||||||
|  |         If update_only is true, a full update is performed, also providing: | ||||||
|  | 
 | ||||||
|  |           id          : the plugin integer ID | ||||||
|  |           license_url : the plugin license URL | ||||||
|  |           license     : the Nixpkgs license attribute | ||||||
|  |         """ | ||||||
|  |         self.download_url = self.get_download_url(deref=True) | ||||||
|  |         self.sha = prefetch(self, self.build, self.download_url) | ||||||
|  | 
 | ||||||
|  |         if update_only: | ||||||
|  |             return | ||||||
|  | 
 | ||||||
|  |         self.id = self.jetbrains_url.split("/")[4] | ||||||
|  |         res = requests.get( | ||||||
|  |             f"https://plugins.jetbrains.com/api/plugins/{self.id}" | ||||||
|  |         ).json() | ||||||
|  |         try: | ||||||
|  |             self.url = self.url or res["urls"]["sourceCodeUrl"] | ||||||
|  |         except KeyError: | ||||||
|  |             pass | ||||||
|  |         self.license_url = res["urls"]["licenseUrl"] | ||||||
|  |         self.license = translate_license(self.license_url, fallback=self.url) | ||||||
|  | 
 | ||||||
|     def packagename(self): |     def packagename(self): | ||||||
|         slug = re.sub(PACKAGE_RE, "", self.slug.lower()).replace(".", "-") |         slug = re.sub(PACKAGE_RE, "", self.slug.lower()).replace(".", "-") | ||||||
|         if slug[0] in "1234567890": |         if slug[0] in "1234567890": | ||||||
| @@ -128,16 +165,16 @@ def list_plugins(build): | |||||||
|     https://plugins.jetbrains.com/docs/marketplace/plugins-list.html |     https://plugins.jetbrains.com/docs/marketplace/plugins-list.html | ||||||
|     """ |     """ | ||||||
|     resp = requests.get(f"https://plugins.jetbrains.com/plugins/list/?build={build}") |     resp = requests.get(f"https://plugins.jetbrains.com/plugins/list/?build={build}") | ||||||
|     return parse_repository(resp.content) |     return parse_repository(resp.content, build) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def parse_repository(content): | def parse_repository(content, build): | ||||||
|     tree = etree.XML(content) |     tree = etree.XML(content) | ||||||
|     plugins = [] |     plugins = [] | ||||||
|     for cat in tree.findall("category"): |     for cat in tree.findall("category"): | ||||||
|         cat_name = cat.get("name") |         cat_name = cat.get("name") | ||||||
|         for plugin in cat.findall("idea-plugin"): |         for plugin in cat.findall("idea-plugin"): | ||||||
|             plugins.append(Plugin(plugin, cat_name)) |             plugins.append(Plugin(plugin, build, cat_name)) | ||||||
|     return plugins |     return plugins | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @@ -155,28 +192,101 @@ def deduplicate(plugins): | |||||||
| 
 | 
 | ||||||
| def prefetch(plugin, build, url=None): | def prefetch(plugin, build, url=None): | ||||||
|     if not url: |     if not url: | ||||||
|         url = plugin.download_url(build) |         url = plugin.download_url or plugin.get_download_url() | ||||||
|     res = sp.run( |     res = sp.run( | ||||||
|         ["nix-prefetch-url", "--name", plugin.filename(), url], capture_output=True, |         ["nix-prefetch-url", "--name", plugin.filename(), url], capture_output=True, | ||||||
|     ) |     ) | ||||||
|     if not res.stdout: |     if not res.stdout: | ||||||
|         raise IOError(f"nix-prefetch-url {plugin} failed: {res.stderr.decode('utf-8')}") |         raise IOError( | ||||||
|     return res.stdout.decode("utf-8").strip() |             f"nix-prefetch-url {plugin} failed: {res.stderr.decode('unicode-escape')}" | ||||||
|  |         ) | ||||||
|  |     return res.stdout.decode("unicode-escape").strip() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def write_packages(outfile, plugins, build): | def custom_license(short, full, url, free=False): | ||||||
|     builder = build.builder() |     return f"""{{ | ||||||
|  |         shortName = "{short}"; | ||||||
|  |         fullName = "{full}"; | ||||||
|  |         url = "{url}"; | ||||||
|  |         free = {"true" if free else "false"}; | ||||||
|  |       }}""" | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def arr(url): | ||||||
|  |     return custom_license("allrightsreserved", "All Rights Reserved", url) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def translate_license(url, fallback=""): | ||||||
|  |     license = url.lower() | ||||||
|  |     if license == "": | ||||||
|  |         print(f"no license for {fallback}", file=sys.stderr) | ||||||
|  |         return arr(fallback) | ||||||
|  |     # Common (license) hosts | ||||||
|  |     elif "github.com" in license or "raw.githubusercontent.com" in license: | ||||||
|  |         try: | ||||||
|  |             owner, repo = url.split("/")[3:5] | ||||||
|  |         except ValueError: | ||||||
|  |             print(f"no license metadata for {url}", file=sys.stderr) | ||||||
|  |             return arr(url) | ||||||
|  |         res = requests.get( | ||||||
|  |             f"https://api.github.com/repos/{owner}/{repo}", | ||||||
|  |             headers={"Accept": "application/vnd.github.v3+json"}, | ||||||
|  |         ).json() | ||||||
|  |         try: | ||||||
|  |             return translate_license(res["license"]["key"]) | ||||||
|  |         except (KeyError, TypeError): | ||||||
|  |             print(f"no license metadata for {url}", file=sys.stderr) | ||||||
|  |             return arr(url) | ||||||
|  |     elif "opensource.org" in license: | ||||||
|  |         os_license = license.rstrip("/").split("/")[-1] | ||||||
|  |         if os_license == "alphabetical": | ||||||
|  |             # Doesn't actually have a license, it's the listing page | ||||||
|  |             return arr(fallback) | ||||||
|  |         return translate_license(os_license) | ||||||
|  |     # Actual translations now | ||||||
|  |     elif "apache.org/licenses/license-2.0" in license or "apache-2.0" in license: | ||||||
|  |         return "lib.licenses.asl20" | ||||||
|  |     elif "artistic-2" in license: | ||||||
|  |         return "lib.licenses.artistic2" | ||||||
|  |     elif "bsd-2-clause" in license: | ||||||
|  |         return "lib.licenses.bsd2" | ||||||
|  |     elif "bsd-3-clause" in license: | ||||||
|  |         return "lib.licenses.bsd3" | ||||||
|  |     elif "eclipse.org/legal/epl-2.0" in license: | ||||||
|  |         return "lib.licenses.epl20" | ||||||
|  |     elif "gpl-3.0" in license: | ||||||
|  |         return "lib.licenses.gpl3Only" | ||||||
|  |     elif "mit" in license: | ||||||
|  |         return "lib.licenses.mit" | ||||||
|  |     elif "osd" in license: | ||||||
|  |         return "lib.licenses.free" | ||||||
|  |     elif "other" == license: | ||||||
|  |         return arr(fallback) | ||||||
|  |     # Custom known licenses | ||||||
|  |     elif "plugins.jetbrains.com/legal/terms-of-use" in license: | ||||||
|  |         return custom_license( | ||||||
|  |             "jetbrains", "Jetbrains Plugin Marketplace Agreement", license | ||||||
|  |         ) | ||||||
|  |     # Fallback | ||||||
|  |     else: | ||||||
|  |         print(f"unrecognised license {license}", file=sys.stderr) | ||||||
|  |         return arr(license) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | def write_packages(outfile, plugins): | ||||||
|  |     builder = plugins[0].build.builder() or "" | ||||||
|     outfile.write("{callPackage}:\n{") |     outfile.write("{callPackage}:\n{") | ||||||
| 
 | 
 | ||||||
|     for plugin in plugins: |     for i, plugin in enumerate(plugins): | ||||||
|         src_url = plugin.download_url(build, deref=True) |         print(f"{i:04} {plugin.packagename()}") | ||||||
|         src_ext = os.path.splitext(src_url)[-1] |  | ||||||
| 
 |  | ||||||
|         try: |         try: | ||||||
|             sha = prefetch(plugin, build, src_url) |             plugin.fetch_external() | ||||||
|         except IOError as e: |         except IOError as e: | ||||||
|             print(e, file=sys.stderr) |             print(e, file=sys.stderr) | ||||||
|             continue |             continue | ||||||
|  |         src_url = plugin.download_url | ||||||
|  |         src_ext = os.path.splitext(src_url)[-1] | ||||||
|  |         sha = plugin.sha | ||||||
| 
 | 
 | ||||||
|         build_inputs = [] |         build_inputs = [] | ||||||
|         if src_ext == ".zip": |         if src_ext == ".zip": | ||||||
| @@ -186,7 +296,7 @@ def write_packages(outfile, plugins, build): | |||||||
|         # internal and external plugins; need to find some way to resolve them |         # internal and external plugins; need to find some way to resolve them | ||||||
|         requires = [] |         requires = [] | ||||||
|         # TODO: Licenses are actually on the website, but aren't provided in the API |         # TODO: Licenses are actually on the website, but aren't provided in the API | ||||||
|         license = "lib.licenses.free" |         license = plugin.license | ||||||
| 
 | 
 | ||||||
|         call_args = [str(builder), "fetchurl", "lib"] |         call_args = [str(builder), "fetchurl", "lib"] | ||||||
|         for binput in build_inputs: |         for binput in build_inputs: | ||||||
| @@ -197,7 +307,7 @@ def write_packages(outfile, plugins, build): | |||||||
|   {plugin.packagename()} = callPackage ({{ {", ".join(sorted(call_args))} }}: {builder} {{ |   {plugin.packagename()} = callPackage ({{ {", ".join(sorted(call_args))} }}: {builder} {{ | ||||||
|     pname = "{plugin.slug}"; |     pname = "{plugin.slug}"; | ||||||
|     plugname = "{plugin.name}"; |     plugname = "{plugin.name}"; | ||||||
|     plugid = "{plugin.id}"; |     plugid = "{plugin.xml_id}"; | ||||||
|     version = "{plugin.version}"; |     version = "{plugin.version}"; | ||||||
|     src = fetchurl {{ |     src = fetchurl {{ | ||||||
|       url = "{src_url}"; |       url = "{src_url}"; | ||||||
| @@ -227,6 +337,7 @@ def main(): | |||||||
|     parser.add_argument( |     parser.add_argument( | ||||||
|         "-o", "--out", type=str, help="File to write plugins to", |         "-o", "--out", type=str, help="File to write plugins to", | ||||||
|     ) |     ) | ||||||
|  |     parser.add_argument("-O", "--offset", type=int, help="Offset number of packages") | ||||||
|     parser.add_argument( |     parser.add_argument( | ||||||
|         "package", |         "package", | ||||||
|         metavar="PACKAGE", |         metavar="PACKAGE", | ||||||
| @@ -241,15 +352,17 @@ def main(): | |||||||
|     plugins.sort(key=lambda p: p.slug) |     plugins.sort(key=lambda p: p.slug) | ||||||
|     deduplicate(plugins) |     deduplicate(plugins) | ||||||
| 
 | 
 | ||||||
|  |     if args.offset: | ||||||
|  |         plugins = plugins[args.offset :] | ||||||
|     if args.number: |     if args.number: | ||||||
|         plugins = plugins[: args.number] |         plugins = plugins[: args.number] | ||||||
| 
 | 
 | ||||||
|     print(f"Generating packages for {len(plugins)} plugins", file=sys.stderr) |     print(f"Generating packages for {len(plugins)} plugins", file=sys.stderr) | ||||||
|     if not args.out: |     if not args.out: | ||||||
|         write_packages(sys.stdout, plugins, build) |         write_packages(sys.stdout, plugins) | ||||||
|     else: |     else: | ||||||
|         with open(args.out, "w") as f: |         with open(args.out, "w") as f: | ||||||
|             write_packages(f, plugins, build) |             write_packages(f, plugins) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| main() | main() | ||||||
							
								
								
									
										26
									
								
								pkgs/applications/editors/jetbrains/updater.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								pkgs/applications/editors/jetbrains/updater.nix
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,26 @@ | |||||||
|  | { pkgs ? import <nixpkgs> { } }: | ||||||
|  | let | ||||||
|  |   inherit (pkgs.stdenv) lib; | ||||||
|  | in | ||||||
|  | pkgs.mkShell { | ||||||
|  |   buildInputs = [ | ||||||
|  |     pkgs.bash | ||||||
|  |   ]; | ||||||
|  |  | ||||||
|  |   APPS = lib.mapAttrsToList | ||||||
|  |     (k: v: v.name) | ||||||
|  |     { | ||||||
|  |       inherit (pkgs.jetbrains) | ||||||
|  |         clion | ||||||
|  |         datagrip | ||||||
|  |         goland | ||||||
|  |         idea-community | ||||||
|  |         idea-ultimate | ||||||
|  |         phpstorm | ||||||
|  |         pycharm-community | ||||||
|  |         pycharm-professional | ||||||
|  |         rider | ||||||
|  |         ruby-mine | ||||||
|  |         webstorm; | ||||||
|  |     }; | ||||||
|  | } | ||||||
| @@ -1,5 +1,4 @@ | |||||||
| { lib | { lib, makeWrapper, runCommand }: self: | ||||||
| }: self: |  | ||||||
|  |  | ||||||
| with lib; | with lib; | ||||||
|  |  | ||||||
| @@ -20,12 +19,31 @@ in | |||||||
|  |  | ||||||
| assert assertMsg (length badPlugins == 0) errorMsg; | assert assertMsg (length badPlugins == 0) errorMsg; | ||||||
|  |  | ||||||
| appendToName "with-plugins" (package.overrideAttrs (oldAttrs: { | runCommand | ||||||
|   passthru = { inherit plugins; }; |   (appendToName "with-plugins" package).name | ||||||
|   # TODO: Purely aesthetics, but link the plugin to its name instead of hash-name-version | { | ||||||
|   installPhase = oldAttrs.installPhase + '' |   nativeBuildInputs = [ package makeWrapper ]; | ||||||
|     for plugin in $plugins; do |   inherit package plugins; | ||||||
|       ln -s "$plugin" "$out/$name/plugins/$(basename $plugin)" |   packageName = package.name; | ||||||
|     done |  | ||||||
|   ''; |   preferLocalBuild = true; | ||||||
| })) |   allowSubstitutes = false; | ||||||
|  |  | ||||||
|  | } '' | ||||||
|  |   mkdir -p $out/$packageName/plugins | ||||||
|  |   for dir in $package/*; do | ||||||
|  |     cp -r $dir $out/ | ||||||
|  |   done | ||||||
|  |  | ||||||
|  |   # Install plugins | ||||||
|  |   for plugin in $plugins; do | ||||||
|  |     local pluginName=$(basename $plugin) | ||||||
|  |     pluginName=''${pluginName#*-} | ||||||
|  |     pluginName=''${pluginName%-[0-9.]*} | ||||||
|  |     ln -s $plugin $out/$packageName/plugins/$pluginName | ||||||
|  |   done | ||||||
|  |  | ||||||
|  |   # Fix up wrapper | ||||||
|  |   substituteInPlace $out/bin/* \ | ||||||
|  |     --replace "$package" "$out" | ||||||
|  | '' | ||||||
|   | |||||||
| @@ -2,10 +2,12 @@ diff --git a/include/components/types.hpp b/include/components/types.hpp | |||||||
| index 8125d4b..c435f4a 100644 | index 8125d4b..c435f4a 100644 | ||||||
| --- a/include/components/types.hpp | --- a/include/components/types.hpp | ||||||
| +++ b/include/components/types.hpp | +++ b/include/components/types.hpp | ||||||
| @@ -43,5 +43,6 @@ enum class controltag { | @@ -57,7 +57,7 @@ enum class controltag { | ||||||
|    DOUBLE_MIDDLE, |    R,  // Reset all open tags (B, F, T, o, u). Used at module edges | ||||||
|    DOUBLE_RIGHT, |  | ||||||
| +  EXTRA, |  | ||||||
|    // Terminator value, do not use |  | ||||||
|    BTN_COUNT, |  | ||||||
|  }; |  }; | ||||||
|  |  | ||||||
|  | -enum class mousebtn { NONE = 0, LEFT, MIDDLE, RIGHT, SCROLL_UP, SCROLL_DOWN, DOUBLE_LEFT, DOUBLE_MIDDLE, DOUBLE_RIGHT }; | ||||||
|  | +enum class mousebtn { NONE = 0, LEFT, MIDDLE, RIGHT, SCROLL_UP, SCROLL_DOWN, DOUBLE_LEFT, DOUBLE_MIDDLE, DOUBLE_RIGHT, EXTRA }; | ||||||
|  |  | ||||||
|  |  enum class strut { | ||||||
|  |    LEFT = 0, | ||||||
|   | |||||||
| @@ -1,48 +0,0 @@ | |||||||
| { lib |  | ||||||
| , fetchFromGitHub |  | ||||||
| , buildGoModule |  | ||||||
| , pkg-config |  | ||||||
| , libsecret |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| { pname |  | ||||||
| , tags |  | ||||||
| , ... |  | ||||||
| }@args: |  | ||||||
|  |  | ||||||
| buildGoModule (lib.recursiveUpdate args rec { |  | ||||||
|   inherit pname; |  | ||||||
|   version = "1.8.10"; |  | ||||||
|  |  | ||||||
|   src = fetchFromGitHub { |  | ||||||
|     owner = "ProtonMail"; |  | ||||||
|     repo = "proton-bridge"; |  | ||||||
|     rev = "br-${version}"; |  | ||||||
|     sha256 = "1na8min9cmn82lpad58abw6837k303fr09l6cvzswaxs73f231ig"; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   vendorSha256 = "1219xa1347877bfhnid15y6w9s4hf1czbrmll2iha4gpsmg066bb"; |  | ||||||
|  |  | ||||||
|   nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ |  | ||||||
|     pkg-config |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   buildInputs = (args.buildInputs or [ ]) ++ [ |  | ||||||
|     libsecret |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   inherit tags; |  | ||||||
|  |  | ||||||
|   ldflags = [ |  | ||||||
|     "-X github.com/ProtonMail/proton-bridge/pkg/constants.Version=${version}" |  | ||||||
|     "-X github.com/ProtonMail/proton-bridge/pkg/constants.Revision=${version}" |  | ||||||
|     "-X github.com/ProtonMail/proton-bridge/pkg/constants.BuildDate=unknown" |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   meta = with lib; { |  | ||||||
|     description = "Integrate ProtonMail paid account with any program that supports IMAP and SMTP"; |  | ||||||
|     homepage = "https://protonmail.com"; |  | ||||||
|     license = licenses.gpl3; |  | ||||||
|     plaforms = platforms.x86_64; |  | ||||||
|   }; |  | ||||||
| }) |  | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| , buildGoModule | , buildGoModule | ||||||
|  |  | ||||||
| @@ -7,12 +7,62 @@ | |||||||
| , libsecret | , libsecret | ||||||
| , pkg-config | , pkg-config | ||||||
| , qtbase | , qtbase | ||||||
|  | , qtdoc | ||||||
| }: | }: | ||||||
|  |  | ||||||
| let | let | ||||||
|   builder = import ./common.nix { |  | ||||||
|     inherit lib fetchFromGitHub buildGoModule libsecret pkg-config; |   builder = | ||||||
|   }; |     { pname | ||||||
|  |     , tags | ||||||
|  |     , ... | ||||||
|  |     }@args: | ||||||
|  |  | ||||||
|  |     buildGoModule (stdenv.lib.recursiveUpdate args rec { | ||||||
|  |       inherit pname; | ||||||
|  |       version = "1.5.6"; | ||||||
|  |  | ||||||
|  |       src = fetchFromGitHub { | ||||||
|  |         owner = "ProtonMail"; | ||||||
|  |         repo = "proton-bridge"; | ||||||
|  |         rev = "br-${version}"; | ||||||
|  |         sha256 = "1na8min9cmn82lpad58abw6837k303fr09l6cvzswaxs73f231ig"; | ||||||
|  |       }; | ||||||
|  |  | ||||||
|  |       vendorSha256 = "1219xa1347877bfhnid15y6w9s4hf1czbrmll2iha4gpsmg066bb"; | ||||||
|  |  | ||||||
|  |       nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ | ||||||
|  |         pkg-config | ||||||
|  |       ]; | ||||||
|  |  | ||||||
|  |       buildInputs = (args.buildInputs or [ ]) ++ [ | ||||||
|  |         libsecret | ||||||
|  |       ]; | ||||||
|  |  | ||||||
|  |       buildFlagsArray = | ||||||
|  |         let | ||||||
|  |           t = "github.com/ProtonMail/proton-bridge/pkg/constants"; | ||||||
|  |         in | ||||||
|  |         [ | ||||||
|  |           "-tags=${tags}" | ||||||
|  |           '' | ||||||
|  |             -ldflags= | ||||||
|  |               -X ${t}.Version=${version} | ||||||
|  |               -X ${t}.Revision=unknown | ||||||
|  |               -X ${t}.BuildDate=unknown | ||||||
|  |           '' | ||||||
|  |         ]; | ||||||
|  |  | ||||||
|  |       meta = with stdenv.lib; { | ||||||
|  |         description = "Integrate ProtonMail paid account with any program that supports IMAP and SMTP"; | ||||||
|  |         homepage = "https://protonmail.com"; | ||||||
|  |         license = licenses.gpl3; | ||||||
|  |         plaforms = platforms.x86_64; | ||||||
|  |       }; | ||||||
|  |     }); | ||||||
|  |  | ||||||
| in | in | ||||||
|  |  | ||||||
| { | { | ||||||
|   protonmail-bridge = builder (import ./app.nix { inherit qtbase go goModules; }); |   protonmail-bridge = builder (import ./app.nix { inherit qtbase go goModules; }); | ||||||
|   protonmail-bridge-headless = builder (import ./headless.nix { }); |   protonmail-bridge-headless = builder (import ./headless.nix { }); | ||||||
|   | |||||||
| @@ -1,17 +1,30 @@ | |||||||
| {}: | {}: | ||||||
|  |  | ||||||
| { | rec { | ||||||
|   pname = "protonmail-bridge-headless"; |   pname = "protonmail-bridge-headless"; | ||||||
|  |  | ||||||
|   tags = [ "pmapi_prod" "nogui" ]; |   tags = "pmapi_prod nogui"; | ||||||
|  |  | ||||||
|   # REVIEW: Some issue with IMAP tests that probably fail due to network |   # FIXME: There's something fucky going on in the buildFlagsArray | ||||||
|   # sandboxing. |   # substitution. I shouldn't need to do this. | ||||||
|   doCheck = false; |   buildPhase = | ||||||
|  |     let | ||||||
|  |       t = "github.com/ProtonMail/proton-bridge/pkg/constants"; | ||||||
|  |     in | ||||||
|  |     '' | ||||||
|  |       runHook preBuild | ||||||
|  |  | ||||||
|  |       go install \ | ||||||
|  |         -tags="${tags}" \ | ||||||
|  |         -ldflags="-X ${t}.Version=1.3.2 -X ${t}.Revision=unknown -X ${t}.BuildDate=unknown" \ | ||||||
|  |         cmd/Desktop-Bridge/main.go | ||||||
|  |       mv $GOPATH/bin/main $GOPATH/bin/Desktop-Bridge | ||||||
|  |          | ||||||
|  |       runHook postBuild | ||||||
|  |     ''; | ||||||
|  |  | ||||||
|   # Fix up name. |   # Fix up name. | ||||||
|   postInstall = '' |   postInstall = '' | ||||||
|     mv $out/bin/Desktop-Bridge $out/bin/protonmail-bridge |     mv $out/bin/Desktop-Bridge $out/bin/protonmail-bridge | ||||||
|     mv $out/bin/Import-Export $out/bin/protonmail-import-export |  | ||||||
|   ''; |   ''; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,12 +1,15 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitLab | , fetchFromGitLab | ||||||
|  | , fetchzip | ||||||
|  | 
 | ||||||
| , cereal | , cereal | ||||||
| , cmake | , cmake | ||||||
|  | , git | ||||||
| , libGL | , libGL | ||||||
| , libX11 | , libX11 | ||||||
| , libinput | , libinput | ||||||
| , libxkbcommon | , libxkbcommon | ||||||
|  | , mesa | ||||||
| , meson | , meson | ||||||
| , ninja | , ninja | ||||||
| , pixman | , pixman | ||||||
| @@ -15,6 +18,7 @@ | |||||||
| , wayland | , wayland | ||||||
| , wayland-protocols | , wayland-protocols | ||||||
| , wlroots | , wlroots | ||||||
|  | , xwayland | ||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
| stdenv.mkDerivation rec { | stdenv.mkDerivation rec { | ||||||
| @@ -58,11 +62,10 @@ stdenv.mkDerivation rec { | |||||||
| 
 | 
 | ||||||
|   passthru.providedSessions = [ "cardboard" ]; |   passthru.providedSessions = [ "cardboard" ]; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = { | ||||||
|     description = "Scrollable tiling Wayland compositor designed with laptops in mind"; |     description = "Scrollable tiling Wayland compositor designed with laptops in mind"; | ||||||
|     homepage = "https://gitlab.com/cardboardwm/cardboard"; |     homepage = "https://gitlab.com/cardboardwm/cardboard"; | ||||||
|     license = licenses.gpl3; |     license = stdenv.lib.licenses.gpl3; | ||||||
|     platforms = wlroots.meta.platforms; |     platforms = wlroots.meta.platforms; | ||||||
|     broken = true; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| @@ -4,30 +4,38 @@ | |||||||
| , jetbrainsPlatforms | , jetbrainsPlatforms | ||||||
| }: | }: | ||||||
|  |  | ||||||
| { pluginId | { plugid | ||||||
| , pname | , pname | ||||||
| , version | , version | ||||||
| , versionId | , ... | ||||||
| , sha256 | }@args: | ||||||
| , filename ? "${pname}-${version}.zip" |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| stdenv.mkDerivation { | let | ||||||
|   inherit pname version; |  | ||||||
|  |  | ||||||
|   src = fetchzip { |   defaultMeta = { | ||||||
|     inherit sha256; |     broken = false; | ||||||
|     url = "https://plugins.jetbrains.com/files/${toString pluginId}/${toString versionId}/${filename}"; |   } // lib.optionalAttrs ((args.src.meta.homepage or "") != "") { | ||||||
|  |     homepage = args.src.meta.homepage; | ||||||
|  |   } // lib.optionalAttrs ((args.src.meta.description or "") != "") { | ||||||
|  |     description = args.src.meta.description; | ||||||
|  |   } // lib.optionalAttrs ((args.src.meta.license or {}) != {}) { | ||||||
|  |     license = args.src.meta.license; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  | in | ||||||
|  |  | ||||||
|  | stdenv.mkDerivation (args // { | ||||||
|   passthru = { inherit jetbrainsPlatforms; }; |   passthru = { inherit jetbrainsPlatforms; }; | ||||||
|  |  | ||||||
|  |   dontUnpack = lib.any (lib.hasSuffix ".jar") args.src.urls; | ||||||
|  |  | ||||||
|   installPhase = '' |   installPhase = '' | ||||||
|     mkdir $out |     mkdir $out | ||||||
|     cp -r * $out/ |     cp -r * $out/ | ||||||
|   ''; |   ''; | ||||||
|  |  | ||||||
|   meta = { |   meta = { | ||||||
|     homepage = "https://plugins.jetbrains.com/plugin/${pluginId}-${lib.toLower pname}"; |     inherit (args.meta) license description; | ||||||
|  |     homepage = if (args.meta.homepage == "") then null else args.meta.homepage; | ||||||
|   }; |   }; | ||||||
| } | }) | ||||||
|   | |||||||
| @@ -1,55 +0,0 @@ | |||||||
| { stdenv |  | ||||||
| , lib |  | ||||||
| , fetchFromGitHub |  | ||||||
|  |  | ||||||
| , alacritty |  | ||||||
|  |  | ||||||
| , fontconfig |  | ||||||
| , freetype |  | ||||||
| , libglvnd |  | ||||||
| , libxcb |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| alacritty.overrideAttrs (oldAttrs: rec { |  | ||||||
|   pname = "${oldAttrs.pname}-ligatures"; |  | ||||||
|   version = "0.7.2.20210209.g3ed0430"; |  | ||||||
|  |  | ||||||
|   src = fetchFromGitHub { |  | ||||||
|     owner = "zenixls2"; |  | ||||||
|     repo = "alacritty"; |  | ||||||
|     fetchSubmodules = true; |  | ||||||
|     rev = "3ed043046fc74f288d4c8fa7e4463dc201213500"; |  | ||||||
|     sha256 = "1dGk4ORzMSUQhuKSt5Yo7rOJCJ5/folwPX2tLiu0suA="; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   cargoDeps = oldAttrs.cargoDeps.overrideAttrs (lib.const { |  | ||||||
|     name = "${pname}-${version}-vendor.tar.gz"; |  | ||||||
|     inherit src; |  | ||||||
|     outputSha256 = "pONu6caJmEKnbr7j+o9AyrYNpS4Q8OEjNZOhGTalncc="; |  | ||||||
|   }); |  | ||||||
|  |  | ||||||
|   ligatureInputs = [ |  | ||||||
|     fontconfig |  | ||||||
|     freetype |  | ||||||
|     libglvnd |  | ||||||
|     stdenv.cc.cc.lib |  | ||||||
|     libxcb |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   preferLocalBuild = true; |  | ||||||
|  |  | ||||||
|   buildInputs = (oldAttrs.buildInputs or [ ]) ++ ligatureInputs; |  | ||||||
|  |  | ||||||
|   # HACK: One of the ligature libraries required the C++ stdlib at runtime, |  | ||||||
|   # and I can't work out a better way to push it to the RPATH. |  | ||||||
|   postInstall = lib.optional (!stdenv.isDarwin) '' |  | ||||||
|     patchelf \ |  | ||||||
|       --set-rpath ${lib.makeLibraryPath ligatureInputs}:"$(patchelf --print-rpath $out/bin/alacritty)" \ |  | ||||||
|       $out/bin/alacritty |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   meta = oldAttrs.meta // { |  | ||||||
|     description = "Alacritty with ligature patch applied"; |  | ||||||
|     homepage = "https://github.com/zenixls2/alacritty/tree/ligature"; |  | ||||||
|   }; |  | ||||||
| }) |  | ||||||
| @@ -1,46 +0,0 @@ | |||||||
| { stdenv |  | ||||||
| , lib |  | ||||||
| , fetchurl |  | ||||||
| , makeWrapper |  | ||||||
| , jdk17 |  | ||||||
| , udev |  | ||||||
| , xorg |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| stdenv.mkDerivation rec { |  | ||||||
|   pname = "atlauncher"; |  | ||||||
|   version = "3.4.34.0"; |  | ||||||
|  |  | ||||||
|   src = fetchurl { |  | ||||||
|     url = "https://github.com/ATLauncher/ATLauncher/releases/download/v${version}/ATLauncher-${version}.jar"; |  | ||||||
|     hash = "sha256-gHUYZaxADchikoCmAfqFjVbMYhhiwg2BZKctmww1Mlw="; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   dontUnpack = true; |  | ||||||
|  |  | ||||||
|   nativeBuildInputs = [ makeWrapper ]; |  | ||||||
|  |  | ||||||
|   installPhase = '' |  | ||||||
|     mkdir -p $out/bin $out/share/java |  | ||||||
|     cp $src $out/share/java/ATLauncher.jar |  | ||||||
|     makeWrapper ${jdk17}/bin/java $out/bin/atlauncher \ |  | ||||||
|       --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ xorg.libXxf86vm udev ]}" \ |  | ||||||
|       --add-flags "-jar $out/share/java/ATLauncher.jar" \ |  | ||||||
|       --add-flags "--working-dir \''${XDG_DATA_HOME:-\$HOME/.local/share}/ATLauncher" \ |  | ||||||
|       --add-flags "--no-launcher-update" |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   meta = { |  | ||||||
|     description = "Minecraft launcher"; |  | ||||||
|     longDescription = '' |  | ||||||
|       ATLauncher is a Launcher for Minecraft which integrates multiple different |  | ||||||
|       ModPacks to allow you to download and install ModPacks easily and quickly. |  | ||||||
|     ''; |  | ||||||
|     sourceProvenance = [ |  | ||||||
|       (lib.sourceTypes.binaryBytecode or { shortName = "binaryBytecode"; isSource = false; }) |  | ||||||
|     ]; |  | ||||||
|     license = lib.licenses.gpl3Only; |  | ||||||
|     platforms = lib.platforms.all; |  | ||||||
|     homepage = "https://atlauncher.com/"; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -1,20 +0,0 @@ | |||||||
| # This file has been generated by node2nix 1.11.1. Do not edit! |  | ||||||
|  |  | ||||||
| { pkgs ? import <nixpkgs> { |  | ||||||
|     inherit system; |  | ||||||
|   } |  | ||||||
| , system ? builtins.currentSystem |  | ||||||
| , nodejs ? pkgs."nodejs_18" |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   nodeEnv = import ./node-env.nix { |  | ||||||
|     inherit (pkgs) stdenv lib python2 runCommand writeTextFile writeShellScript; |  | ||||||
|     inherit pkgs nodejs; |  | ||||||
|     libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null; |  | ||||||
|   }; |  | ||||||
| in |  | ||||||
| import ./packages.nix { |  | ||||||
|   inherit (pkgs) fetchurl nix-gitignore stdenv lib fetchgit; |  | ||||||
|   inherit nodeEnv; |  | ||||||
| } |  | ||||||
| @@ -1,21 +0,0 @@ | |||||||
| { pkgs |  | ||||||
| , stdenv |  | ||||||
| , src |  | ||||||
| , version |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   nodeComposition = import ./composition.nix { |  | ||||||
|     inherit pkgs; |  | ||||||
|     inherit (stdenv.hostPlatform) system; |  | ||||||
|   }; |  | ||||||
| in |  | ||||||
| nodeComposition.package.override { |  | ||||||
|   pname = "betanin"; |  | ||||||
|   inherit version; |  | ||||||
|   src = "${src}/betanin_client"; |  | ||||||
|  |  | ||||||
|   postInstall = '' |  | ||||||
|     PRODUCTION=true npm run-script build |  | ||||||
|   ''; |  | ||||||
| } |  | ||||||
| @@ -1,29 +0,0 @@ | |||||||
| #!/usr/bin/env bash |  | ||||||
|  |  | ||||||
| # Requires node2nix and jq |  | ||||||
|  |  | ||||||
| cd "$(dirname "$0")" || exit 1 |  | ||||||
|  |  | ||||||
| set -euo pipefail |  | ||||||
|  |  | ||||||
| nix build ..#betanin.src 2>/dev/null |  | ||||||
|  |  | ||||||
| tempDir=$(mktemp -d) |  | ||||||
| cp result/betanin_client/package.json "$tempDir/" |  | ||||||
| cp result/betanin_client/package-lock.json "$tempDir/" |  | ||||||
| pushd "$tempDir" |  | ||||||
|  |  | ||||||
| node2nix \ |  | ||||||
|     --input package.json \ |  | ||||||
|     --lock package-lock.json \ |  | ||||||
|     --output packages.nix \ |  | ||||||
|     --composition composition.nix \ |  | ||||||
|     --strip-optional-dependencies \ |  | ||||||
|     --development \ |  | ||||||
|     --nodejs-18 |  | ||||||
|  |  | ||||||
| popd |  | ||||||
| cp "$tempDir"/*.nix . |  | ||||||
|  |  | ||||||
| rm result |  | ||||||
| rm -rf "$tempDir" |  | ||||||
| @@ -1,694 +0,0 @@ | |||||||
| # This file originates from node2nix |  | ||||||
|  |  | ||||||
| { lib, stdenv, nodejs, python2, pkgs, libtool, runCommand, writeTextFile, writeShellScript }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   # Workaround to cope with utillinux in Nixpkgs 20.09 and util-linux in Nixpkgs master |  | ||||||
|   utillinux = if pkgs ? utillinux then pkgs.utillinux else pkgs.util-linux; |  | ||||||
|  |  | ||||||
|   python = if nodejs ? python then nodejs.python else python2; |  | ||||||
|  |  | ||||||
|   # Create a tar wrapper that filters all the 'Ignoring unknown extended header keyword' noise |  | ||||||
|   tarWrapper = runCommand "tarWrapper" { } '' |  | ||||||
|     mkdir -p $out/bin |  | ||||||
|  |  | ||||||
|     cat > $out/bin/tar <<EOF |  | ||||||
|     #! ${stdenv.shell} -e |  | ||||||
|     $(type -p tar) "\$@" --warning=no-unknown-keyword --delay-directory-restore |  | ||||||
|     EOF |  | ||||||
|  |  | ||||||
|     chmod +x $out/bin/tar |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   # Function that generates a TGZ file from a NPM project |  | ||||||
|   buildNodeSourceDist = |  | ||||||
|     { name, version, src, ... }: |  | ||||||
|  |  | ||||||
|     stdenv.mkDerivation { |  | ||||||
|       name = "node-tarball-${name}-${version}"; |  | ||||||
|       inherit src; |  | ||||||
|       buildInputs = [ nodejs ]; |  | ||||||
|       buildPhase = '' |  | ||||||
|         export HOME=$TMPDIR |  | ||||||
|         tgzFile=$(npm pack | tail -n 1) # Hooks to the pack command will add output (https://docs.npmjs.com/misc/scripts) |  | ||||||
|       ''; |  | ||||||
|       installPhase = '' |  | ||||||
|         mkdir -p $out/tarballs |  | ||||||
|         mv $tgzFile $out/tarballs |  | ||||||
|         mkdir -p $out/nix-support |  | ||||||
|         echo "file source-dist $out/tarballs/$tgzFile" >> $out/nix-support/hydra-build-products |  | ||||||
|       ''; |  | ||||||
|     }; |  | ||||||
|  |  | ||||||
|   # Common shell logic |  | ||||||
|   installPackage = writeShellScript "install-package" '' |  | ||||||
|     installPackage() { |  | ||||||
|       local packageName=$1 src=$2 |  | ||||||
|  |  | ||||||
|       local strippedName |  | ||||||
|  |  | ||||||
|       local DIR=$PWD |  | ||||||
|       cd $TMPDIR |  | ||||||
|  |  | ||||||
|       unpackFile $src |  | ||||||
|  |  | ||||||
|       # Make the base dir in which the target dependency resides first |  | ||||||
|       mkdir -p "$(dirname "$DIR/$packageName")" |  | ||||||
|  |  | ||||||
|       if [ -f "$src" ] |  | ||||||
|       then |  | ||||||
|           # Figure out what directory has been unpacked |  | ||||||
|           packageDir="$(find . -maxdepth 1 -type d | tail -1)" |  | ||||||
|  |  | ||||||
|           # Restore write permissions to make building work |  | ||||||
|           find "$packageDir" -type d -exec chmod u+x {} \; |  | ||||||
|           chmod -R u+w "$packageDir" |  | ||||||
|  |  | ||||||
|           # Move the extracted tarball into the output folder |  | ||||||
|           mv "$packageDir" "$DIR/$packageName" |  | ||||||
|       elif [ -d "$src" ] |  | ||||||
|       then |  | ||||||
|           # Get a stripped name (without hash) of the source directory. |  | ||||||
|           # On old nixpkgs it's already set internally. |  | ||||||
|           if [ -z "$strippedName" ] |  | ||||||
|           then |  | ||||||
|               strippedName="$(stripHash $src)" |  | ||||||
|           fi |  | ||||||
|  |  | ||||||
|           # Restore write permissions to make building work |  | ||||||
|           chmod -R u+w "$strippedName" |  | ||||||
|  |  | ||||||
|           # Move the extracted directory into the output folder |  | ||||||
|           mv "$strippedName" "$DIR/$packageName" |  | ||||||
|       fi |  | ||||||
|  |  | ||||||
|       # Change to the package directory to install dependencies |  | ||||||
|       cd "$DIR/$packageName" |  | ||||||
|     } |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   # Bundle the dependencies of the package |  | ||||||
|   # |  | ||||||
|   # Only include dependencies if they don't exist. They may also be bundled in the package. |  | ||||||
|   includeDependencies = { dependencies }: |  | ||||||
|     lib.optionalString (dependencies != [ ]) ( |  | ||||||
|       '' |  | ||||||
|         mkdir -p node_modules |  | ||||||
|         cd node_modules |  | ||||||
|       '' |  | ||||||
|       + (lib.concatMapStrings |  | ||||||
|         (dependency: |  | ||||||
|           '' |  | ||||||
|             if [ ! -e "${dependency.packageName}" ]; then |  | ||||||
|                 ${composePackage dependency} |  | ||||||
|             fi |  | ||||||
|           '' |  | ||||||
|         ) |  | ||||||
|         dependencies) |  | ||||||
|       + '' |  | ||||||
|         cd .. |  | ||||||
|       '' |  | ||||||
|     ); |  | ||||||
|  |  | ||||||
|   # Recursively composes the dependencies of a package |  | ||||||
|   composePackage = { name, packageName, src, dependencies ? [ ], ... }@args: |  | ||||||
|     builtins.addErrorContext "while evaluating node package '${packageName}'" '' |  | ||||||
|       installPackage "${packageName}" "${src}" |  | ||||||
|       ${includeDependencies { inherit dependencies; }} |  | ||||||
|       cd .. |  | ||||||
|       ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} |  | ||||||
|     ''; |  | ||||||
|  |  | ||||||
|   pinpointDependencies = { dependencies, production }: |  | ||||||
|     let |  | ||||||
|       pinpointDependenciesFromPackageJSON = writeTextFile { |  | ||||||
|         name = "pinpointDependencies.js"; |  | ||||||
|         text = '' |  | ||||||
|           var fs = require('fs'); |  | ||||||
|           var path = require('path'); |  | ||||||
|  |  | ||||||
|           function resolveDependencyVersion(location, name) { |  | ||||||
|               if(location == process.env['NIX_STORE']) { |  | ||||||
|                   return null; |  | ||||||
|               } else { |  | ||||||
|                   var dependencyPackageJSON = path.join(location, "node_modules", name, "package.json"); |  | ||||||
|  |  | ||||||
|                   if(fs.existsSync(dependencyPackageJSON)) { |  | ||||||
|                       var dependencyPackageObj = JSON.parse(fs.readFileSync(dependencyPackageJSON)); |  | ||||||
|  |  | ||||||
|                       if(dependencyPackageObj.name == name) { |  | ||||||
|                           return dependencyPackageObj.version; |  | ||||||
|                       } |  | ||||||
|                   } else { |  | ||||||
|                       return resolveDependencyVersion(path.resolve(location, ".."), name); |  | ||||||
|                   } |  | ||||||
|               } |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           function replaceDependencies(dependencies) { |  | ||||||
|               if(typeof dependencies == "object" && dependencies !== null) { |  | ||||||
|                   for(var dependency in dependencies) { |  | ||||||
|                       var resolvedVersion = resolveDependencyVersion(process.cwd(), dependency); |  | ||||||
|  |  | ||||||
|                       if(resolvedVersion === null) { |  | ||||||
|                           process.stderr.write("WARNING: cannot pinpoint dependency: "+dependency+", context: "+process.cwd()+"\n"); |  | ||||||
|                       } else { |  | ||||||
|                           dependencies[dependency] = resolvedVersion; |  | ||||||
|                       } |  | ||||||
|                   } |  | ||||||
|               } |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           /* Read the package.json configuration */ |  | ||||||
|           var packageObj = JSON.parse(fs.readFileSync('./package.json')); |  | ||||||
|  |  | ||||||
|           /* Pinpoint all dependencies */ |  | ||||||
|           replaceDependencies(packageObj.dependencies); |  | ||||||
|           if(process.argv[2] == "development") { |  | ||||||
|               replaceDependencies(packageObj.devDependencies); |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|               packageObj.devDependencies = {}; |  | ||||||
|           } |  | ||||||
|           replaceDependencies(packageObj.optionalDependencies); |  | ||||||
|           replaceDependencies(packageObj.peerDependencies); |  | ||||||
|  |  | ||||||
|           /* Write the fixed package.json file */ |  | ||||||
|           fs.writeFileSync("package.json", JSON.stringify(packageObj, null, 2)); |  | ||||||
|         ''; |  | ||||||
|       }; |  | ||||||
|     in |  | ||||||
|     '' |  | ||||||
|       node ${pinpointDependenciesFromPackageJSON} ${if production then "production" else "development"} |  | ||||||
|  |  | ||||||
|       ${lib.optionalString (dependencies != []) |  | ||||||
|         '' |  | ||||||
|           if [ -d node_modules ] |  | ||||||
|           then |  | ||||||
|               cd node_modules |  | ||||||
|               ${lib.concatMapStrings (dependency: pinpointDependenciesOfPackage dependency) dependencies} |  | ||||||
|               cd .. |  | ||||||
|           fi |  | ||||||
|         ''} |  | ||||||
|     ''; |  | ||||||
|  |  | ||||||
|   # Recursively traverses all dependencies of a package and pinpoints all |  | ||||||
|   # dependencies in the package.json file to the versions that are actually |  | ||||||
|   # being used. |  | ||||||
|  |  | ||||||
|   pinpointDependenciesOfPackage = { packageName, dependencies ? [ ], production ? true, ... }@args: |  | ||||||
|     '' |  | ||||||
|       if [ -d "${packageName}" ] |  | ||||||
|       then |  | ||||||
|           cd "${packageName}" |  | ||||||
|           ${pinpointDependencies { inherit dependencies production; }} |  | ||||||
|           cd .. |  | ||||||
|           ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} |  | ||||||
|       fi |  | ||||||
|     ''; |  | ||||||
|  |  | ||||||
|   # Extract the Node.js source code which is used to compile packages with |  | ||||||
|   # native bindings |  | ||||||
|   nodeSources = runCommand "node-sources" { } '' |  | ||||||
|     tar --no-same-owner --no-same-permissions -xf ${nodejs.src} |  | ||||||
|     mv node-* $out |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   # Script that adds _integrity fields to all package.json files to prevent NPM from consulting the cache (that is empty) |  | ||||||
|   addIntegrityFieldsScript = writeTextFile { |  | ||||||
|     name = "addintegrityfields.js"; |  | ||||||
|     text = '' |  | ||||||
|       var fs = require('fs'); |  | ||||||
|       var path = require('path'); |  | ||||||
|  |  | ||||||
|       function augmentDependencies(baseDir, dependencies) { |  | ||||||
|           for(var dependencyName in dependencies) { |  | ||||||
|               var dependency = dependencies[dependencyName]; |  | ||||||
|  |  | ||||||
|               // Open package.json and augment metadata fields |  | ||||||
|               var packageJSONDir = path.join(baseDir, "node_modules", dependencyName); |  | ||||||
|               var packageJSONPath = path.join(packageJSONDir, "package.json"); |  | ||||||
|  |  | ||||||
|               if(fs.existsSync(packageJSONPath)) { // Only augment packages that exist. Sometimes we may have production installs in which development dependencies can be ignored |  | ||||||
|                   console.log("Adding metadata fields to: "+packageJSONPath); |  | ||||||
|                   var packageObj = JSON.parse(fs.readFileSync(packageJSONPath)); |  | ||||||
|  |  | ||||||
|                   if(dependency.integrity) { |  | ||||||
|                       packageObj["_integrity"] = dependency.integrity; |  | ||||||
|                   } else { |  | ||||||
|                       packageObj["_integrity"] = "sha1-000000000000000000000000000="; // When no _integrity string has been provided (e.g. by Git dependencies), add a dummy one. It does not seem to harm and it bypasses downloads. |  | ||||||
|                   } |  | ||||||
|  |  | ||||||
|                   if(dependency.resolved) { |  | ||||||
|                       packageObj["_resolved"] = dependency.resolved; // Adopt the resolved property if one has been provided |  | ||||||
|                   } else { |  | ||||||
|                       packageObj["_resolved"] = dependency.version; // Set the resolved version to the version identifier. This prevents NPM from cloning Git repositories. |  | ||||||
|                   } |  | ||||||
|  |  | ||||||
|                   if(dependency.from !== undefined) { // Adopt from property if one has been provided |  | ||||||
|                       packageObj["_from"] = dependency.from; |  | ||||||
|                   } |  | ||||||
|  |  | ||||||
|                   fs.writeFileSync(packageJSONPath, JSON.stringify(packageObj, null, 2)); |  | ||||||
|               } |  | ||||||
|  |  | ||||||
|               // Augment transitive dependencies |  | ||||||
|               if(dependency.dependencies !== undefined) { |  | ||||||
|                   augmentDependencies(packageJSONDir, dependency.dependencies); |  | ||||||
|               } |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       if(fs.existsSync("./package-lock.json")) { |  | ||||||
|           var packageLock = JSON.parse(fs.readFileSync("./package-lock.json")); |  | ||||||
|  |  | ||||||
|           if(![1, 2].includes(packageLock.lockfileVersion)) { |  | ||||||
|             process.stderr.write("Sorry, I only understand lock file versions 1 and 2!\n"); |  | ||||||
|             process.exit(1); |  | ||||||
|           } |  | ||||||
|  |  | ||||||
|           if(packageLock.dependencies !== undefined) { |  | ||||||
|               augmentDependencies(".", packageLock.dependencies); |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|     ''; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   # Reconstructs a package-lock file from the node_modules/ folder structure and package.json files with dummy sha1 hashes |  | ||||||
|   reconstructPackageLock = writeTextFile { |  | ||||||
|     name = "reconstructpackagelock.js"; |  | ||||||
|     text = '' |  | ||||||
|       var fs = require('fs'); |  | ||||||
|       var path = require('path'); |  | ||||||
|  |  | ||||||
|       var packageObj = JSON.parse(fs.readFileSync("package.json")); |  | ||||||
|  |  | ||||||
|       var lockObj = { |  | ||||||
|           name: packageObj.name, |  | ||||||
|           version: packageObj.version, |  | ||||||
|           lockfileVersion: 2, |  | ||||||
|           requires: true, |  | ||||||
|           packages: { |  | ||||||
|               "": { |  | ||||||
|                   name: packageObj.name, |  | ||||||
|                   version: packageObj.version, |  | ||||||
|                   license: packageObj.license, |  | ||||||
|                   bin: packageObj.bin, |  | ||||||
|                   dependencies: packageObj.dependencies, |  | ||||||
|                   engines: packageObj.engines, |  | ||||||
|                   optionalDependencies: packageObj.optionalDependencies |  | ||||||
|               } |  | ||||||
|           }, |  | ||||||
|           dependencies: {} |  | ||||||
|       }; |  | ||||||
|  |  | ||||||
|       function augmentPackageJSON(filePath, packages, dependencies) { |  | ||||||
|           var packageJSON = path.join(filePath, "package.json"); |  | ||||||
|           if(fs.existsSync(packageJSON)) { |  | ||||||
|               var packageObj = JSON.parse(fs.readFileSync(packageJSON)); |  | ||||||
|               packages[filePath] = { |  | ||||||
|                   version: packageObj.version, |  | ||||||
|                   integrity: "sha1-000000000000000000000000000=", |  | ||||||
|                   dependencies: packageObj.dependencies, |  | ||||||
|                   engines: packageObj.engines, |  | ||||||
|                   optionalDependencies: packageObj.optionalDependencies |  | ||||||
|               }; |  | ||||||
|               dependencies[packageObj.name] = { |  | ||||||
|                   version: packageObj.version, |  | ||||||
|                   integrity: "sha1-000000000000000000000000000=", |  | ||||||
|                   dependencies: {} |  | ||||||
|               }; |  | ||||||
|               processDependencies(path.join(filePath, "node_modules"), packages, dependencies[packageObj.name].dependencies); |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       function processDependencies(dir, packages, dependencies) { |  | ||||||
|           if(fs.existsSync(dir)) { |  | ||||||
|               var files = fs.readdirSync(dir); |  | ||||||
|  |  | ||||||
|               files.forEach(function(entry) { |  | ||||||
|                   var filePath = path.join(dir, entry); |  | ||||||
|                   var stats = fs.statSync(filePath); |  | ||||||
|  |  | ||||||
|                   if(stats.isDirectory()) { |  | ||||||
|                       if(entry.substr(0, 1) == "@") { |  | ||||||
|                           // When we encounter a namespace folder, augment all packages belonging to the scope |  | ||||||
|                           var pkgFiles = fs.readdirSync(filePath); |  | ||||||
|  |  | ||||||
|                           pkgFiles.forEach(function(entry) { |  | ||||||
|                               if(stats.isDirectory()) { |  | ||||||
|                                   var pkgFilePath = path.join(filePath, entry); |  | ||||||
|                                   augmentPackageJSON(pkgFilePath, packages, dependencies); |  | ||||||
|                               } |  | ||||||
|                           }); |  | ||||||
|                       } else { |  | ||||||
|                           augmentPackageJSON(filePath, packages, dependencies); |  | ||||||
|                       } |  | ||||||
|                   } |  | ||||||
|               }); |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|  |  | ||||||
|       processDependencies("node_modules", lockObj.packages, lockObj.dependencies); |  | ||||||
|  |  | ||||||
|       fs.writeFileSync("package-lock.json", JSON.stringify(lockObj, null, 2)); |  | ||||||
|     ''; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   # Script that links bins defined in package.json to the node_modules bin directory |  | ||||||
|   # NPM does not do this for top-level packages itself anymore as of v7 |  | ||||||
|   linkBinsScript = writeTextFile { |  | ||||||
|     name = "linkbins.js"; |  | ||||||
|     text = '' |  | ||||||
|       var fs = require('fs'); |  | ||||||
|       var path = require('path'); |  | ||||||
|  |  | ||||||
|       var packageObj = JSON.parse(fs.readFileSync("package.json")); |  | ||||||
|  |  | ||||||
|       var nodeModules = Array(packageObj.name.split("/").length).fill("..").join(path.sep); |  | ||||||
|  |  | ||||||
|       if(packageObj.bin !== undefined) { |  | ||||||
|           fs.mkdirSync(path.join(nodeModules, ".bin")) |  | ||||||
|  |  | ||||||
|           if(typeof packageObj.bin == "object") { |  | ||||||
|               Object.keys(packageObj.bin).forEach(function(exe) { |  | ||||||
|                   if(fs.existsSync(packageObj.bin[exe])) { |  | ||||||
|                       console.log("linking bin '" + exe + "'"); |  | ||||||
|                       fs.symlinkSync( |  | ||||||
|                           path.join("..", packageObj.name, packageObj.bin[exe]), |  | ||||||
|                           path.join(nodeModules, ".bin", exe) |  | ||||||
|                       ); |  | ||||||
|                   } |  | ||||||
|                   else { |  | ||||||
|                       console.log("skipping non-existent bin '" + exe + "'"); |  | ||||||
|                   } |  | ||||||
|               }) |  | ||||||
|           } |  | ||||||
|           else { |  | ||||||
|               if(fs.existsSync(packageObj.bin)) { |  | ||||||
|                   console.log("linking bin '" + packageObj.bin + "'"); |  | ||||||
|                   fs.symlinkSync( |  | ||||||
|                       path.join("..", packageObj.name, packageObj.bin), |  | ||||||
|                       path.join(nodeModules, ".bin", packageObj.name.split("/").pop()) |  | ||||||
|                   ); |  | ||||||
|               } |  | ||||||
|               else { |  | ||||||
|                   console.log("skipping non-existent bin '" + packageObj.bin + "'"); |  | ||||||
|               } |  | ||||||
|           } |  | ||||||
|       } |  | ||||||
|       else if(packageObj.directories !== undefined && packageObj.directories.bin !== undefined) { |  | ||||||
|           fs.mkdirSync(path.join(nodeModules, ".bin")) |  | ||||||
|  |  | ||||||
|           fs.readdirSync(packageObj.directories.bin).forEach(function(exe) { |  | ||||||
|               if(fs.existsSync(path.join(packageObj.directories.bin, exe))) { |  | ||||||
|                   console.log("linking bin '" + exe + "'"); |  | ||||||
|                   fs.symlinkSync( |  | ||||||
|                       path.join("..", packageObj.name, packageObj.directories.bin, exe), |  | ||||||
|                       path.join(nodeModules, ".bin", exe) |  | ||||||
|                   ); |  | ||||||
|               } |  | ||||||
|               else { |  | ||||||
|                   console.log("skipping non-existent bin '" + exe + "'"); |  | ||||||
|               } |  | ||||||
|           }) |  | ||||||
|       } |  | ||||||
|     ''; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   prepareAndInvokeNPM = { packageName, bypassCache, reconstructLock, npmFlags, production }: |  | ||||||
|     let |  | ||||||
|       forceOfflineFlag = if bypassCache then "--offline" else "--registry http://www.example.com"; |  | ||||||
|     in |  | ||||||
|     '' |  | ||||||
|       # Pinpoint the versions of all dependencies to the ones that are actually being used |  | ||||||
|       echo "pinpointing versions of dependencies..." |  | ||||||
|       source $pinpointDependenciesScriptPath |  | ||||||
|  |  | ||||||
|       # Patch the shebangs of the bundled modules to prevent them from |  | ||||||
|       # calling executables outside the Nix store as much as possible |  | ||||||
|       patchShebangs . |  | ||||||
|  |  | ||||||
|       # Deploy the Node.js package by running npm install. Since the |  | ||||||
|       # dependencies have been provided already by ourselves, it should not |  | ||||||
|       # attempt to install them again, which is good, because we want to make |  | ||||||
|       # it Nix's responsibility. If it needs to install any dependencies |  | ||||||
|       # anyway (e.g. because the dependency parameters are |  | ||||||
|       # incomplete/incorrect), it fails. |  | ||||||
|       # |  | ||||||
|       # The other responsibilities of NPM are kept -- version checks, build |  | ||||||
|       # steps, postprocessing etc. |  | ||||||
|  |  | ||||||
|       export HOME=$TMPDIR |  | ||||||
|       cd "${packageName}" |  | ||||||
|       runHook preRebuild |  | ||||||
|  |  | ||||||
|       ${lib.optionalString bypassCache '' |  | ||||||
|         ${lib.optionalString reconstructLock '' |  | ||||||
|           if [ -f package-lock.json ] |  | ||||||
|           then |  | ||||||
|               echo "WARNING: Reconstruct lock option enabled, but a lock file already exists!" |  | ||||||
|               echo "This will most likely result in version mismatches! We will remove the lock file and regenerate it!" |  | ||||||
|               rm package-lock.json |  | ||||||
|           else |  | ||||||
|               echo "No package-lock.json file found, reconstructing..." |  | ||||||
|           fi |  | ||||||
|  |  | ||||||
|           node ${reconstructPackageLock} |  | ||||||
|         ''} |  | ||||||
|  |  | ||||||
|         node ${addIntegrityFieldsScript} |  | ||||||
|       ''} |  | ||||||
|  |  | ||||||
|       npm ${forceOfflineFlag} --nodedir=${nodeSources} ${npmFlags} ${lib.optionalString production "--production"} rebuild |  | ||||||
|  |  | ||||||
|       runHook postRebuild |  | ||||||
|  |  | ||||||
|       if [ "''${dontNpmInstall-}" != "1" ] |  | ||||||
|       then |  | ||||||
|           # NPM tries to download packages even when they already exist if npm-shrinkwrap is used. |  | ||||||
|           rm -f npm-shrinkwrap.json |  | ||||||
|  |  | ||||||
|           npm ${forceOfflineFlag} --nodedir=${nodeSources} --no-bin-links --ignore-scripts ${npmFlags} ${lib.optionalString production "--production"} install |  | ||||||
|       fi |  | ||||||
|  |  | ||||||
|       # Link executables defined in package.json |  | ||||||
|       node ${linkBinsScript} |  | ||||||
|     ''; |  | ||||||
|  |  | ||||||
|   # Builds and composes an NPM package including all its dependencies |  | ||||||
|   buildNodePackage = |  | ||||||
|     { name |  | ||||||
|     , packageName |  | ||||||
|     , version ? null |  | ||||||
|     , dependencies ? [ ] |  | ||||||
|     , buildInputs ? [ ] |  | ||||||
|     , production ? true |  | ||||||
|     , npmFlags ? "" |  | ||||||
|     , dontNpmInstall ? false |  | ||||||
|     , bypassCache ? false |  | ||||||
|     , reconstructLock ? false |  | ||||||
|     , preRebuild ? "" |  | ||||||
|     , dontStrip ? true |  | ||||||
|     , unpackPhase ? "true" |  | ||||||
|     , buildPhase ? "true" |  | ||||||
|     , meta ? { } |  | ||||||
|     , ... |  | ||||||
|     }@args: |  | ||||||
|  |  | ||||||
|     let |  | ||||||
|       extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "preRebuild" "unpackPhase" "buildPhase" "meta" ]; |  | ||||||
|     in |  | ||||||
|     stdenv.mkDerivation ({ |  | ||||||
|       name = "${name}${if version == null then "" else "-${version}"}"; |  | ||||||
|       buildInputs = [ tarWrapper python nodejs ] |  | ||||||
|         ++ lib.optional (stdenv.isLinux) utillinux |  | ||||||
|         ++ lib.optional (stdenv.isDarwin) libtool |  | ||||||
|         ++ buildInputs; |  | ||||||
|  |  | ||||||
|       inherit nodejs; |  | ||||||
|  |  | ||||||
|       inherit dontStrip; # Stripping may fail a build for some package deployments |  | ||||||
|       inherit dontNpmInstall preRebuild unpackPhase buildPhase; |  | ||||||
|  |  | ||||||
|       compositionScript = composePackage args; |  | ||||||
|       pinpointDependenciesScript = pinpointDependenciesOfPackage args; |  | ||||||
|  |  | ||||||
|       passAsFile = [ "compositionScript" "pinpointDependenciesScript" ]; |  | ||||||
|  |  | ||||||
|       installPhase = '' |  | ||||||
|         source ${installPackage} |  | ||||||
|  |  | ||||||
|         # Create and enter a root node_modules/ folder |  | ||||||
|         mkdir -p $out/lib/node_modules |  | ||||||
|         cd $out/lib/node_modules |  | ||||||
|  |  | ||||||
|         # Compose the package and all its dependencies |  | ||||||
|         source $compositionScriptPath |  | ||||||
|  |  | ||||||
|         ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} |  | ||||||
|  |  | ||||||
|         # Create symlink to the deployed executable folder, if applicable |  | ||||||
|         if [ -d "$out/lib/node_modules/.bin" ] |  | ||||||
|         then |  | ||||||
|             ln -s $out/lib/node_modules/.bin $out/bin |  | ||||||
|  |  | ||||||
|             # Fixup all executables |  | ||||||
|             ls $out/bin/* | while read i |  | ||||||
|             do |  | ||||||
|                 file="$(readlink -f "$i")" |  | ||||||
|                 chmod u+rwx "$file" |  | ||||||
|                 if isScript "$file" |  | ||||||
|                 then |  | ||||||
|                     sed -i 's/\r$//' "$file"  # convert crlf to lf |  | ||||||
|                 fi |  | ||||||
|             done |  | ||||||
|         fi |  | ||||||
|  |  | ||||||
|         # Create symlinks to the deployed manual page folders, if applicable |  | ||||||
|         if [ -d "$out/lib/node_modules/${packageName}/man" ] |  | ||||||
|         then |  | ||||||
|             mkdir -p $out/share |  | ||||||
|             for dir in "$out/lib/node_modules/${packageName}/man/"* |  | ||||||
|             do |  | ||||||
|                 mkdir -p $out/share/man/$(basename "$dir") |  | ||||||
|                 for page in "$dir"/* |  | ||||||
|                 do |  | ||||||
|                     ln -s $page $out/share/man/$(basename "$dir") |  | ||||||
|                 done |  | ||||||
|             done |  | ||||||
|         fi |  | ||||||
|  |  | ||||||
|         # Run post install hook, if provided |  | ||||||
|         runHook postInstall |  | ||||||
|       ''; |  | ||||||
|  |  | ||||||
|       meta = { |  | ||||||
|         # default to Node.js' platforms |  | ||||||
|         platforms = nodejs.meta.platforms; |  | ||||||
|       } // meta; |  | ||||||
|     } // extraArgs); |  | ||||||
|  |  | ||||||
|   # Builds a node environment (a node_modules folder and a set of binaries) |  | ||||||
|   buildNodeDependencies = |  | ||||||
|     { name |  | ||||||
|     , packageName |  | ||||||
|     , version ? null |  | ||||||
|     , src |  | ||||||
|     , dependencies ? [ ] |  | ||||||
|     , buildInputs ? [ ] |  | ||||||
|     , production ? true |  | ||||||
|     , npmFlags ? "" |  | ||||||
|     , dontNpmInstall ? false |  | ||||||
|     , bypassCache ? false |  | ||||||
|     , reconstructLock ? false |  | ||||||
|     , dontStrip ? true |  | ||||||
|     , unpackPhase ? "true" |  | ||||||
|     , buildPhase ? "true" |  | ||||||
|     , ... |  | ||||||
|     }@args: |  | ||||||
|  |  | ||||||
|     let |  | ||||||
|       extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" ]; |  | ||||||
|     in |  | ||||||
|     stdenv.mkDerivation ({ |  | ||||||
|       name = "node-dependencies-${name}${if version == null then "" else "-${version}"}"; |  | ||||||
|  |  | ||||||
|       buildInputs = [ tarWrapper python nodejs ] |  | ||||||
|         ++ lib.optional (stdenv.isLinux) utillinux |  | ||||||
|         ++ lib.optional (stdenv.isDarwin) libtool |  | ||||||
|         ++ buildInputs; |  | ||||||
|  |  | ||||||
|       inherit dontStrip; # Stripping may fail a build for some package deployments |  | ||||||
|       inherit dontNpmInstall unpackPhase buildPhase; |  | ||||||
|  |  | ||||||
|       includeScript = includeDependencies { inherit dependencies; }; |  | ||||||
|       pinpointDependenciesScript = pinpointDependenciesOfPackage args; |  | ||||||
|  |  | ||||||
|       passAsFile = [ "includeScript" "pinpointDependenciesScript" ]; |  | ||||||
|  |  | ||||||
|       installPhase = '' |  | ||||||
|         source ${installPackage} |  | ||||||
|  |  | ||||||
|         mkdir -p $out/${packageName} |  | ||||||
|         cd $out/${packageName} |  | ||||||
|  |  | ||||||
|         source $includeScriptPath |  | ||||||
|  |  | ||||||
|         # Create fake package.json to make the npm commands work properly |  | ||||||
|         cp ${src}/package.json . |  | ||||||
|         chmod 644 package.json |  | ||||||
|         ${lib.optionalString bypassCache '' |  | ||||||
|           if [ -f ${src}/package-lock.json ] |  | ||||||
|           then |  | ||||||
|               cp ${src}/package-lock.json . |  | ||||||
|               chmod 644 package-lock.json |  | ||||||
|           fi |  | ||||||
|         ''} |  | ||||||
|  |  | ||||||
|         # Go to the parent folder to make sure that all packages are pinpointed |  | ||||||
|         cd .. |  | ||||||
|         ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} |  | ||||||
|  |  | ||||||
|         ${prepareAndInvokeNPM { inherit packageName bypassCache reconstructLock npmFlags production; }} |  | ||||||
|  |  | ||||||
|         # Expose the executables that were installed |  | ||||||
|         cd .. |  | ||||||
|         ${lib.optionalString (builtins.substring 0 1 packageName == "@") "cd .."} |  | ||||||
|  |  | ||||||
|         mv ${packageName} lib |  | ||||||
|         ln -s $out/lib/node_modules/.bin $out/bin |  | ||||||
|       ''; |  | ||||||
|     } // extraArgs); |  | ||||||
|  |  | ||||||
|   # Builds a development shell |  | ||||||
|   buildNodeShell = |  | ||||||
|     { name |  | ||||||
|     , packageName |  | ||||||
|     , version ? null |  | ||||||
|     , src |  | ||||||
|     , dependencies ? [ ] |  | ||||||
|     , buildInputs ? [ ] |  | ||||||
|     , production ? true |  | ||||||
|     , npmFlags ? "" |  | ||||||
|     , dontNpmInstall ? false |  | ||||||
|     , bypassCache ? false |  | ||||||
|     , reconstructLock ? false |  | ||||||
|     , dontStrip ? true |  | ||||||
|     , unpackPhase ? "true" |  | ||||||
|     , buildPhase ? "true" |  | ||||||
|     , ... |  | ||||||
|     }@args: |  | ||||||
|  |  | ||||||
|     let |  | ||||||
|       nodeDependencies = buildNodeDependencies args; |  | ||||||
|       extraArgs = removeAttrs args [ "name" "dependencies" "buildInputs" "dontStrip" "dontNpmInstall" "unpackPhase" "buildPhase" ]; |  | ||||||
|     in |  | ||||||
|     stdenv.mkDerivation ({ |  | ||||||
|       name = "node-shell-${name}${if version == null then "" else "-${version}"}"; |  | ||||||
|  |  | ||||||
|       buildInputs = [ python nodejs ] ++ lib.optional (stdenv.isLinux) utillinux ++ buildInputs; |  | ||||||
|       buildCommand = '' |  | ||||||
|         mkdir -p $out/bin |  | ||||||
|         cat > $out/bin/shell <<EOF |  | ||||||
|         #! ${stdenv.shell} -e |  | ||||||
|         $shellHook |  | ||||||
|         exec ${stdenv.shell} |  | ||||||
|         EOF |  | ||||||
|         chmod +x $out/bin/shell |  | ||||||
|       ''; |  | ||||||
|  |  | ||||||
|       # Provide the dependencies in a development shell through the NODE_PATH environment variable |  | ||||||
|       inherit nodeDependencies; |  | ||||||
|       shellHook = lib.optionalString (dependencies != [ ]) '' |  | ||||||
|         export NODE_PATH=${nodeDependencies}/lib/node_modules |  | ||||||
|         export PATH="${nodeDependencies}/bin:$PATH" |  | ||||||
|       ''; |  | ||||||
|     } // extraArgs); |  | ||||||
| in |  | ||||||
| { |  | ||||||
|   buildNodeSourceDist = lib.makeOverridable buildNodeSourceDist; |  | ||||||
|   buildNodePackage = lib.makeOverridable buildNodePackage; |  | ||||||
|   buildNodeDependencies = lib.makeOverridable buildNodeDependencies; |  | ||||||
|   buildNodeShell = lib.makeOverridable buildNodeShell; |  | ||||||
| } |  | ||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -1,71 +0,0 @@ | |||||||
| { lib |  | ||||||
| , callPackage |  | ||||||
| , fetchFromGitHub |  | ||||||
| , python3 |  | ||||||
| , beets |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   py = python3.pkgs; |  | ||||||
|  |  | ||||||
|   version = "0.4.0.ffe45c02"; |  | ||||||
|  |  | ||||||
|   src = fetchFromGitHub { |  | ||||||
|     owner = "xeals"; |  | ||||||
|     repo = "betanin"; |  | ||||||
|     rev = "ffe45c028037fc1659f62a9cdc9e1413dc2f358d"; |  | ||||||
|     hash = "sha256-5d8Y7PDlhkdVRVX+KvpiQ2WYNRELwc+ya5s4Qi+YQpI="; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   client = callPackage ./client { |  | ||||||
|     inherit src version; |  | ||||||
|   }; |  | ||||||
| in |  | ||||||
| py.buildPythonApplication { |  | ||||||
|   pname = "betanin"; |  | ||||||
|   inherit version src; |  | ||||||
|  |  | ||||||
|   clientDistDir = "${client}/lib/node_modules/betanin/dist/"; |  | ||||||
|  |  | ||||||
|   doCheck = false; |  | ||||||
|  |  | ||||||
|   patches = [ ./paths.patch ]; |  | ||||||
|   postPatch = '' |  | ||||||
|     export libPrefix="${python3.libPrefix}" |  | ||||||
|     substituteAllInPlace betanin/paths.py |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   propagatedBuildInputs = |  | ||||||
|     (builtins.attrValues { |  | ||||||
|       inherit (py) |  | ||||||
|         apprise |  | ||||||
|         alembic |  | ||||||
|         click |  | ||||||
|         flask |  | ||||||
|         flask-cors |  | ||||||
|         flask-jwt-extended |  | ||||||
|         flask_migrate |  | ||||||
|         flask-restx |  | ||||||
|         flask-socketio |  | ||||||
|         flask-sqlalchemy |  | ||||||
|         gevent |  | ||||||
|         pyxdg |  | ||||||
|         loguru |  | ||||||
|         ptyprocess |  | ||||||
|         python-engineio |  | ||||||
|         python-socketio |  | ||||||
|         sqlalchemy |  | ||||||
|         sqlalchemy-utils |  | ||||||
|         toml; |  | ||||||
|     }) ++ [ |  | ||||||
|       beets |  | ||||||
|     ]; |  | ||||||
|  |  | ||||||
|   meta = { |  | ||||||
|     homepage = "https://github.com/sentriz/betanin"; |  | ||||||
|     description = "beets based mitm of your torrent client and music player"; |  | ||||||
|     license = lib.licenses.gpl3Only; |  | ||||||
|     maintainers = [ ]; |  | ||||||
|     platforms = python3.meta.platforms; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -1,24 +0,0 @@ | |||||||
| --- a/betanin/paths.py |  | ||||||
| +++ b/betanin/paths.py |  | ||||||
| @@ -19,11 +19,3 @@ |  | ||||||
|  BEETS_DIR = xdg.BaseDirectory.save_config_path("beets") |  | ||||||
| -CLIENT_DIST_DIR = _first_existing( |  | ||||||
| -    os.path.join(os.getcwd(), "betanin_client", "dist"), |  | ||||||
| -    os.path.join(site.getusersitepackages(), "betanin_client", "dist"), |  | ||||||
| -    os.path.join(site.getsitepackages()[0], "betanin_client", "dist"), |  | ||||||
| -) |  | ||||||
| -MIGRATIONS_DIR = _first_existing( |  | ||||||
| -    os.path.join(os.getcwd(), "betanin_migrations"), |  | ||||||
| -    os.path.join(site.getusersitepackages(), "betanin_migrations"), |  | ||||||
| -    os.path.join(site.getsitepackages()[0], "betanin_migrations"), |  | ||||||
| -) |  | ||||||
| +CLIENT_DIST_DIR = "@clientDistDir@" |  | ||||||
| +MIGRATIONS_DIR = "@out@/lib/@libPrefix@/site-packages/betanin_migrations" |  | ||||||
| @@ -38,6 +38,2 @@ |  | ||||||
|  CONFIG_PATH = os.path.join(CONFIG_DIR, "config.toml") |  | ||||||
| -VERSION_PATH = _first_existing( |  | ||||||
| -    os.path.join(os.getcwd(), "betanin/version.txt"), |  | ||||||
| -    os.path.join(site.getusersitepackages(), "betanin", "version.txt"), |  | ||||||
| -    os.path.join(site.getsitepackages()[0], "betanin", "version.txt"), |  | ||||||
| -) |  | ||||||
| +VERSION_PATH = "@out@/lib/@libPrefix@/site-packages/betanin/version.txt" |  | ||||||
| @@ -1,94 +0,0 @@ | |||||||
| { lib |  | ||||||
| , stdenv |  | ||||||
| , fetchurl |  | ||||||
| , writeScriptBin |  | ||||||
| , appimageTools |  | ||||||
| , copyDesktopItems |  | ||||||
| , makeDesktopItem |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| let |  | ||||||
|   pname = "cura5"; |  | ||||||
|   version = "5.4.0"; |  | ||||||
|   name = "${pname}-${version}"; |  | ||||||
|  |  | ||||||
|   cura5 = appimageTools.wrapType2 { |  | ||||||
|     inherit pname version; |  | ||||||
|     src = fetchurl { |  | ||||||
|       url = "https://github.com/Ultimaker/Cura/releases/download/${version}/Ultimaker-Cura-${version}-linux-modern.AppImage"; |  | ||||||
|       hash = "sha256-QVv7Wkfo082PH6n6rpsB79st2xK2+Np9ivBg/PYZd74="; |  | ||||||
|     }; |  | ||||||
|     extraPkgs = _: [ ]; |  | ||||||
|   }; |  | ||||||
|   script = writeScriptBin pname '' |  | ||||||
|     #!${stdenv.shell} |  | ||||||
|     # AppImage version of Cura loses current working directory and treats all paths relateive to $HOME. |  | ||||||
|     # So we convert each of the files passed as argument to an absolute path. |  | ||||||
|     # This fixes use cases like `cd /path/to/my/files; cura mymodel.stl anothermodel.stl`. |  | ||||||
|  |  | ||||||
|     args=() |  | ||||||
|     for a in "$@"; do |  | ||||||
|       if [ -e "$a" ]; then |  | ||||||
|         a="$(realpath "$a")" |  | ||||||
|       fi |  | ||||||
|       args+=("$a") |  | ||||||
|     done |  | ||||||
|     exec "${cura5}/bin/${name}" "''${args[@]}" |  | ||||||
|   ''; |  | ||||||
| in |  | ||||||
| stdenv.mkDerivation rec { |  | ||||||
|   inherit pname version; |  | ||||||
|   dontUnpack = true; |  | ||||||
|  |  | ||||||
|   nativeBuildInputs = [ copyDesktopItems ]; |  | ||||||
|   desktopItems = [ |  | ||||||
|     # Based on upstream. |  | ||||||
|     # https://github.com/Ultimaker/Cura/blob/main/packaging/AppImage/cura.desktop.jinja |  | ||||||
|     (makeDesktopItem { |  | ||||||
|       name = "cura"; |  | ||||||
|       desktopName = "UltiMaker Cura"; |  | ||||||
|       genericName = "3D Printing Software"; |  | ||||||
|       comment = meta.longDescription; |  | ||||||
|       exec = "cura5"; |  | ||||||
|       icon = "cura-icon"; |  | ||||||
|       terminal = false; |  | ||||||
|       type = "Application"; |  | ||||||
|       mimeTypes = [ |  | ||||||
|         "model/stl" |  | ||||||
|         "application/vnd.ms-3mfdocument" |  | ||||||
|         "application/prs.wavefront-obj" |  | ||||||
|         "image/bmp" |  | ||||||
|         "image/gif" |  | ||||||
|         "image/jpeg" |  | ||||||
|         "image/png" |  | ||||||
|         "text/x-gcode" |  | ||||||
|         "application/x-amf" |  | ||||||
|         "application/x-ply" |  | ||||||
|         "application/x-ctm" |  | ||||||
|         "model/vnd.collada+xml" |  | ||||||
|         "model/gltf-binary" |  | ||||||
|         "model/gltf+json" |  | ||||||
|         "model/vnd.collada+xml+zip" |  | ||||||
|       ]; |  | ||||||
|       categories = [ "Graphics" ]; |  | ||||||
|       keywords = [ "3D" "Printing" ]; |  | ||||||
|     }) |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   # TODO: Extract cura-icon from AppImage source. |  | ||||||
|   installPhase = '' |  | ||||||
|     mkdir -p $out/bin |  | ||||||
|     cp ${script}/bin/cura5 $out/bin/cura5 |  | ||||||
|     runHook postInstall |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   meta = { |  | ||||||
|     description = "3D printing software"; |  | ||||||
|     homepage = "https://github.com/ultimaker/cura"; |  | ||||||
|     longDescription = '' |  | ||||||
|       Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great. |  | ||||||
|     ''; |  | ||||||
|     license = lib.licenses.lgpl3; |  | ||||||
|     platforms = [ "x86_64-linux" ]; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -1,38 +0,0 @@ | |||||||
| { stdenv |  | ||||||
| , lib |  | ||||||
| , fetchFromGitHub |  | ||||||
| , python3 |  | ||||||
| , ffmpeg |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| stdenv.mkDerivation rec { |  | ||||||
|   pname = "ytarchive"; |  | ||||||
|   version = "0.2.2+0304577"; |  | ||||||
|  |  | ||||||
|   src = fetchFromGitHub { |  | ||||||
|     owner = "Kethsar"; |  | ||||||
|     repo = "ytarchive"; |  | ||||||
|     # NOTE: Last revision where it was written in Python, so don't change |  | ||||||
|     #   without rewriting the derivation. |  | ||||||
|     rev = "030457749d6c8d1d62240bfbad659326f3cd3a30"; |  | ||||||
|     hash = "sha256-mvmdkxZxlEbWc7GR8LfyxTJOeEhjCoYyeatDx8l1uhM="; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   propagatedBuildInputs = [ |  | ||||||
|     python3 |  | ||||||
|     ffmpeg |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
|   phases = [ "unpackPhase" "installPhase" "fixupPhase" ]; |  | ||||||
|  |  | ||||||
|   installPhase = '' |  | ||||||
|     install -Dm00755 ytarchive.py $out/bin/ytarchive |  | ||||||
|   ''; |  | ||||||
|  |  | ||||||
|   meta = with lib; { |  | ||||||
|     description = "Garbage Youtube livestream downloader"; |  | ||||||
|     homepage = "https://github.com/Kethsar/ytarchive"; |  | ||||||
|     license = licenses.mit; |  | ||||||
|     platforms = python3.meta.platforms; |  | ||||||
|   }; |  | ||||||
| } |  | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| , buildGoModule | , buildGoModule | ||||||
| , makeWrapper | , makeWrapper | ||||||
| @@ -59,10 +59,9 @@ buildGoModule rec { | |||||||
|     done |     done | ||||||
|   ''; |   ''; | ||||||
|  |  | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     homepage = "https://github.com/therecipe/qt"; |     homepage = "https://github.com/therecipe/qt"; | ||||||
|     description = "Qt bindings for Go"; |     description = "Qt bindings for Go"; | ||||||
|     license = licenses.lgpl3; |     license = licenses.lgpl3; | ||||||
|     broken = true; |  | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| 
 | 
 | ||||||
|  | , coreutils | ||||||
| , autoreconfHook | , autoreconfHook | ||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
| @@ -26,7 +26,7 @@ stdenv.mkDerivation rec { | |||||||
|     mkdir -p $out/include $out/lib |     mkdir -p $out/include $out/lib | ||||||
|   ''; |   ''; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     homepage = "https://github.com/xant/libhl"; |     homepage = "https://github.com/xant/libhl"; | ||||||
|     description = "Simple and fast C library implementing a thread-safe API to manage hash-tables, linked lists, lock-free ring buffers and queues "; |     description = "Simple and fast C library implementing a thread-safe API to manage hash-tables, linked lists, lock-free ring buffers and queues "; | ||||||
|     license = licenses.lgpl3; |     license = licenses.lgpl3; | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib | { stdenv | ||||||
| , buildPythonPackage | , buildPythonPackage | ||||||
| , fetchPypi | , fetchPypi | ||||||
| }: | }: | ||||||
| @@ -14,9 +14,9 @@ buildPythonPackage rec { | |||||||
|  |  | ||||||
|   doCheck = false; |   doCheck = false; | ||||||
|  |  | ||||||
|   meta = with lib; { |   meta = { | ||||||
|     homepage = "https://stuffivelearned.org/doku.php?id=programming:python:py-sonic"; |     homepage = "https://stuffivelearned.org/doku.php?id=programming:python:py-sonic"; | ||||||
|     license = licenses.gpl3; |     license = stdenv.lib.licenses.gpl3; | ||||||
|     description = "A python wrapper library for the Subsonic REST API"; |     description = "A python wrapper library for the Subsonic REST API"; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,5 +1,4 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| 
 | 
 | ||||||
| , autoreconfHook | , autoreconfHook | ||||||
| @@ -26,10 +25,10 @@ stdenv.mkDerivation rec { | |||||||
| 
 | 
 | ||||||
|   configureFlags = [ "--with-moduledir=\${out}/lib/security" ]; |   configureFlags = [ "--with-moduledir=\${out}/lib/security" ]; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     homepage = "https://github.com/cruegge/pam-gnupg"; |     homepage = "https://github.com/cruegge/pam-gnupg"; | ||||||
|     description = "Unlock GnuPG keys on login"; |     description = "Unlock GnuPG keys on login"; | ||||||
|     license = licenses.gpl3; |     license = licenses.gpl3; | ||||||
|     platforms = pam.meta.platforms; |     inherit (pam.meta) platforms; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| @@ -1,5 +1,4 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| , installShellFiles | , installShellFiles | ||||||
| 
 | 
 | ||||||
| @@ -26,10 +25,10 @@ stdenv.mkDerivation { | |||||||
|     installShellCompletion --zsh _zshz |     installShellCompletion --zsh _zshz | ||||||
|   ''; |   ''; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = { | ||||||
|     description = ''Jump quickly to directories that you have visited "frecently." A native ZSH port of z.sh.''; |     description = ''Jump quickly to directories that you have visited "frecently." A native ZSH port of z.sh.''; | ||||||
|     homepage = "https://github.com/agkozak/zsh-z"; |     homepage = "https://github.com/agkozak/zsh-z"; | ||||||
|     license = licenses.mit; |     license = stdenv.lib.licenses.mit; | ||||||
|     platforms = zsh.meta.platforms; |     platforms = zsh.meta.platforms; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| @@ -1,4 +1,4 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| 
 | 
 | ||||||
| , python3Packages | , python3Packages | ||||||
| @@ -20,12 +20,7 @@ python3Packages.buildPythonApplication rec { | |||||||
|     pyyaml |     pyyaml | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|   patchPhase = '' |   meta = with stdenv.lib; { | ||||||
|     substituteInPlace setup.py \ |  | ||||||
|       --replace PROJECTVERSION "${version}" |  | ||||||
|   ''; |  | ||||||
| 
 |  | ||||||
|   meta = with lib; { |  | ||||||
|     description = "Fan controller for AMD graphics cards running the amdgpu driver on Linux"; |     description = "Fan controller for AMD graphics cards running the amdgpu driver on Linux"; | ||||||
|     homepage = "https://github.com/chestm007/amdgpu-fan"; |     homepage = "https://github.com/chestm007/amdgpu-fan"; | ||||||
|     license = licenses.gpl2; |     license = licenses.gpl2; | ||||||
| @@ -1,18 +1,16 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
|  |  | ||||||
| , qtbase | , qtbase | ||||||
| , qmake | , qmake | ||||||
| , wrapQtAppsHook ? null # Temporary backwards compatibility |  | ||||||
| }: | }: | ||||||
|  |  | ||||||
| stdenv.mkDerivation rec { | stdenv.mkDerivation rec { | ||||||
|   pname = "radeon-profile-daemon"; |   pname = "radeon-profile-daemon"; | ||||||
|   version = "20190603.g06qxq2h"; |   version = "20190603.g06qxq2h"; | ||||||
|  |  | ||||||
|  |   nativeBuildInputs = [ qmake ]; | ||||||
|   buildInputs = [ qtbase ]; |   buildInputs = [ qtbase ]; | ||||||
|   nativeBuildInputs = [ qmake wrapQtAppsHook ]; |  | ||||||
|  |  | ||||||
|   src = ( |   src = ( | ||||||
|     fetchFromGitHub { |     fetchFromGitHub { | ||||||
| @@ -28,7 +26,7 @@ stdenv.mkDerivation rec { | |||||||
|       --replace "/usr/" "$out/" |       --replace "/usr/" "$out/" | ||||||
|   ''; |   ''; | ||||||
|  |  | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     description = "System daemon for reading current clocks of AMD Radeon cards"; |     description = "System daemon for reading current clocks of AMD Radeon cards"; | ||||||
|     homepage = "https://github.com/marazmista/radeon-profile-daemon"; |     homepage = "https://github.com/marazmista/radeon-profile-daemon"; | ||||||
|     license = licenses.gpl2Plus; |     license = licenses.gpl2Plus; | ||||||
|   | |||||||
| @@ -1,6 +1,7 @@ | |||||||
| { stdenv | { stdenv | ||||||
| , lib |  | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
|  | , makeWrapper | ||||||
|  | 
 | ||||||
| , curl | , curl | ||||||
| , gnumake | , gnumake | ||||||
| , gnutls | , gnutls | ||||||
| @@ -39,7 +40,7 @@ stdenv.mkDerivation rec { | |||||||
|       --replace /usr/bin/samrewritten $out/bin/samrewritten |       --replace /usr/bin/samrewritten $out/bin/samrewritten | ||||||
|   ''; |   ''; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = with stdenv.lib; { | ||||||
|     description = "Steam Achievement Manager For Linux"; |     description = "Steam Achievement Manager For Linux"; | ||||||
|     homepage = "https://github.com/PaulCombal/SamRewritten"; |     homepage = "https://github.com/PaulCombal/SamRewritten"; | ||||||
|     license = licenses.gpl3; |     license = licenses.gpl3; | ||||||
| @@ -1,52 +1,42 @@ | |||||||
| { lib | { stdenv | ||||||
| , fetchFromGitHub | , fetchFromGitHub | ||||||
| 
 | 
 | ||||||
| , python3Packages | , python2Packages | ||||||
| , lame |  | ||||||
| 
 | 
 | ||||||
| , aacSupport ? false | , aacSupport ? false, faac | ||||||
| , faac | , alacSupport ? false, libav | ||||||
| , alacSupport ? false | , flacSupport ? false, flac | ||||||
| , libav | , m4aSupport ? false, mp4Support ? false, fdk-aac-encoder | ||||||
| , flacSupport ? false | , oggSupport ? false, vorbisTools | ||||||
| , flac | , opusSupport ? false, opusTools | ||||||
| , m4aSupport ? false |  | ||||||
| , mp4Support ? false |  | ||||||
| , fdk-aac-encoder |  | ||||||
| , oggSupport ? false |  | ||||||
| , vorbisTools |  | ||||||
| , opusSupport ? false |  | ||||||
| , opusTools |  | ||||||
| }: | }: | ||||||
| 
 | 
 | ||||||
| assert aacSupport -> faac.meta.available; | assert aacSupport               -> faac.meta.available; | ||||||
| assert alacSupport -> libav.meta.available; | assert alacSupport              -> libav.meta.available; | ||||||
| assert flacSupport -> flac.meta.available; | assert flacSupport              -> flac.meta.available; | ||||||
| assert m4aSupport || mp4Support -> fdk-aac-encoder.meta.available; | assert m4aSupport || mp4Support -> fdk-aac-encoder.meta.available; | ||||||
| assert oggSupport -> vorbisTools.meta.available; | assert oggSupport               -> vorbisTools.meta.available; | ||||||
| assert opusSupport -> opusTools.meta.available; | assert opusSupport              -> opusTools.meta.available; | ||||||
| 
 | 
 | ||||||
| python3Packages.buildPythonApplication rec { | python2Packages.buildPythonApplication rec { | ||||||
|   pname = "spotify-ripper"; |   pname = "spotify-ripper"; | ||||||
|   version = "20210724.5bfd3f7"; |   version = "20161231.gd046419"; | ||||||
| 
 | 
 | ||||||
|   src = fetchFromGitHub { |   src = fetchFromGitHub { | ||||||
|     owner = "ast261"; |     owner = "hbashton"; | ||||||
|     repo = pname; |     repo = pname; | ||||||
|     rev = "5bfd3f7a52f2767b433fd315145409837a3c33f0"; |     rev = "d0464193dead7bd3ac7580e98bde86a0f323acae"; | ||||||
|     sha256 = "sha256-LLunGzs9Mg4S00Su260b+M5w/XwS+kICl/YXQdR/cPI="; |     sha256 = "003d6br20f1cf4qvmpl62bk0k4h4v66ib76wn36c23bnh9x5q806"; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   propagatedBuildInputs = (with python3Packages; [ |   propagatedBuildInputs = (with python2Packages; [ | ||||||
|     colorama |     colorama | ||||||
|     mutagen |     mutagen | ||||||
|     pyspotify |     pyspotify | ||||||
|     requests |     requests | ||||||
|     schedule |     schedule | ||||||
|     setuptools |     setuptools | ||||||
|     spotipy |  | ||||||
|   ]) ++ [ |   ]) ++ [ | ||||||
|     lame |  | ||||||
|     (if flacSupport then flac else null) |     (if flacSupport then flac else null) | ||||||
|     (if alacSupport then libav else null) |     (if alacSupport then libav else null) | ||||||
|     (if aacSupport then faac else null) |     (if aacSupport then faac else null) | ||||||
| @@ -58,7 +48,7 @@ python3Packages.buildPythonApplication rec { | |||||||
|   # Remove impure executables. |   # Remove impure executables. | ||||||
|   patches = [ ./fix-setup.patch ]; |   patches = [ ./fix-setup.patch ]; | ||||||
| 
 | 
 | ||||||
|   meta = with lib; { |   meta = { | ||||||
|     description = "Rip Spotify URIs to audio files, including ID3 tags and cover art"; |     description = "Rip Spotify URIs to audio files, including ID3 tags and cover art"; | ||||||
|     longDescription = '' |     longDescription = '' | ||||||
|       Spotify-ripper is a small ripper script for Spotify that rips Spotify URIs |       Spotify-ripper is a small ripper script for Spotify that rips Spotify URIs | ||||||
| @@ -68,6 +58,6 @@ python3Packages.buildPythonApplication rec { | |||||||
|     ''; |     ''; | ||||||
|     homepage = "https://github.com/hbashton/spotify-ripper"; |     homepage = "https://github.com/hbashton/spotify-ripper"; | ||||||
|     # spotify-ripper itself is MIT, but the upstream libspotify is unfree. |     # spotify-ripper itself is MIT, but the upstream libspotify is unfree. | ||||||
|     license = licenses.unfree; |     license = stdenv.lib.licenses.unfree; | ||||||
|   }; |   }; | ||||||
| } | } | ||||||
| @@ -2,7 +2,7 @@ diff --git a/setup.py b/setup.py | |||||||
| index a800b3b..8967921 100755
 | index a800b3b..8967921 100755
 | ||||||
| --- a/setup.py
 | --- a/setup.py
 | ||||||
| +++ b/setup.py
 | +++ b/setup.py
 | ||||||
| @@ -33,14 +33,13 @@ setup(
 | @@ -22,14 +22,13 @@ setup(
 | ||||||
|      name='spotify-ripper', |      name='spotify-ripper', | ||||||
|      version='2.9.1', |      version='2.9.1', | ||||||
|      packages=find_packages(exclude=["tests"]), |      packages=find_packages(exclude=["tests"]), | ||||||
| @@ -18,7 +18,11 @@ index a800b3b..8967921 100755 | |||||||
|          ], |          ], | ||||||
|      }, |      }, | ||||||
|   |   | ||||||
| @@ -121,3 +121,2 @@ setup(
 | @@ -67,7 +66,5 @@ setup(
 | ||||||
|      return True |          'Programming Language :: Python :: 3', | ||||||
|  |          'Programming Language :: Python :: 3.4', | ||||||
|  |      ], | ||||||
|  | -    long_description=_read('README.rst'),
 | ||||||
|  |  ) | ||||||
|   |   | ||||||
| -create_default_dir()
 | -create_default_dir()
 | ||||||
| @@ -1,14 +1,61 @@ | |||||||
| { pkgs }: | { pkgs }: | ||||||
|  |  | ||||||
| rec { | rec { | ||||||
|  |   # Alacritty with the unmerged ligature patches applied. | ||||||
|  |   alacritty-ligatures = pkgs.alacritty.overrideAttrs (oldAttrs: rec { | ||||||
|  |     pname = "${oldAttrs.pname}-ligatures"; | ||||||
|  |     version = "0.7.1.20210107.gada2680"; | ||||||
|  |  | ||||||
|  |     src = pkgs.fetchFromGitHub { | ||||||
|  |       owner = "zenixls2"; | ||||||
|  |       repo = "alacritty"; | ||||||
|  |       fetchSubmodules = true; | ||||||
|  |       rev = "ada2680e79a8f53cd350263c8cc91d2e2a264d81"; | ||||||
|  |       sha256 = "0c0k1ib1dl35731zyjb32apyn28xc63mhbwsig5mz3hnkyk5nisr"; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|  |     cargoDeps = oldAttrs.cargoDeps.overrideAttrs (pkgs.lib.const { | ||||||
|  |       name = "${pname}-${version}-vendor.tar.gz"; | ||||||
|  |       inherit src; | ||||||
|  |       outputHash = "1d1yz4xmal0f3c0pcn59lxfh5a3532nv7dv7s95svvi8qsvnk9gv"; | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     ligatureInputs = [ | ||||||
|  |       pkgs.fontconfig | ||||||
|  |       pkgs.freetype | ||||||
|  |       pkgs.libglvnd | ||||||
|  |       pkgs.stdenv.cc.cc.lib | ||||||
|  |       pkgs.xlibs.libxcb | ||||||
|  |     ]; | ||||||
|  |  | ||||||
|  |     buildInputs = (oldAttrs.buildInputs or []) ++ ligatureInputs; | ||||||
|  |  | ||||||
|  |     # HACK: One of the ligature libraries required the C++ stdlib at runtime, | ||||||
|  |     # and I can't work out a better way to push it to the RPATH. | ||||||
|  |     postInstall = pkgs.lib.optional (!pkgs.stdenv.isDarwin) '' | ||||||
|  |       patchelf \ | ||||||
|  |         --set-rpath ${pkgs.lib.makeLibraryPath ligatureInputs}:"$(patchelf --show-rpath $out/bin/alacritty)" \ | ||||||
|  |         $out/bin/alacritty | ||||||
|  |     ''; | ||||||
|  |  | ||||||
|  |     meta = oldAttrs.meta // { | ||||||
|  |       description = "Alacritty with ligature patch applied"; | ||||||
|  |       homepage = "https://github.com/zenixls2/alacritty/tree/ligature"; | ||||||
|  |     }; | ||||||
|  |   }); | ||||||
|  |  | ||||||
|  |   amdgpu-fan = pkgs.callPackage ../tools/misc/amdgpu-fan { }; | ||||||
|  |  | ||||||
|  |   cardboard = pkgs.callPackage ../applications/window-managers/cardboard { }; | ||||||
|  |  | ||||||
|   goModules = pkgs.recurseIntoAttrs rec { |   goModules = pkgs.recurseIntoAttrs rec { | ||||||
|     qt = pkgs.libsForQt5.callPackage ../development/go-modules/qt { }; |     qt = pkgs.libsForQt512.callPackage ../development/go-modules/qt { }; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   # A functional Jetbrains IDE-with-plugins package set. |   # A functional Jetbrains IDE-with-plugins package set. | ||||||
|   jetbrains = pkgs.dontRecurseIntoAttrs rec { |   jetbrains = pkgs.dontRecurseIntoAttrs rec { | ||||||
|     jetbrainsPluginsFor = variant: import ../top-level/jetbrains-plugins.nix { |     jetbrainsPluginsFor = variant: import ../top-level/jetbrains-plugins.nix { | ||||||
|       inherit (pkgs) lib newScope stdenv fetchzip; |       inherit (pkgs) lib newScope stdenv fetchzip makeWrapper runCommand; | ||||||
|       inherit variant; |       inherit variant; | ||||||
|     }; |     }; | ||||||
|  |  | ||||||
| @@ -25,11 +72,15 @@ rec { | |||||||
|     ideaUltimateWithPlugins = ideaUltimatePlugins.jetbrainsWithPlugins; |     ideaUltimateWithPlugins = ideaUltimatePlugins.jetbrainsWithPlugins; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|  |   libhl = pkgs.callPackage ../development/libraries/libhl { }; | ||||||
|  |  | ||||||
|   mopidy-subidy = pkgs.callPackage ../applications/audio/mopidy/subidy.nix { |   mopidy-subidy = pkgs.callPackage ../applications/audio/mopidy/subidy.nix { | ||||||
|     python3Packages = pkgs.python3Packages // python3Packages; |     python3Packages = pkgs.python3Packages // python3Packages; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   picom-animations = pkgs.picom.overrideAttrs (_oldAttrs: { |   pam_gnupg = pkgs.callPackage ../os-specific/linux/pam_gnupg { }; | ||||||
|  |  | ||||||
|  |   picom-animations = pkgs.picom.overrideAttrs (oldAttrs: { | ||||||
|     pname = "picom-animations"; |     pname = "picom-animations"; | ||||||
|     src = pkgs.fetchFromGitHub { |     src = pkgs.fetchFromGitHub { | ||||||
|       owner = "jonaburg"; |       owner = "jonaburg"; | ||||||
| @@ -45,17 +96,74 @@ rec { | |||||||
|     patches = (oldAttrs.patches or [ ]) ++ [ ../applications/misc/polybar/9button.patch ]; |     patches = (oldAttrs.patches or [ ]) ++ [ ../applications/misc/polybar/9button.patch ]; | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
|  |   psst = pkgs.callPackage ../applications/audio/psst { }; | ||||||
|  |  | ||||||
|  |   python2Packages = | ||||||
|  |     let | ||||||
|  |       fixVersion = | ||||||
|  |         { package | ||||||
|  |         , version | ||||||
|  |         , sha256 | ||||||
|  |         , extra ? (oldAttrs: { }) | ||||||
|  |         }: package.overrideAttrs (oldAttrs: rec { | ||||||
|  |           inherit version; | ||||||
|  |           src = pkgs.python2Packages.fetchPypi { | ||||||
|  |             inherit (oldAttrs) pname; | ||||||
|  |             inherit version sha256; | ||||||
|  |           }; | ||||||
|  |         } // extra oldAttrs); | ||||||
|  |     in | ||||||
|  |     pkgs.recurseIntoAttrs rec { | ||||||
|  |       colorama_0_3_3 = fixVersion { | ||||||
|  |         package = pkgs.python2Packages.colorama; | ||||||
|  |         version = "0.3.3"; | ||||||
|  |         sha256 = "1716z9pq1r5ys3nkg7wdrb3h2f9rmd0zdxpxzmx3bgwgf6xg48gb"; | ||||||
|  |       }; | ||||||
|  |  | ||||||
|  |       mutagen_1_30 = fixVersion { | ||||||
|  |         package = pkgs.python2Packages.mutagen; | ||||||
|  |         version = "1.30"; | ||||||
|  |         sha256 = "0kv2gjnzbj1w0bswmxm7wi05x6ypi7jk52s0lb8gw8s459j41gyd"; | ||||||
|  |         extra = oldAttrs: { | ||||||
|  |           patches = [ ]; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |  | ||||||
|  |       pyspotify_2_0_5 = fixVersion { | ||||||
|  |         package = pkgs.python2Packages.pyspotify; | ||||||
|  |         version = "2.0.5"; | ||||||
|  |         sha256 = "0y16c024rrvbvfdqj1n0k4b25b1nbza3i7kspg5b0ci2src1rm7v"; | ||||||
|  |       }; | ||||||
|  |  | ||||||
|  |       overlay = { | ||||||
|  |         colorama = colorama_0_3_3; | ||||||
|  |         mutagen = mutagen_1_30; | ||||||
|  |         pyspotify = pyspotify_2_0_5; | ||||||
|  |       }; | ||||||
|  |     }; | ||||||
|  |  | ||||||
|   python3Packages = pkgs.recurseIntoAttrs { |   python3Packages = pkgs.recurseIntoAttrs { | ||||||
|     py-sonic = pkgs.python3.pkgs.callPackage ../development/python-modules/py-sonic { }; |     py-sonic = pkgs.python3.pkgs.callPackage ../development/python-modules/py-sonic { }; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   # The one in Nixpkgs still extracts the pre-built Debian package instead |   # The one in Nixpkgs still extracts the pre-built Debian package instead | ||||||
|   # of building from source. |   # of building from source. | ||||||
|   protonmailBridgePackages = pkgs.libsForQt5.callPackage ../applications/networking/protonmail-bridge { |   protonmailBridgePackages = pkgs.libsForQt512.callPackage ../applications/networking/protonmail-bridge { | ||||||
|     inherit goModules; |     inherit goModules; | ||||||
|   }; |   }; | ||||||
|   protonmail-bridge = protonmailBridgePackages.protonmail-bridge; |   protonmail-bridge = protonmailBridgePackages.protonmail-bridge; | ||||||
|   protonmail-bridge-headless = protonmailBridgePackages.protonmail-bridge-headless; |   protonmail-bridge-headless = protonmailBridgePackages.protonmail-bridge-headless; | ||||||
|  |  | ||||||
|   radeon-profile-daemon = pkgs.libsForQt5.callPackage ../tools/misc/radeon-profile-daemon { }; |   radeon-profile-daemon = pkgs.libsForQt5.callPackage ../tools/misc/radeon-profile-daemon { }; | ||||||
|  |  | ||||||
|  |   samrewritten = pkgs.callPackage ../tools/misc/samrewritten { }; | ||||||
|  |  | ||||||
|  |   spotify-ripper = pkgs.callPackage ../tools/misc/spotify-ripper { | ||||||
|  |     # NOTE: Not available in 20.03. Specifying it this way lets me cheat the | ||||||
|  |     # build auto-failing on 20.03 because of the attribute not existing. | ||||||
|  |     inherit (pkgs) fdk-aac-encoder; | ||||||
|  |     python2Packages = pkgs.python2Packages // python2Packages.overlay; | ||||||
|  |   }; | ||||||
|  |  | ||||||
|  |   zsh-z = pkgs.callPackage ../shells/zsh/zsh-z { }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,56 +0,0 @@ | |||||||
| # This file turns the pkgs/by-name directory (see its README.md for more info) |  | ||||||
| # into an overlay that adds all the defined packages. |  | ||||||
| # |  | ||||||
| # No validity checks are done here, instead this file is optimised for |  | ||||||
| # performance, and validity checks are done by CI on PRs. |  | ||||||
| # |  | ||||||
| # This file is based on Nixpkgs' `pkgs/top-level/by-name-overlay.nix` in order |  | ||||||
| # to utilise the same infrastructure and layout, with some adjustments to fit |  | ||||||
| # our derivative project. |  | ||||||
|  |  | ||||||
| { lib |  | ||||||
| , pkgs |  | ||||||
| }: |  | ||||||
|  |  | ||||||
| # Type: Path -> Overlay |  | ||||||
| baseDirectory: |  | ||||||
| let |  | ||||||
|   inherit (builtins) |  | ||||||
|     readDir |  | ||||||
|     ; |  | ||||||
|  |  | ||||||
|   inherit (lib.attrsets) |  | ||||||
|     mapAttrs |  | ||||||
|     mapAttrsToList |  | ||||||
|     mergeAttrsList |  | ||||||
|     ; |  | ||||||
|  |  | ||||||
|   # Package files for a single shard |  | ||||||
|   # Type: String -> String -> AttrsOf Path |  | ||||||
|   namesForShard = shard: type: |  | ||||||
|     if type != "directory" then |  | ||||||
|     # Ignore all non-directories. Technically only README.md is allowed as a file in the base directory, so we could alternatively: |  | ||||||
|     # - Assume that README.md is the only file and change the condition to `shard == "README.md"` for a minor performance improvement. |  | ||||||
|     #   This would however cause very poor error messages if there's other files. |  | ||||||
|     # - Ensure that README.md is the only file, throwing a better error message if that's not the case. |  | ||||||
|     #   However this would make for a poor code architecture, because one type of error would have to be duplicated in the validity checks and here. |  | ||||||
|     # Additionally in either of those alternatives, we would have to duplicate the hardcoding of "README.md" |  | ||||||
|       { } |  | ||||||
|     else |  | ||||||
|       mapAttrs |  | ||||||
|         (name: _: baseDirectory + "/${shard}/${name}/package.nix") |  | ||||||
|         (readDir (baseDirectory + "/${shard}")); |  | ||||||
|  |  | ||||||
|   # The attribute set mapping names to the package files defining them |  | ||||||
|   # This is defined up here in order to allow reuse of the value (it's kind of expensive to compute) |  | ||||||
|   # if the overlay has to be applied multiple times |  | ||||||
|   packageFiles = mergeAttrsList (mapAttrsToList namesForShard (readDir baseDirectory)); |  | ||||||
| in |  | ||||||
| # TODO: Consider optimising this using `builtins.deepSeq packageFiles`, |  | ||||||
|   # which could free up the above thunks and reduce GC times. |  | ||||||
|   # Currently this would be hard to measure until we have more packages |  | ||||||
|   # and ideally https://github.com/NixOS/nix/pull/8895 |  | ||||||
| _self: _super: |  | ||||||
| mapAttrs |  | ||||||
|   (_name: file: pkgs.callPackage file { }) |  | ||||||
|   packageFiles |  | ||||||
| @@ -1,19 +0,0 @@ | |||||||
| # Composes the packages collection. |  | ||||||
|  |  | ||||||
| { |  | ||||||
|   # The system packages will be build and used on. |  | ||||||
|   localSystem |  | ||||||
|   # Nixpkgs |  | ||||||
| , pkgs |  | ||||||
|   # Nixpkgs lib |  | ||||||
| , lib ? pkgs.lib |  | ||||||
| }: |  | ||||||
| let |  | ||||||
|   allPackages = import ./stage.nix { |  | ||||||
|     inherit lib pkgs; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   available = lib.filterAttrs |  | ||||||
|     (_: drv: builtins.elem localSystem (drv.meta.platforms or [ ])); |  | ||||||
| in |  | ||||||
| available allPackages |  | ||||||
| @@ -2,34 +2,28 @@ | |||||||
| , newScope | , newScope | ||||||
| , stdenv | , stdenv | ||||||
| , fetchzip | , fetchzip | ||||||
|  | , makeWrapper | ||||||
|  | , runCommand | ||||||
|  |  | ||||||
| , variant | , variant | ||||||
| }: | }: | ||||||
|  |  | ||||||
| let | let | ||||||
|  |  | ||||||
|   mkJetbrainsPlugins = import ../applications/editors/jetbrains/common-plugins.nix { |  | ||||||
|     inherit lib stdenv fetchzip; |  | ||||||
|   }; |  | ||||||
|  |  | ||||||
|   mkIdeaPlugins = import ../applications/editors/jetbrains/idea-plugins.nix { |   mkIdeaPlugins = import ../applications/editors/jetbrains/idea-plugins.nix { | ||||||
|     inherit lib stdenv fetchzip; |     inherit lib stdenv fetchzip; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   jetbrainsWithPlugins = import ../applications/editors/jetbrains/wrapper.nix { |   jetbrainsWithPlugins = import ../applications/editors/jetbrains/wrapper.nix { | ||||||
|     inherit lib; |     inherit lib makeWrapper runCommand; | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
| in | in lib.makeScope newScope (self: lib.makeOverridable ({ | ||||||
| lib.makeScope newScope (self: lib.makeOverridable |   ideaPlugins ? mkIdeaPlugins self | ||||||
|   ({ jetbrainsPlugins ? mkJetbrainsPlugins self | }: ({ } | ||||||
|    , ideaPlugins ? mkIdeaPlugins self |   // ideaPlugins // { inherit ideaPlugins; } | ||||||
|    }: ({ } |   // { | ||||||
|     // jetbrainsPlugins // { inherit jetbrainsPlugins; } |  | ||||||
|     // ideaPlugins // { inherit ideaPlugins; } |  | ||||||
|     // { |  | ||||||
|     inherit variant; |     inherit variant; | ||||||
|     jetbrainsWithPlugins = jetbrainsWithPlugins self variant; |     jetbrainsWithPlugins = jetbrainsWithPlugins self variant; | ||||||
|   }) |   }) | ||||||
|   ) | ) { }) | ||||||
| { }) |  | ||||||
|   | |||||||
| @@ -1,24 +0,0 @@ | |||||||
| # Composes a single bootstrapping of the package collection. The result is a set |  | ||||||
| # of all the packages for some particular platform. |  | ||||||
|  |  | ||||||
| { lib |  | ||||||
| , pkgs |  | ||||||
| }: |  | ||||||
| let |  | ||||||
|  |  | ||||||
|   # An overlay to auto-call packages in .../by-name. |  | ||||||
|   autoCalledPackages = |  | ||||||
|     import ./by-name-overlay.nix { inherit pkgs lib; } ../by-name; |  | ||||||
|  |  | ||||||
|   allPackages = _self: _super: |  | ||||||
|     import ./all-packages.nix { inherit pkgs; }; |  | ||||||
|  |  | ||||||
|   toFix = (lib.flip lib.composeManyExtensions) (_self: { }) [ |  | ||||||
|     autoCalledPackages |  | ||||||
|     allPackages |  | ||||||
|   ]; |  | ||||||
|  |  | ||||||
| in |  | ||||||
|  |  | ||||||
| # Return the complete set of packages. |  | ||||||
| lib.fix toFix |  | ||||||
		Reference in New Issue
	
	Block a user