!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

887 Members
183 Servers

Load older messages


SenderMessageTime
30 Jul 2021
@polykernel:kde.orgpolykernelI see, thanks for the help03:20:13
@dramforever:matrix.orgdramforever joined the room.08:41:42
31 Jul 2021
@yusdacra:nixos.devyusdacra changed their profile picture.17:18:04
1 Aug 2021
@polykernel:kde.orgpolykernelis there a way to call a flake within a nix expression, would I have to use builtins.getFlake?22:06:22
@elonsroadster:matrix.orgelonsroadsterSo I think I want to do something that would generally be regarded as a bad idea. I get that flakes are supposed to be as pure as possible, but I really want to be able to know what directory the flake is defined in, because I want to be able to talk about paths relative to that flake. The reason I want to do this is that I want to add to certain paths in my dotfiles to the global path environment variable. I realize that the nixy way to do this would be to actually add all of the relevant paths/scripts to the nix store and add them that way, but I don't want to have to explicitly rebuild to get new versions of all the scripts every time they are changed.22:17:08
2 Aug 2021
@colemickens:matrix.orgcolemickens 🏳️‍🌈I mean, you can't...?00:17:30
@elonsroadster:matrix.orgelonsroadster
In reply to @colemickens:matrix.org
I mean, you can't...?
even with --impure? Is there a way you can pass an argument to a flake
02:30:12
@colemickens:matrix.orgcolemickens 🏳️‍🌈 I guess you could do nix build --expr and pass it an expression where you're providing the path of where the scripts are. 04:12:25
@colemickens:matrix.orgcolemickens 🏳️‍🌈Not sure that's any better than just ... setting it via convention and then hard-coding it. Either way you're making an un-enforceable assumption.04:12:51
@colemickens:matrix.orgcolemickens 🏳️‍🌈Right? If you build that into the toplevel, nothing stops you from just... not cloning the scripts there and forgetting and putting it in the wrong place.04:13:56
@elonsroadster:matrix.orgelonsroadstercouldn't i do something like builtins getEnv if I use --impure07:13:31
@elonsroadster:matrix.orgelonsroadsterno i guess that wont work, because the file will already be in the store07:26:41
@Las:matrix.orgLas
In reply to @elonsroadster:matrix.org
So I think I want to do something that would generally be regarded as a bad idea. I get that flakes are supposed to be as pure as possible, but I really want to be able to know what directory the flake is defined in, because I want to be able to talk about paths relative to that flake. The reason I want to do this is that I want to add to certain paths in my dotfiles to the global path environment variable. I realize that the nixy way to do this would be to actually add all of the relevant paths/scripts to the nix store and add them that way, but I don't want to have to explicitly rebuild to get new versions of all the scripts every time they are changed.
You don't have to do this
08:15:37
@Las:matrix.orgLasThat's a really bad solution honestly08:15:44
@Las:matrix.orgLasYou can just refer to the paths normally08:15:53
@Las:matrix.orgLas With " 08:15:58
@Las:matrix.orgLasJust don't depend on them being where the flake is08:16:17
@elonsroadster:matrix.orgelonsroadster Las: well yeah i dont want to do that though 08:16:30
@Las:matrix.orgLasThere are a lot of situations where it wouldn't work08:16:34
@Las:matrix.orgLasYour flake's source is imported into the Nix store, after that it has no idea where it came from08:17:03
@elonsroadster:matrix.orgelonsroadster Las: yes i know that, thats why im asking the question 08:17:14
@elonsroadster:matrix.orgelonsroadsteri want to do something impure in a flake, and I know thats wrong, so i kind of get why this is sort of dumb08:17:38
@Las:matrix.orgLasWell then there's nothing to say other than it's fundamentally impossible08:17:43
@Las:matrix.orgLasIt's not even just impure08:17:47
@Las:matrix.orgLasIt's impossible08:17:49
@elonsroadster:matrix.orgelonsroadsterits not impossible -- you could eg patch nix08:18:14
@Las:matrix.orgLas You could if you want have builtins.getEnv "THEPATH" in your flake and set THEPATH before evaluating it 08:18:28
@Las:matrix.orgLasIt would be a very complicated patch08:18:43
@Las:matrix.orgLasIt isn't trivial08:18:45
@niksnut:matrix.orgniksnut Maybe I'm missing something about the question, but if you have a derivation in your flake that has an attribute like src = ./foo.c, then it will only depend on that file and changes to other files in the flake won't trigger a rebuild. 17:15:27

Show newer messages


Back to Room ListRoom Version: 6