shells (artiq-fast): change artiqpkgs, vivado to arguments #76

Closed
drewrisinger wants to merge 1 commits from drewrisinger/nix-scripts:feature/shell-artiqpkgs-args into master
Contributor

This allows overriding the artiqpkgs used downstream.
The issue is that previously artiqpkgs required <artiqSrc> to be defined,
and overriding that required setting paths, added complexity, and possible impurities.

This solution allows reuse of the shell[-dev], from a given version of
ARTIQ, without necessarily specifying source or a local source repo.

Example using previous override (which still required <artiqSrc> to be set):

{pkgs ? import <nixpkgs> { }
, artiqpkgs ? import <artiq-full> { }
}:
let
 mlabs-nix-scripts = builtins.fetchGit {
    url="https://git.m-labs.hk/M-Labs/nix-scripts.git";
    ref="master"; # impure, but fine for our purposes
  };
  dev-artiq-shell = import "${mlabs-nix-scripts}/artiq-fast/shell-dev.nix" {};  # Depends on <artiqSrc> to import, can't remove artiqSrc dependency easily
  # Force shell to use Release (i.e. MLabs Nix Channel) ARTIQ build, instead of passing all source/arguments ourselves.
  dev-shell-with-release-artiq = dev-artiq-shell.overrideAttrs (oldAttrs: rec { artiqpkgs = artiqpkgs ; });
in
  ...

New example (tested):

{ pkgs ? import <nixpkgs> { }
, artiqpkgs ? import <artiq-full> { }
}:
let
  mlabs-nix-scripts = ...; # this PR
  # Force shell to use Release (i.e. MLabs Nix Channel) ARTIQ build, instead of passing all source/arguments ourselves.
  dev-artiq-shell = import "${mlabs-nix-scripts}/artiq-fast/shell-dev.nix" { inherit artiqpkgs; };
in
  ...
This allows overriding the artiqpkgs used downstream. The issue is that previously artiqpkgs required ``<artiqSrc>`` to be defined, and overriding that required setting paths, added complexity, and possible impurities. This solution allows reuse of the shell[-dev], from a given version of ARTIQ, without necessarily specifying source or a local source repo. Example using previous override (which still required ``<artiqSrc>`` to be set): ```nix {pkgs ? import <nixpkgs> { } , artiqpkgs ? import <artiq-full> { } }: let mlabs-nix-scripts = builtins.fetchGit { url="https://git.m-labs.hk/M-Labs/nix-scripts.git"; ref="master"; # impure, but fine for our purposes }; dev-artiq-shell = import "${mlabs-nix-scripts}/artiq-fast/shell-dev.nix" {}; # Depends on <artiqSrc> to import, can't remove artiqSrc dependency easily # Force shell to use Release (i.e. MLabs Nix Channel) ARTIQ build, instead of passing all source/arguments ourselves. dev-shell-with-release-artiq = dev-artiq-shell.overrideAttrs (oldAttrs: rec { artiqpkgs = artiqpkgs ; }); in ... ``` New example (tested): ```nix { pkgs ? import <nixpkgs> { } , artiqpkgs ? import <artiq-full> { } }: let mlabs-nix-scripts = ...; # this PR # Force shell to use Release (i.e. MLabs Nix Channel) ARTIQ build, instead of passing all source/arguments ourselves. dev-artiq-shell = import "${mlabs-nix-scripts}/artiq-fast/shell-dev.nix" { inherit artiqpkgs; }; in ... ```
drewrisinger added 1 commit 2022-01-10 22:33:25 +08:00
47960f539b shells (artiq-fast): change artiqpkgs, vivado to arguments
This allows overriding the artiqpkgs used downstream.
The issue is that previously artiqpkgs required <artiqSrc> to be defined,
and overriding that required setting paths, added complexity, and possible impurities.

This solution allows reuse of the shell[-dev], from a given version of
ARTIQ, without necessarily specifying source or a local source repo.
Owner

Nix flakes (in 7) should provide a better solution to these problems.

Nix flakes (in 7) should provide a better solution to these problems.
Author
Contributor

Fair, but any objection to merging this anyways? It's an improvement to the stable (current) release.

Fair, but any objection to merging this anyways? It's an improvement to the stable (current) release.
sb10q closed this pull request 2024-06-12 16:16:11 +08:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: M-Labs/nix-scripts#76
No description provided.