!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

880 Members
175 Servers

Load older messages


SenderMessageTime
11 Dec 2023
@mr-qubo:matrix.orgmr-qubo
In reply to @ryoschin:matrix.org
So, as far as I can tell now, all I need to do is make the flake a GC root, right? So, how do I do that...
I don't know but direnv does this, so you can check how they do it.
17:00:32
@ryoschin:matrix.org@ryoschin:matrix.orgAlright, I think I managed to apply direnv to this17:20:26
@2xsaiko:tchncs.de@2xsaiko:tchncs.de
In reply to @ryoschin:matrix.org
I see. Mind sharing the process?
nix.registry.nixpkgs.flake = inputs.nixpkgs (like Janik said) or system.extraDependencies = [inputs.nixpkgs]
18:04:20
12 Dec 2023
@peacememories:matrix.orgpeacememories (Old)i've been looking into this again after some time away, and still can't really find anything: is there a way to exclude one directory from my flake? specifically we have a giant folder of reference PDFs checked into our source tree, and copying them every time a flake is built makes our development shell unusable. this is why we're currently running non-flake nix, but I would love to be able to switch08:48:26
@peacememories:matrix.orgpeacememories (Old)side note: these files are not needed from our nix build, they are just for test runs08:49:27
@janik0:matrix.org@janik0:matrix.org
In reply to @peacememories:matrix.org
i've been looking into this again after some time away, and still can't really find anything:
is there a way to exclude one directory from my flake? specifically we have a giant folder of reference PDFs checked into our source tree, and copying them every time a flake is built makes our development shell unusable.
this is why we're currently running non-flake nix, but I would love to be able to switch
maybe this helps? https://github.com/hercules-ci/gitignore.nix
09:08:56
@peacememories:matrix.orgpeacememories (Old) i don't believe so. for one, the files are not gitignored because they are meant to be versioned. also, I think this would only work when including a separate directory from my flake? right now the flake is at the root of the repository, so the whole repo is copied into the store before I can do anything with it.
I think some people are putting their flake into a subdirectory to work around this? Maybe that's workable for me as well. Still hoping the lazy trees MR gets merged at some point^^
09:25:35
@peacememories:matrix.orgpeacememories (Old)okay, a subfolder alone does not do anything since nix still recognizes the repository root as "the flake" and copies the entire tree. at least that's what it looks like09:52:53
@wucke13:matrix.orgwucke13What is a nice way to fill hydraJobs with the packages and checks of a flake?12:41:59
@tim:stratum0.orgdadada

Everyone seems to do this differently. I have this for building NixOS configs.

{ self, nixpkgs, ... }:
(nixpkgs.lib.mapAttrs'
  (name: config: nixpkgs.lib.nameValuePair name config.config.system.build.toplevel)
  self.nixosConfigurations
)

But not sure if this actually works, or if I configured the jobs manually in hydra...

13:36:15
@antifuchs:asf.computer@antifuchs:asf.computer You may have a .jobsets job that generates a json config listing all the hydra jobs exposed in your flake?  13:49:00
@peacememories:matrix.orgpeacememories (Old)

hmm, is there a more elegant solution for adding overlays in a flake than

pkgs = import nixpkgs {
        inherit system;
        overlays = [
          poetry2nix.overlay
        ];
      };

or is this just how it's done?

14:33:42
@peacememories:matrix.orgpeacememories (Old)(sorry, I feel like I'm asking stupid questions, but it feels like flakes+nix together have so many ways of overriding and referencing packages that it's hard to find the "right" way to do something)14:35:55
@antifuchs:asf.computer@antifuchs:asf.computerthere are many ways to do overlays - it really depends on what you need to do with them tbh15:10:06
@antifuchs:asf.computer@antifuchs:asf.computer if you "just" want to use them in nixos (or nix-darwin), then a module that does {nixpkgs.overlays = [self.inputs.emacs-overlay.overlay];} (where self is the flake, as referenced in the flake's output closure) does the trick; if you need overlays in the pkgs refs that are used inside the flakes, then your thing seems right 15:11:44
@antifuchs:asf.computer@antifuchs:asf.computer(and if you use e.g. flake-parts, it's a different thing altogether)15:11:54
@2xsaiko:tchncs.de@2xsaiko:tchncs.de
In reply to @wucke13:matrix.org
What is a nice way to fill hydraJobs with the packages and checks of a flake?
    hydraJobs = {
      inherit (self) checks packages;
    };
15:18:13
@2xsaiko:tchncs.de@2xsaiko:tchncs.de (as in https://git.sr.ht/~dblsaiko/nix-extras/tree/master/item/flake.nix#L80) 15:18:36
@wucke13:matrix.orgwucke13 but formally packages are system.attr, while hydraJobs is attr.system 17:25:01
@mooncairn:matrix.org@mooncairn:matrix.org joined the room.21:44:05
13 Dec 2023
@2xsaiko:tchncs.de@2xsaiko:tchncs.de
In reply to @wucke13:matrix.org
but formally packages are system.attr, while hydraJobs is attr.system
oh, I guess so, didn't know hydraJobs had any kind of structure
09:09:12
@2xsaiko:tchncs.de@2xsaiko:tchncs.dehydra itself doesn't care at least :D09:09:54
@wucke13:matrix.orgwucke13 I see :D 09:14:33
15 Dec 2023
@themountainking:matrix.org@themountainking:matrix.org joined the room.14:22:34
@themountainking:matrix.org@themountainking:matrix.org So I'm having a hard time grasping flakes and why I should start using them. I am still pretty new to nix os. 14:23:17
@themountainking:matrix.org@themountainking:matrix.orgCan someone please help me to understand?14:23:38
@janik0:matrix.org@janik0:matrix.org
In reply to @themountainking:matrix.org
So I'm having a hard time grasping flakes and why I should start using them. I am still pretty new to nix os.
they try to give you a more ore less defined api of inputs and outputs, kinda like a swagger.json for rest apis in case you are familiar but a lot more vibes and less standard. A output can be anything from a systemConfiguration, to a derivation or function. I don't know if you should start using them that's a kind hard question to answer. a lot of unofficial documentation has support and many times even better support for them because many people feel it's easier learning them. Basically anything you can do with flakes can also be done without them and for some things you need community tools like niv or npins for pinning versions.
14:34:00
@themountainking:matrix.org@themountainking:matrix.org
In reply to @janik0:matrix.org
they try to give you a more ore less defined api of inputs and outputs, kinda like a swagger.json for rest apis in case you are familiar but a lot more vibes and less standard. A output can be anything from a systemConfiguration, to a derivation or function. I don't know if you should start using them that's a kind hard question to answer. a lot of unofficial documentation has support and many times even better support for them because many people feel it's easier learning them. Basically anything you can do with flakes can also be done without them and for some things you need community tools like niv or npins for pinning versions.
Thank you for your input. I understand a little better now. Not sure if they are required for my humble use at this time. Having a solid nix config file seems to be doing the trick. I would like to dabble in impermeance once I better understand that.
14:41:46
@janik0:matrix.org@janik0:matrix.orgfyi, there is a #impermanence:nixos.org channel if you start playing with that or have more questions ^^14:42:53
@themountainking:matrix.org@themountainking:matrix.org I just like a nice simple secure OS configured to my exact specifications, use flatpaks for most of my commonly used personal apps, then virtual machines and docker containers for work. 14:42:55

Show newer messages


Back to Room ListRoom Version: 6