!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

609 Members
121 Servers

Load older messages


SenderMessageTime
8 May 2024
@mfed3:matrix.orgmfed3Hey everyone, been using nixos for about 2 years now, but finally doing some tests to migrate to flakes with my configuration of 2 hosts. Was following some basics on the nixos-wiki and right off the bat errors. My steps were: Enabled flakes and nix-command on the old style configuration Refactored my configs a bit to have a modules and hosts folder at the top level Ran nix flake init Modified the file to look like this: 01:48:38
@mfed3:matrix.orgmfed3Ran sudo nixos-rebuild switch --flake .01:49:02
@mfed3:matrix.orgmfed3
[mfed3@fed-gc:~/git/nixos-config]$ sudo nixos-rebuild switch --flake .
[sudo] password for mfed3: 
error:
       … while calling the 'seq' builtin

         at /nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while evaluating a branch condition

         at /nix/store/3pif36ks3f56py4wb1dkq6sh0nkf3ygj-source/lib/modules.nix:261:9:

          260|       checkUnmatched =
          261|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [] then
             |         ^
          262|           let

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: getting status of '/nix/store/b0x9sbi7iqgkw5m01ccak1w7vl69fn8c-source/hosts/modules': No such file or directory

[mfed3@fed-gc:~/git/nixos-config]$ 


01:50:36
@mfed3:matrix.orgmfed3The errors don't even point to anything in my files, I don't understand what it's trying to tell me01:51:18
@mfed3:matrix.orgmfed3Maybe someone knows this common error means something specific that I forgot to do ? Can't even find the error searching for it01:53:06
@charles:computer.surgeryCharles When using flakes and git, nix does not know files exist unless they are checked into git. Try running git add -AN and then trying again 01:55:46
@charles:computer.surgeryCharles* When using flakes and git, nix does not know files exist unless they are checked in or staged in git. Try running `git add -AN` and then trying again01:56:42
@mfed3:matrix.orgmfed3So my original config was a git repo but this one is not, I didn't realize it doesn't work at all without it being a git repo01:58:30
@mfed3:matrix.orgmfed3Ok so can I just git init from that folder or do I need to delete the flake.nix and lock file and redo nix flake init?01:59:22
@charles:computer.surgeryCharlesIf it's not a git repo then it should work02:00:04
@charles:computer.surgeryCharlesMake sure you didn't typo your paths in your nix code02:00:18
@charles:computer.surgeryCharles Maybe try running git status to double check that it isn't a git repo 02:01:09
@mfed3:matrix.orgmfed3k I committed everything in there now, reran, same error02:03:08
@charles:computer.surgeryCharles
In reply to @charles:computer.surgery
Make sure you didn't typo your paths in your nix code
Try this
02:03:56
@charles:computer.surgeryCharles The error looks like you wrote ./foo.nix but actually have ./bar.nix instead for example 02:04:51
@charles:computer.surgeryCharlesThat or it's not getting copied into the store, which would be the git thing02:05:15
@mfed3:matrix.orgmfed3For modules, relative path to a folder from root of a flake would be ./hosts/file.nix not hosts/file.nix and no quotes around them in modules correct02:06:00
@mfed3:matrix.orgmfed3Omg I'm a fuckin idiot, fatfingered a ../ in one of the imports 3 deep in one of the configs02:37:36
@mfed3:matrix.orgmfed3Man the error messages are so useless lol02:37:57
@mfed3:matrix.orgmfed3Thanks charles you were right after all :D02:39:01
@mfed3:matrix.orgmfed3Works, system officially flakified02:44:24
@tomberek:matrix.orgtomberekThat did not make a symlink?02:57:55
@checooh:matrix.orgchecooh joined the room.11:56:37
@aszeszo:matrix.orgaszeszo joined the room.18:31:41
@abmantis:abcosta.com@abmantis:abcosta.comimage.png
Download image.png
21:28:47
@abmantis:abcosta.com@abmantis:abcosta.com it does, but still I just ran nix develop --profile ./nix-profile /home/acosta/dev/thirdparty/nix-environments#home-assistant and it fetched stuff before opening the environment 21:29:24
9 May 2024
@theutz:matrix.org@theutz:matrix.org left the room.08:52:16
@mfed3:matrix.orgmfed3

Hey guys I have a question on autoupgrade, what does this actually do:

  system.autoUpgrade = {
    enable = true;
    allowReboot =  true;
    flake = inputs.self.outPath;
    flags = [ "--update-input" "nixpkgs" "--print-build-logs" ];
  };
12:24:14
@mfed3:matrix.orgmfed3Is that making the system run a nixos-rebuild switch automatically at 4:40 and build what is in the flake.lock 12:25:09
@mfed3:matrix.orgmfed3Or is that actually doing a nix flake update then building it12:25:43

Show newer messages


Back to Room ListRoom Version: 6