!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

887 Members
180 Servers

Load older messages


SenderMessageTime
2 Aug 2021
@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
@Las:matrix.orgLasI don't think he wants to copy the files to the store. I think he wants to refer to the files by their actual path, so that the system refers to paths outside the 19:55:14
3 Aug 2021
@blaggacao:matrix.orgDavid Arnold (blaggacao) So I built an object oriented flake that knows how to consume self.budModules on a foreign flake without further ado. Because it can be rebound. The only thing that is missing is that it learns how to hook into the nix flake command when run on that foreign flake in order to teach it some UX tricks for nix flake show (w.r.t. self.budModules). niksnut any ideas? 04:31:49
@blaggacao:matrix.orgDavid Arnold (blaggacao) * So I built an object oriented flake that knows how to consume self.budModules on a foreign flake without further ado. Because it can be rebound. The only thing that is missing is that it learns how to hook into the nix flake command when run on that foreign flake in order to teach it some UX tricks for nix flake show (w.r.t. self.budModules). niksnut / @garbas any ideas? 04:36:04
@blaggacao:matrix.orgDavid Arnold (blaggacao) Ivan Malison: 04:38:18
@blaggacao:matrix.orgDavid Arnold (blaggacao) *

Ivan Malison:

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.

I want to know that to in order to reason about ownership of a certain file (by a flake)

04:40:32
@blaggacao:matrix.orgDavid Arnold (blaggacao) *

Ivan Malison:

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.

I want to know that too in order to reason about ownership of a certain file (by a flake)

04:40:46
@blaggacao:matrix.orgDavid Arnold (blaggacao) *

Ivan Malison:

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.

I want to know that too in order to reason about ownership of a certain file (by a flake, or even better by a particular commit)

04:40:59
@elonsroadster:matrix.orgelonsroadster
In reply to @Las:matrix.org
I don't think he wants to copy the files to the store. I think he wants to refer to the files by their actual path, so that the system refers to paths outside the
Right. The reason for this is that is rather not worry about the scripts in my dotfiles being out of sync with what I have put in my nix store. I realize that this is sort of a dumb concern, and that any new dependencies that these scripts have would still need associated system updates, but it just feels a bit heavy weight to need to do a system update every time I tweak or add a new user script.
04:42:23
@elonsroadster:matrix.orgelonsroadsterAnyway, the solution I settled on is adding a module that takes a parameter that is the absolute path to my dotfiles repo that is defaulted to /home/my-user/dotfiles which is where I almost always put them. If I out them somewhere else this parameter will need to be specified. Reminds me a bit of how the system parameter now needs to be specified in flakes.04:45:07

Show newer messages


Back to Room ListRoom Version: 6