!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

897 Members
183 Servers

Load older messages


SenderMessageTime
16 May 2023
@netpleb:matrix.orgnetpleb
In reply to @gastove:matrix.org

Hey y'all. I'm trying to set up a new project with Flakes and I'm.... I'm clearly doing something wrong, but I can't even guess what.

In my repo, I issue nix flake init. It exits 0 -- prints no output, but doesn't error. Then I nix flake new; from here on, no matter what I do, I get some variation on error: getting status of '/nix/store/dkp69n965c3wppsfafvg1cxn36fcbgi7-source/schema-tools/flake.nix': No such file or directory.

did you add flake.nix to your git repo with git add flake.nix?
16:54:34
@bendlas:matrix.orgbendlasnot so sure about that, but maybe we can continue another time. gotta run. talk to you later :-)16:54:52
@gastove:matrix.orgRoss Donaldson
In reply to @netpleb:matrix.org
did you add flake.nix to your git repo with git add flake.nix?
I haven't yet, but I'm happy to try it. Is the goal to have a clean working tree? I'm the only Nix user at my company so far, so I was planning on adding my flake to my .gitignore.
16:56:06
@netpleb:matrix.orgnetpleb
In reply to @gastove:matrix.org
I haven't yet, but I'm happy to try it. Is the goal to have a clean working tree? I'm the only Nix user at my company so far, so I was planning on adding my flake to my .gitignore.
as I understand it, which is only barely, part of the point of flakes is to have things extremely hermetic which means that the "flake commands" like nix flake and other things that use flakes like nixos-rebuild switch --flake ... essentially look in a git repo and treat it as the only thing that exists. So that means that if git does not know about it, then it does not exist inside the world of flakes either.
16:57:43
@gastove:matrix.orgRoss DonaldsonOh huh.16:58:02
@gastove:matrix.orgRoss DonaldsonLemme see then16:58:11
@netpleb:matrix.orgnetplebI found following part 3 of this tutorial quite helpful: https://www.tweag.io/blog/2020-07-31-nixos-flakes/16:58:48
@gastove:matrix.orgRoss DonaldsonOh ha, yep, this is now working much better. Wild. 16:59:05
@gastove:matrix.orgRoss DonaldsonAh, I'll read that more carefully -- that's the tutorial series I've been working from, but I must have missed needing to have this in git. 16:59:39
@gastove:matrix.orgRoss DonaldsonThank you! This does seem to have Done It. 17:00:29
@netpleb:matrix.orgnetpleb ok, what I ended up doing is replacing that line 57 with default = pkgs.callPackage ./package-ssh-chat.nix {}; and it seems to work now 17:52:14
@netpleb:matrix.orgnetplebfeels clunky but progress at least17:52:37
@loving-melody:matrix.org@loving-melody:matrix.org joined the room.20:13:21
@loving-melody:matrix.org@loving-melody:matrix.org changed their profile picture.20:21:00
@bendlas:matrix.orgbendlas

oh, yes, I didn't see line 57 before ... hmm ... so I can see how reaching through the module boundary like this (i.e. going around the module-provided pkgs) can lead to issues, but the error message is still rather unintuitive ...

so if this was just about self not being bound in the new file, please disregard my comments about providing it.

21:19:09
@netpleb:matrix.orgnetpleb
In reply to @bendlas:matrix.org

oh, yes, I didn't see line 57 before ... hmm ... so I can see how reaching through the module boundary like this (i.e. going around the module-provided pkgs) can lead to issues, but the error message is still rather unintuitive ...

so if this was just about self not being bound in the new file, please disregard my comments about providing it.

thanks for your thoughts on it regardless. So that I better understand, are you saying that my "solution" might end up causing issues? or are you saying that the original problem of not being able to access self from the separate file is itself the problem and that ideally I should be able to just access self somehow?
23:29:26
17 May 2023
@bendlas:matrix.orgbendlas I'm saying that your solution may actually be more correct, because you should usually access every package within a module through the module's pkgs argument. 11:04:27
@bendlas:matrix.orgbendlasbut as you may already have noticed: I'm pretty much a noob with flakes, so take my opinion on this with a grain of salt11:05:37
@netpleb:matrix.orgnetplebgot it, ok, thanks again! i learned some things :)16:15:58
@shoekstra:matrix.orgshoekstra joined the room.21:12:00
18 May 2023
@phelix:c-base.org@phelix:c-base.org joined the room.00:57:58
@hab25:matrix.orghab25

Is there some flake input URL syntax for the latest tag of a git repo? For example, I have

# a flake.nix
{
  inputs = {
    fish-plugin-fzf-dot-fish = {
      url = "github:PatrickF1/fzf.fish?ref=v9.5";
      flake = false;
    };
  };
  outputs = {self, ...}: {
    #...
  };
}

Instead of ?ref=v9.5, I'm looking to do something like ?latest_tag so that it automatically just shifts to the latest available tag when I run e.g. nix flake lock --update-input fish-plugin-fzf-dot-fish and therefore give me less toil.

01:19:45
@pyrox:pyrox.devPyrox [Fox/It/She]
In reply to@hab25:matrix.org

Is there some flake input URL syntax for the latest tag of a git repo? For example, I have

# a flake.nix
{
  inputs = {
    fish-plugin-fzf-dot-fish = {
      url = "github:PatrickF1/fzf.fish?ref=v9.5";
      flake = false;
    };
  };
  outputs = {self, ...}: {
    #...
  };
}

Instead of ?ref=v9.5, I'm looking to do something like ?latest_tag so that it automatically just shifts to the latest available tag when I run e.g. nix flake lock --update-input fish-plugin-fzf-dot-fish and therefore give me less toil.

You can just remove the ?ref=v9.5 part to get the latest commit
02:18:04
@pyrox:pyrox.devPyrox [Fox/It/She] So just url = "github:PatrickF1/fzf.fish"; 02:18:28
@hab25:matrix.orghab25
In reply to @pyrox:pyrox.dev
You can just remove the ?ref=v9.5 part to get the latest commit
thanks; I prefer following tags for more stability
14:13:34
19 May 2023
@nowaaay:matrix.orgnowaaay joined the room.15:50:30
@nowaaay:matrix.orgnowaaay

howdy, i have a flake i use for a devShell containing dotnet, nuget, and omnisharp, and i'm wondering how i can prevent these dependencies from clogging up $HOME. here's my flake:

  description = "Basic dotnet dev environment";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    flake-utils.url = "github:numtide/flake-utils";
  };

  outputs = { nixpkgs, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem
      (system:
        let
          pkgs = nixpkgs.legacyPackages.${system};
          omnisharp = pkgs.omnisharp-roslyn;

          # nvimrc = ...;
        in
        {
          # Used by `nix develop`
          devShells.default = pkgs.mkShell {
            buildInputs = with pkgs; [
              #basics
              dotnet-sdk
              dotnet-runtime
              #packages
              dotnetPackages.Nuget #install nuget declaratively

              #unit testing
              dotnetPackages.NUnit
              dotnetPackages.NUnitRunners

              #language server of choice
              omnisharp-roslyn
            ];

           # My attempts at decluttering HOME

            DOTNET_ROOT = "\${XDG_DATA_HOME}/dotnet";
            DOTNET_CLI_TELEMETRY_OPTOUT = 1;
            DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true";

            shellHook = ''
              echo '${nvimrc}' > .nvimrc.lua
              export NUGET_PACKAGES=$XDG_DATA_HOME/nuget
              export OMNISHARPHOME=$XDG_CONFIG_HOME/omnisharp
            '';
          };
        }
      );
}

one thing i've been suggested is to use https://github.com/queer/boxxy, which i'm not against, but i would prefer something native to Nix. supposedly i can fiddle with LD_LIBRARY_PATH to recreate what boxxy does, but i don't know anything about what to do. any pointers?

18:40:24
@joepie91:pixie.townjoepie91 🏳️‍🌈hmm, I don't think this is really within the domain of Nix, to be honest - as it essentially concerns runtime isolation, and Nix only really concerns itself with build/install-time stuff18:50:49
@joepie91:pixie.townjoepie91 🏳️‍🌈both in the sense that I don't think Nix really has tools for this, and in the sense that using arbitrary tools like boxxy wouldn't interfere with Nix usage18:51:16
@joepie91:pixie.townjoepie91 🏳️‍🌈on NixOS, you could use systemd's container spawn stuff and there's even some declarative NixOS container stuff, but that doesn't help you outside of NixOS, and that's more meant for services than for on-demand applications I think18:52:38

Show newer messages


Back to Room ListRoom Version: 6