Compare commits
	
		
			7 Commits
		
	
	
		
			6be9b3fd57
			...
			59f910fe3f
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						
						
							
						
						59f910fe3f
	
				 | 
					
					
						|||
| 
						
						
							
						
						93b6195542
	
				 | 
					
					
						|||
| 
						 | 
					029f6e7795 | ||
| 
						 | 
					19eb6aefbe | ||
| 
						 | 
					26b35fa847 | ||
| 
						 | 
					ec92a006c3 | ||
| 
						 | 
					622b3cbdfe | 
							
								
								
									
										8
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							@@ -14,8 +14,8 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: Checkout repository
 | 
					      - name: Checkout repository
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - uses: cachix/install-nix-action@v22
 | 
					      - uses: cachix/install-nix-action@v23
 | 
				
			||||||
      - name: Check ${{ matrix.check }}
 | 
					      - name: Check ${{ matrix.check }}
 | 
				
			||||||
        # Depends on nixos/nix#7759 to simply `nix flake check`
 | 
					        # Depends on nixos/nix#7759 to simply `nix flake check`
 | 
				
			||||||
        run: nix run .#checks.$(nix eval --raw --impure --expr "builtins.currentSystem").${{ matrix.check }}
 | 
					        run: nix run .#checks.$(nix eval --raw --impure --expr "builtins.currentSystem").${{ matrix.check }}
 | 
				
			||||||
@@ -43,9 +43,9 @@ jobs:
 | 
				
			|||||||
    runs-on: ubuntu-latest
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
    - name: Checkout repository
 | 
					    - name: Checkout repository
 | 
				
			||||||
      uses: actions/checkout@v3
 | 
					      uses: actions/checkout@v4
 | 
				
			||||||
    - name: Install nix
 | 
					    - name: Install nix
 | 
				
			||||||
      uses: cachix/install-nix-action@v22
 | 
					      uses: cachix/install-nix-action@v23
 | 
				
			||||||
    - name: Show nixpkgs version
 | 
					    - name: Show nixpkgs version
 | 
				
			||||||
      run: nix eval --impure --expr '(import ./flake-compat.nix { src = ./.; }).lib.version'
 | 
					      run: nix eval --impure --expr '(import ./flake-compat.nix { src = ./.; }).lib.version'
 | 
				
			||||||
    - name: Setup cachix
 | 
					    - name: Setup cachix
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										4
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/update.yml
									
									
									
									
										vendored
									
									
								
							@@ -11,8 +11,8 @@ jobs:
 | 
				
			|||||||
      fail-fast: false
 | 
					      fail-fast: false
 | 
				
			||||||
    steps:
 | 
					    steps:
 | 
				
			||||||
      - name: Checkout repository
 | 
					      - name: Checkout repository
 | 
				
			||||||
        uses: actions/checkout@v3
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
      - uses: cachix/install-nix-action@v22
 | 
					      - uses: cachix/install-nix-action@v23
 | 
				
			||||||
        with:
 | 
					        with:
 | 
				
			||||||
          extra_nix_config: |
 | 
					          extra_nix_config: |
 | 
				
			||||||
            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
 | 
					            access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,15 +0,0 @@
 | 
				
			|||||||
{ pkgs
 | 
					 | 
				
			||||||
, lib ? pkgs.lib
 | 
					 | 
				
			||||||
, unitDir ? "unit"
 | 
					 | 
				
			||||||
, packageFun ? "package.nix"
 | 
					 | 
				
			||||||
, root ? "${./pkgs}/${unitDir}"
 | 
					 | 
				
			||||||
}:
 | 
					 | 
				
			||||||
let
 | 
					 | 
				
			||||||
  shards = lib.attrNames (builtins.readDir root);
 | 
					 | 
				
			||||||
  namesForShard = shard: lib.mapAttrs'
 | 
					 | 
				
			||||||
    (name: _: { inherit name; value = root + "/${shard}/${name}"; })
 | 
					 | 
				
			||||||
    (builtins.readDir (root + "/${shard}"));
 | 
					 | 
				
			||||||
  namesToPath = lib.foldl' lib.recursiveUpdate { } (map namesForShard shards);
 | 
					 | 
				
			||||||
  units = lib.mapAttrs (_: path: pkgs.callPackage (path + "/${packageFun}") { }) namesToPath;
 | 
					 | 
				
			||||||
in
 | 
					 | 
				
			||||||
units
 | 
					 | 
				
			||||||
@@ -8,10 +8,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
{ pkgs ? import <nixpkgs> { } }:
 | 
					{ pkgs ? import <nixpkgs> { } }:
 | 
				
			||||||
let
 | 
					let
 | 
				
			||||||
  legacy = import ./pkgs/top-level/all-packages.nix { inherit pkgs; };
 | 
					  system = pkgs.stdenv.hostPlatform.system;
 | 
				
			||||||
  units = import ./callUnitRoot.nix { inherit pkgs; root = ./pkgs/unit; };
 | 
					  packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; };
 | 
				
			||||||
in
 | 
					in
 | 
				
			||||||
legacy // units // {
 | 
					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
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										12
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										12
									
								
								flake.lock
									
									
									
										generated
									
									
									
								
							@@ -5,11 +5,11 @@
 | 
				
			|||||||
        "systems": "systems"
 | 
					        "systems": "systems"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1692799911,
 | 
					        "lastModified": 1694529238,
 | 
				
			||||||
        "narHash": "sha256-3eihraek4qL744EvQXsK1Ha6C3CR7nnT8X2qWap4RNk=",
 | 
					        "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
 | 
				
			||||||
        "owner": "numtide",
 | 
					        "owner": "numtide",
 | 
				
			||||||
        "repo": "flake-utils",
 | 
					        "repo": "flake-utils",
 | 
				
			||||||
        "rev": "f9e7cf818399d17d347f847525c5a5a8032e4e44",
 | 
					        "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
@@ -20,11 +20,11 @@
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    "nixpkgs": {
 | 
					    "nixpkgs": {
 | 
				
			||||||
      "locked": {
 | 
					      "locked": {
 | 
				
			||||||
        "lastModified": 1693145325,
 | 
					        "lastModified": 1694948089,
 | 
				
			||||||
        "narHash": "sha256-Gat9xskErH1zOcLjYMhSDBo0JTBZKfGS0xJlIRnj6Rc=",
 | 
					        "narHash": "sha256-d2B282GmQ9o8klc22/Rbbbj6r99EnELQpOQjWMyv0rU=",
 | 
				
			||||||
        "owner": "NixOS",
 | 
					        "owner": "NixOS",
 | 
				
			||||||
        "repo": "nixpkgs",
 | 
					        "repo": "nixpkgs",
 | 
				
			||||||
        "rev": "cddebdb60de376c1bdb7a4e6ee3d98355453fe56",
 | 
					        "rev": "5148520bfab61f99fd25fb9ff7bfbb50dad3c9db",
 | 
				
			||||||
        "type": "github"
 | 
					        "type": "github"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "original": {
 | 
					      "original": {
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								flake.nix
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								flake.nix
									
									
									
									
									
								
							@@ -15,16 +15,7 @@
 | 
				
			|||||||
          pkgs = import nixpkgs { inherit system; };
 | 
					          pkgs = import nixpkgs { inherit system; };
 | 
				
			||||||
        in
 | 
					        in
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
          # nixos/rfcs#140
 | 
					          packages = import ./pkgs/top-level { localSystem = system; inherit pkgs; };
 | 
				
			||||||
          # Only produces the package set of the proposed functionality.
 | 
					 | 
				
			||||||
          # Unstable names are variables.
 | 
					 | 
				
			||||||
          packages =
 | 
					 | 
				
			||||||
            let
 | 
					 | 
				
			||||||
              legacyPackages = import ./pkgs/top-level/all-packages.nix { inherit pkgs; };
 | 
					 | 
				
			||||||
              unitPackages = import ./callUnitRoot.nix { inherit pkgs; };
 | 
					 | 
				
			||||||
              onlyAvailable = lib.filterAttrs (_: drv: builtins.elem system (drv.meta.platforms or [ ]));
 | 
					 | 
				
			||||||
            in
 | 
					 | 
				
			||||||
            onlyAvailable (legacyPackages // unitPackages);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
          checks = {
 | 
					          checks = {
 | 
				
			||||||
            nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" ''
 | 
					            nixpkgs-fmt = pkgs.writeShellScriptBin "nixpkgs-fmt-check" ''
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										94
									
								
								pkgs/by-name/cu/cura5/package.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										94
									
								
								pkgs/by-name/cu/cura5/package.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,94 @@
 | 
				
			|||||||
 | 
					{ 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" ];
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										56
									
								
								pkgs/top-level/by-name-overlay.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								pkgs/top-level/by-name-overlay.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
				
			|||||||
 | 
					# 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
 | 
				
			||||||
							
								
								
									
										19
									
								
								pkgs/top-level/default.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								pkgs/top-level/default.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
				
			|||||||
 | 
					# 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
 | 
				
			||||||
							
								
								
									
										24
									
								
								pkgs/top-level/stage.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								pkgs/top-level/stage.nix
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					# 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
 | 
				
			||||||
@@ -1,39 +0,0 @@
 | 
				
			|||||||
{ stdenv
 | 
					 | 
				
			||||||
, fetchurl
 | 
					 | 
				
			||||||
, writeScriptBin
 | 
					 | 
				
			||||||
, appimageTools
 | 
					 | 
				
			||||||
}:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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
 | 
					 | 
				
			||||||
script // {
 | 
					 | 
				
			||||||
  inherit name pname version;
 | 
					 | 
				
			||||||
  meta.platforms = [ "x86_64-linux" ];
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user