!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

830 Members
165 Servers

You have reached the beginning of time (for this room).


SenderMessageTime
22 Jul 2025
@ayoreis:matrix.orgayoreis joined the room.15:32:16
@ayoreis:matrix.orgayoreis using a flake with nixos configuration, should i use the imports list in configuration.nix, or the modules list in flake.nix for including hardware-configuration.nix? 15:34:25
@ayoreis:matrix.orgayoreis same question with disko-config.nix 15:55:22
@thibaut:fsl.shThibaut

I use this:

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
    home-manager.url = "github:nix-community/home-manager/release-25.05";
    nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixpkgs-unfree.url = "github:numtide/nixpkgs-unfree";
    nixpkgs-unfree.inputs.nixpkgs.follows = "nixpkgs-unstable";
  };

  outputs = {
    self,
    nixpkgs,
    home-manager,
    nixpkgs-unstable,
    ...
  } @ attrs: {
    nixosConfigurations.laptopname = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
      ];
    };
  };
}

and my configuration.nix includes everything for me

15:58:18
@maxcf:matrix.orgMax joined the room.18:57:01
24 Jul 2025
@codgician:matrix.codgician.mecodgician changed their profile picture.16:58:08
@s0ands0:matrix.orgS0AndS0 joined the room.23:16:19
@s0ands0:matrix.orgS0AndS0

Howdy all! I've got a pending PR that I wanna reduce back-and-forth on, so have been trying to do some local testing to ensure my eyes are crossed.

My end-goal is to have locally cloned NixOS/nixpkgs under a name-space like git-nixpkgs so I can pick-and-choose bits I wanna test. But been hitting some skill issues I have x-)

Got me the source successfully;

mkdir -vp ~/git/hub/NixOS &&
  pushd "${_}" &&
  git clone --depth=1 git@github.com:NixOS/nixpkgs.git

Did edits and they work when doing import, but now I wanna use the local repo as an inputs to my system flake.nix file, ex;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

... But this is where things fall apart;

/etc/nixos/configuration.nix

{ git-nix, ... }:
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

I'm popping errors of pkgs attribute doesn't exist on git-nixpkgs :-(

This be less than fantastic as REPL shows the attribute available if I start it with something like, nix repl --expr 'import /home/s0ands0/git/hub/NixOS/nixpkgs {}', so I feel like I'm missing some key differences between classy flavored Nix imports vs the new fancy flakes?

23:22:11
@s0ands0:matrix.orgS0AndS0 *

Howdy all! I've got a pending PR that I wanna reduce back-and-forth on, so have been trying to do some local testing to ensure my eyes are crossed.

My end-goal is to have locally cloned NixOS/nixpkgs under a name-space like git-nixpkgs so I can pick-and-choose bits I wanna test. But been hitting some skill issues I have x-)

Got me the source successfully;

mkdir -vp ~/git/hub/NixOS &&
  pushd "${_}" &&
  git clone --depth=1 git@github.com:NixOS/nixpkgs.git

Did edits and they work when doing import, but now I wanna use the local repo as an inputs to my system flake.nix file, ex;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

... But this is where things fall apart;

/etc/nixos/configuration.nix

{ git-nixpkgs, ... }:
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

I'm popping errors of pkgs attribute doesn't exist on git-nixpkgs :-(

This be less than fantastic as REPL shows the attribute available if I start it with something like, nix repl --expr 'import /home/s0ands0/git/hub/NixOS/nixpkgs {}', so I feel like I'm missing some key differences between classy flavored Nix imports vs the new fancy flakes?

23:23:15
@s0ands0:matrix.orgS0AndS0 *

Howdy all! I've got a pending PR that I wanna reduce back-and-forth on, so have been trying to do some local testing to ensure my eyes are crossed.

My end-goal is to have locally cloned NixOS/nixpkgs under a name-space like git-nixpkgs so I can pick-and-choose bits I wanna test. But been hitting some skill issues I have x-)

Got me the source successfully;

mkdir -vp ~/git/hub/NixOS &&
  pushd "${_}" &&
  git clone --depth=1 git@github.com:NixOS/nixpkgs.git

Did edits and they work when doing import, but now I wanna use the local repo as an inputs to my system flake.nix file, ex;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, nixpkgs, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

... But this is where things fall apart;

/etc/nixos/configuration.nix

{ git-nixpkgs, ... }:
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

I'm popping errors of pkgs attribute doesn't exist on git-nixpkgs :-(

This be less than fantastic as REPL shows the attribute available if I start it with something like, nix repl --expr 'import /home/s0ands0/git/hub/NixOS/nixpkgs {}', so I feel like I'm missing some key differences between classy flavored Nix imports vs the new fancy flakes?

23:26:13
25 Jul 2025
@s0ands0:matrix.orgS0AndS0 *

Howdy all! I've got a pending PR that I wanna reduce back-and-forth on, so have been trying to do some local testing to ensure my eyes are crossed.

My end-goal is to have locally cloned NixOS/nixpkgs under a name-space like git-nixpkgs so I can pick-and-choose bits I wanna test. But been hitting some skill issues I have x-)

Got me the source successfully;

mkdir -vp ~/git/hub/NixOS &&
  pushd "${_}" &&
  git clone --depth=1 git@github.com:NixOS/nixpkgs.git

Did edits and they work when doing import, but now I wanna use the local repo as an inputs to my system flake.nix file, ex;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, nixpkgs, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

... But this is where things fall apart;

/etc/nixos/configuration.nix

{ git-nixpkgs, ... }:
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

I'm popping errors of pkgs attribute doesn't exist on git-nixpkgs :-(

This be less than fantastic as REPL shows the attribute available if I start it with something like, nix repl --expr 'import /home/s0ands0/git/hub/NixOS/nixpkgs {}', so I feel like I'm missing some key differences between classy flavored Nix imports vs the new fancy flakes?


Edit: here's what I found works, if willing to rebuild with --impure flag;

/etc/nixos/configuration.nix

{ ... }:
let
  git-nixpkgs = import /home/s0ands0/git/hub/NixOS/nixpkgs;
in
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

... feels like I really am missing something fundamental about Flakes 🤷

00:01:17
@s0ands0:matrix.orgS0AndS0 *

Howdy all! I've got a pending PR that I wanna reduce back-and-forth on, so have been trying to do some local testing to ensure my eyes are crossed.

My end-goal is to have locally cloned NixOS/nixpkgs under a name-space like git-nixpkgs so I can pick-and-choose bits I wanna test. But been hitting some skill issues I have x-)

Got me the source successfully;

mkdir -vp ~/git/hub/NixOS &&
  pushd "${_}" &&
  git clone --depth=1 git@github.com:NixOS/nixpkgs.git

Did edits and they work when doing import, but now I wanna use the local repo as an inputs to my system flake.nix file, ex;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, nixpkgs, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

... But this is where things fall apart;

/etc/nixos/configuration.nix

{ git-nixpkgs, ... }:
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

I'm popping errors of pkgs attribute doesn't exist on git-nixpkgs :-(

This be less than fantastic as REPL shows the attribute available if I start it with something like, nix repl --expr 'import /home/s0ands0/git/hub/NixOS/nixpkgs {}', so I feel like I'm missing some key differences between classy flavored Nix imports vs the new fancy flakes?


Edit: here's what I found works, if willing to rebuild with --impure flag;

/etc/nixos/configuration.nix

{ ... }:
let
  git-nixpkgs = import /home/s0ands0/git/hub/NixOS/nixpkgs { };
in
{
  # ...
  services.dictd = {
    enable = true;
    DBs = with git-nixpkgs.pkgs.dictdDBs; [
      gcide
    ];
  };
}

... feels like I really am missing something fundamental about Flakes 🤷

00:01:57
@dramforever:matrix.orgdramforever git-nixpkgs.legacyPackages.${pkgs.system} 00:08:30
@dramforever:matrix.orgdramforever pkgs comes from the top: { git-nixpkgs, pkgs, ... }: 00:08:48
@s0ands0:matrix.orgS0AndS0

Tragically the same story, but with error: attribute 'legacyPackages' missing now

... I added a lib.warn (builtins.toString (builtins.attrNames git-nixpkgs)) between function args and body, and noticed nothing's printed when building with Flake inputs but a whole lotta stuff gets dumped if I go the import route

00:24:26
@dramforever:matrix.orgdramforever like, nothing's printed, not even []? 00:38:14
@dramforever:matrix.orgdramforever can you put out the what you have written again? you originally had nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {, which is a syntax error so i doubt that's what you actually had 01:00:06
@dramforever:matrix.orgdramforever * can you put out the what you have written again? you originally posted nixosConfigurations.nixos = nixpkgs.lib.nixosSystem = {, which is a syntax error so i doubt that's what you actually had 01:00:19
@s0ands0:matrix.orgS0AndS0

like, nothing's printed, not even []?

Nope, nothing :-\

can you put out what you have written again?

Yeah it wouldn't surprise me if it were something like me being no smort with the syntax! And ya be correct in that my transcription had one too many =, though be assured that wasn't/ain't the reality.

Here be the current state of things;

/etc/nixos/flake.nix (snip)

{
  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
    # ...
    git-nixpkgs = {
      type = "path";
      path = "/home/s0ands0/git/hub/NixOS/nixpkgs";
    };
  };

  outputs = { self, nixpkgs, ... }@attrs: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      specialArgs = attrs;
      modules = [
        ./configuration.nix
        # ...
      ];
    };
  };
}

/etc/nixos/configuration.nix (snip)

{
  pkgs,
  git-nixpkgs,
  ...
}:

let
  # git-nixpkgs = import /home/s0ands0/git/hub/NixOS/nixpkgs { };
in
lib.warn (builtins.toString (builtins.attrNames git-nixpkgs))
{
  # ...
  services.dictd = {
    enable = true;

    # DBs = with git-nixpkgs.pkgs.dictDBs; [
    DBs = with git-nixpkgs.legacyPackages.${pkgs.system}.dictDBs; [
      gcide
    ];
  };
}

Now at the rebuild phase, which uh takes a few minutes;

nixos-rebuild test --impure --flake .
#> warning: Git tree '/etc/nixos' is dirty
#> copying "/home/s0ands0/git/hub/NixOS/nixpkgs" to the store
#> ...
#> copying "/nix/store/<HASH>-source/" to the store
#> ...
01:51:09
@dramforever:matrix.orgdramforever try turning that into throw (builtins.toString (builtins.attrNames git-nixpkgs)) just to be sure 01:59:22
@dramforever:matrix.orgdramforever or in fact, just throw git-nixpkgs 02:00:32
@s0ands0:matrix.orgS0AndS0

Woot!

#> evaluation warning: _type checks devShells ... legacyPackages...
#> Done. The new configuration is /nix/store/<HASH>-....

Thank you!!!! I must have been battling some typo for the last 5 (or more) hours and ya solved it in minutes x-)

02:08:14
@vuks:matrix.orgVuks joined the room.18:02:12
@coolio:nope.chat@coolio:nope.chat removed their profile picture.19:48:22
@coolio:nope.chat@coolio:nope.chat removed their display name coolio.19:48:27
@coolio:nope.chat@coolio:nope.chat left the room.19:48:33
26 Jul 2025
@kotwys:matrix.org@kotwys:matrix.org left the room.07:45:28
27 Jul 2025
@matthaispali:converser.eumatthaispali joined the room.19:46:18
28 Jul 2025
@rav:vergara.techRene should all packages in nixpkgs be able to be installed using nix profile install? 16:33:01
@sandro:supersandro.deSandro 🐧There are probably some exceptions but generally I can say a definitive maybe16:34:10

Show newer messages


Back to Room ListRoom Version: 6