Skip to content
This repository was archived by the owner on Oct 28, 2025. It is now read-only.

Conversation

@ElvishJerricco
Copy link

Porting NixOS#49 with some edits to avoid re-indentation and to fix a null reference bug.

This allows the user of this non-flake to have similar functionality to follows.

Example (default.nix):

nix-repl> (import ./.).default
«derivation /nix/store/axgvq22kyb8ymchzq1mjayms4jdl6ni6-ledc-0.1.0.drv»

nix-repl> ((import ./.).overrideInputs { nixpkgs = <nixpkgs>; }).default
«derivation /nix/store/r8zw693hpg91yx6f57hyx1gk4zdiq2lm-ledc-0.1.0.drv»

This allows the user of this non-flake to have similar functionality
to `follows`.

Example (default.nix):

    nix-repl> (import ./.).default
    «derivation /nix/store/axgvq22kyb8ymchzq1mjayms4jdl6ni6-ledc-0.1.0.drv»

    nix-repl> ((import ./.).overrideInputs { nixpkgs = <nixpkgs>; }).default
    «derivation /nix/store/r8zw693hpg91yx6f57hyx1gk4zdiq2lm-ledc-0.1.0.drv»
@DavHau
Copy link
Member

DavHau commented Sep 30, 2023

I tested this and it seems to work fine

@alois31
Copy link

alois31 commented Feb 17, 2024

This breaks on the dwarffs flake (https://github.com/edolstra/dwarffs/tree/9861d09c7a22f86d44e41d5ac049e7b4a8d1998d) with an "expected a string but found a list" error, presumably due to the structure of the nixpkgs follow.

DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
Comment on lines +143 to +147
rootOverrides =
mapAttrs'
(input: lockKey: nameValuePair lockKey (impureOverrides.${input} or null))
lockFile.nodes.${lockFile.root}.inputs;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rootOverrides =
mapAttrs'
(input: lockKey: nameValuePair lockKey (impureOverrides.${input} or null))
lockFile.nodes.${lockFile.root}.inputs;
rootOverrides =
mapAttrs'
(input: lockKey': let
lockKey =
if builtins.isList lockKey'
then builtins.concatStringsSep "/" lockKey'
else lockKey';
in
nameValuePair lockKey (impureOverrides.${input} or null))
lockFile.nodes.${lockFile.root}.inputs;

DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
DavHau added a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
mergify bot pushed a commit to nix-community/dream2nix that referenced this pull request Feb 24, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
@zimbatm
Copy link
Member

zimbatm commented Jun 2, 2024

For some reason this PR skipped my attention.. what is the status of it?

@ElvishJerricco
Copy link
Author

@zimbatm If I understand correctly, @DavHau's suggestion will fix the issue mentioned @alois31, which is that doing something like inputs.nixpkgs.follows = "nix/nixpkgs"; doesn't work with this. I haven't reviewed that change yet to include it. Feel free to do so on my behalf if you'd like to merge this.

chaoflow pushed a commit to chaoflow/dream2nix that referenced this pull request Nov 16, 2024
- downgrade mitmproxy to avoid breakage
- add test for pip lock script
- fix bug in flake compat implementation (nix-community/flake-compat#4 (comment))
- small fix in docs for lock and eval-cache
- fix lock refresh script: don't swallow errors
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants