!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

753 Members
149 Servers

Load older messages


SenderMessageTime
30 Apr 2025
@sheeldotme:matrix.orgsheeldotme* Hmm, nothing jumping out to me. When exactly does the devshell rebuild? (On every activation, after specific commands, how frequently?) Are you updating flake inputs or the dependencies of your shell frequently? Is the flake lock stable? If you're using nixos or nix-darwin, it could help to check if you're space constrained or if you have the garbage collector running frequently.15:03:35
@simon.brandner:envs.netŠimon Brandner

To be clear I only added the nixConfig bit today.

The rebuild happens once in a while I guess. E.g. yesterday evening I was using the dev shell (nix develop) but today in the morning gcc had to be rebuilt.

I haven't done any changes to my system or the flake in between those times

GC has this setup

    gc = {
      automatic = true;
      dates = "daily";
      options = "--delete-older-than 7d";
    };

Does this answer your questions?

15:06:24
@sheeldotme:matrix.orgsheeldotmeIt does seem strange that it triggered a rebuild if you didnt modify the flake or its dependencies. https://github.com/nix-community/nix-direnv?tab=readme-ov-file#manual-reload-of-the-nix-environment may be helpful, at least it wont rebuild when you don't want to, it'll give you that option.15:25:01
@sheeldotme:matrix.orgsheeldotme Maybe du -hsc /nix/store and see if that is taking up a lot of your system storage, if so that may be our answer. 15:26:05
@simon.brandner:envs.netŠimon BrandnerI am not sure I follow a 100%?15:41:52
@simon.brandner:envs.netŠimon Brandner(it indeed is taking up a lot of space)15:45:53
@simon.brandner:envs.netŠimon Brandner(not sure what to make of it in the context of this issue)15:46:05
@sheeldotme:matrix.orgsheeldotmeSorry, I wasn't being very clear. I guess I meant: could the issue be that its being garbage collected prematurely because there isn't much room in the store leading to the rebuilds?16:48:28
@simon.brandner:envs.netŠimon BrandnerNo worries, but no, that is not the case17:24:48
@skyesoss:matrix.org@skyesoss:matrix.org joined the room.19:53:43
1 May 2025
@leons_pferd:matrix.orgLeon joined the room.00:03:29
@leons_pferd:matrix.orgLeon

Hey guys I have a question.
I was used to instantiate nixpkgs like this

pkgs = import inputs.nixpkgs {
    overlays = [
      inputs.nur.overlays.default
    ];
    system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform);
    config.allowUnfree = true;
  };

And then pass this configured instance as specialArgs to nixpkgs.lib.nixosSystem like this:

  nixosConfigurations.${systemSettings.hostname} = inputs.nixpkgs.lib.nixosSystem {
    modules = [ ./configuration.nix ];
    specialArgs = {
      inherit pkgs;
      inherit inputs;
      inherit systemSettings;
    };
  };

I thought that this ensures that the correctly defined nixpkgs is used throughout my configuration.nix. But now I'm getting this warning:

evaluation warning: You have set specialArgs.pkgs, which means that options like nixpkgs.config
                    and nixpkgs.overlays will be ignored. If you wish to reuse an already created
                    pkgs, which you know is configured correctly for this NixOS configuration,
                    please import the `nixosModules.readOnlyPkgs` module from the nixpkgs flake or
                    `(modulesPath + "/misc/nixpkgs/read-only.nix"), and set `{ nixpkgs.pkgs = <your pkgs>; }`.
                    This properly disables the ignored options to prevent future surprises.

Removing the inherit pkgs; line gets rid of the warning and everything stills works but now I don't understand how my modules know about the nixpkgs instance that they should be using.

I tried googling but found it really difficult to find information regarding this. Any help would be highly appreciated!
In general help for understanding how this nixpkgs.lib.nixosSystem actually works would be nice :slight_smile:

00:09:22
@dramforever:matrix.orgdramforever
In reply to @leons_pferd:matrix.org

Hey guys I have a question.
I was used to instantiate nixpkgs like this

pkgs = import inputs.nixpkgs {
    overlays = [
      inputs.nur.overlays.default
    ];
    system = "x86_64-linux"; # system arch (checkout hardware-configuration.nix -> nixpkgs.hostPlatform);
    config.allowUnfree = true;
  };

And then pass this configured instance as specialArgs to nixpkgs.lib.nixosSystem like this:

  nixosConfigurations.${systemSettings.hostname} = inputs.nixpkgs.lib.nixosSystem {
    modules = [ ./configuration.nix ];
    specialArgs = {
      inherit pkgs;
      inherit inputs;
      inherit systemSettings;
    };
  };

I thought that this ensures that the correctly defined nixpkgs is used throughout my configuration.nix. But now I'm getting this warning:

evaluation warning: You have set specialArgs.pkgs, which means that options like nixpkgs.config
                    and nixpkgs.overlays will be ignored. If you wish to reuse an already created
                    pkgs, which you know is configured correctly for this NixOS configuration,
                    please import the `nixosModules.readOnlyPkgs` module from the nixpkgs flake or
                    `(modulesPath + "/misc/nixpkgs/read-only.nix"), and set `{ nixpkgs.pkgs = <your pkgs>; }`.
                    This properly disables the ignored options to prevent future surprises.

Removing the inherit pkgs; line gets rid of the warning and everything stills works but now I don't understand how my modules know about the nixpkgs instance that they should be using.

I tried googling but found it really difficult to find information regarding this. Any help would be highly appreciated!
In general help for understanding how this nixpkgs.lib.nixosSystem actually works would be nice :slight_smile:

don't use specialArgs to pass pkgs, use { nixpkgs.pkgs = pkgs; } to pass it the non-special way
00:20:09
@dramforever:matrix.orgdramforeverthat's what the message is trying to tell you00:20:35
@dramforever:matrix.orgdramforever if you don't pass it anything, then, well, nixpkgs.lib.nixosSystem is from nixpkgs so it knows to use the thing from nixpkgs 00:21:08
@leons_pferd:matrix.orgLeon Do you know what the nixosModules.readOnlyPkgs is that the warning is talking about? 09:08:06
@rosariopulella:matrix.orgRosuavio changed their display name from Rosario Pulella to Rosuavio.20:08:43
2 May 2025
@dramforever:matrix.orgdramforeverhttps://github.com/NixOS/nixpkgs/blob/master/nixos/modules/misc/nixpkgs/read-only.nix02:36:01
@leons_pferd:matrix.orgLeonThank you for the help!! :) 11:46:04
3 May 2025
@seerlite:matrix.orgSeerLite joined the room.14:28:33
@er10:matrix.org@er10:matrix.org

Hello everyone : I receive the following notification, since today :

doas (omakuva@3nnoia) password: 
omakuva@3nnoia:/etc/nixos$ doas nixos-rebuild switch --flake /etc/nixos#my-upgrade --verbose
$ nix --extra-experimental-features nix-command flakes build --out-link /tmp/nixos-rebuild.8Li1il/nixos-rebuild /etc/nixos#nixosConfigurations."my-upgrade".config.system.build.nixos-rebuild --verbose
error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."my-upgrade".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."my-upgrade".config.system.build.nixos-rebuild' or 'nixosConfigurations."my-upgrade".config.system.build.nixos-rebuild'`` 

Could you please help ? -- It never happened before... Thanks in advance.
16:06:48
@bastidest:matrix.orgbastidest joined the room.18:43:52
@beatscherrer:matrix.orgstencill joined the room.18:47:22
@beatscherrer:matrix.orgstencill

Hi all,

anyone has a working android dev (tauri in particular) flake? I got a working flake that just stopped working due to android build error (gradlew) with

* What went wrong:
platform encoding not initialized

flake in question is:

{
  description = "A Tauri Angular Android development flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    android.url = "github:tadfisher/android-nixpkgs";
  };

  outputs =
    {
      self,
      nixpkgs,
      rust-overlay,
      android,
      ...
    }:
    let
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];

      forAllSystems =
        function:
        nixpkgs.lib.genAttrs systems (
          system:
          function ({
            pkgs = import nixpkgs {
              inherit system;
              overlays = [
                rust-overlay.overlays.default
                self.overlay
              ];
              config = {
                allowUnfree = true;
                android_sdk.accept_license = true;
              };
            };
            inherit system;
          })
        );
    in
    {
      overlay = final: prev: {
        inherit (self.packages.${final.system}) android-sdk android-studio;
      };

      packages = forAllSystems (
        { pkgs, system }:
        {
          android-sdk = android.sdk.${system} (
            sdkPkgs:
            with sdkPkgs;
            [
              # Useful packages for building and testing.
              build-tools-34-0-0
              cmdline-tools-latest
              emulator
              platform-tools
              platforms-android-34

              # Other useful packages for a development environment.
              ndk-26-1-10909125
              # skiaparser-3
              # sources-android-34
            ]
            ++ pkgs.lib.optionals (system == "aarch64-darwin") [
              system-images-android-34-google-apis-arm64-v8a
              system-images-android-34-google-apis-playstore-arm64-v8a
            ]
            ++ pkgs.lib.optionals (system == "x86_64-darwin" || system == "x86_64-linux") [
              system-images-android-34-google-apis-x86-64
              system-images-android-34-google-apis-playstore-x86-64
            ]
          );
        }
        // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
          # Android Studio in nixpkgs is currently packaged for x86_64-linux only.
          android-studio = pkgs.androidStudioPackages.stable;
        }
      );

      devShells = forAllSystems (
        { pkgs, ... }:
        {
          default =
            with pkgs;
            mkShell rec {
              motd = ''
                Welcome to the Tauri Android App Development environment.
              '';

              nativeBuildInputs = with pkgs; [
                pkg-config
                gobject-introspection
                cargo
                cargo-tauri
                nodejs
              ];

              buildInputs = [
                #-- tauri
                (rust-bin.stable.latest.default.override {
                  targets = [
                    "aarch64-linux-android"
                    "x86_64-linux-android"
                    "armv7-linux-androideabi"
                    "i686-linux-android"
                  ];
                })
                at-spi2-atk
                nodejs
                atkmm
                cairo
                gdk-pixbuf
                harfbuzz
                pnpm
                nodePackages."@angular/cli"
                curl
                wget
                pkg-config
                dbus
                openssl
                glib
                gtk3
                libsoup_2_4
                webkitgtk_4_1
                librsvg
                pango
                # android utilities
                androidenv.androidPkgs.platform-tools # adb
                apksigner
                zulu
                self.packages.${system}.android-studio
                self.packages.${system}.android-sdk

                #-- other tools
                just
                eza
                fd

                # LSPs
                vscode-langservers-extracted
                typescript-language-server
                nodePackages.prettier
                nodePackages.vscode-langservers-extracted
                rust-analyzer
                emmet-ls
              ];

              shellHook = ''
                alias ls=eza
                alias find=fd

                pnpm install
              '';

              LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH";
              OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include/openssl";
              OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
              OPENSSL_ROOT_DIR = "${pkgs.openssl.out}";

              GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules/";

              # Android
              ANDROID_HOME = "${pkgs.android-sdk}/share/android-sdk";
              ANDROID_SDK_ROOT = "${pkgs.android-sdk}/share/android-sdk";
              JAVA_HOME = "${pkgs.jdk.home}";
              NDK_HOME = "${pkgs.android-sdk}/share/android-sdk/ndk/26.1.10909125";
              GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${pkgs.android-sdk}/share/android-sdk/build-tools/34.0.0/aapt2";

              # other?
              XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
            };
        }
      );
    };
}

18:49:21
@beatscherrer:matrix.orgstencill *

Hi all,

anyone has a working android dev (tauri in particular) flake? I got a working flake that just stopped working due to android build error (gradlew) with

* What went wrong:
platform encoding not initialized

flake in question is:

{
  description = "A Tauri Angular Android development flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    android.url = "github:tadfisher/android-nixpkgs";
  };

  outputs =
    {
      self,
      nixpkgs,
      rust-overlay,
      android,
      ...
    }:
    let
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];

      forAllSystems =
        function:
        nixpkgs.lib.genAttrs systems (
          system:
          function ({
            pkgs = import nixpkgs {
              inherit system;
              overlays = [
                rust-overlay.overlays.default
                self.overlay
              ];
              config = {
                allowUnfree = true;
                android_sdk.accept_license = true;
              };
            };
            inherit system;
          })
        );
    in
    {
      overlay = final: prev: {
        inherit (self.packages.${final.system}) android-sdk android-studio;
      };

      packages = forAllSystems (
        { pkgs, system }:
        {
          android-sdk = android.sdk.${system} (
            sdkPkgs:
            with sdkPkgs;
            [
              # Useful packages for building and testing.
              build-tools-34-0-0
              cmdline-tools-latest
              emulator
              platform-tools
              platforms-android-34

              # Other useful packages for a development environment.
              ndk-26-1-10909125
              # skiaparser-3
              # sources-android-34
            ]
            ++ pkgs.lib.optionals (system == "aarch64-darwin") [
              system-images-android-34-google-apis-arm64-v8a
              system-images-android-34-google-apis-playstore-arm64-v8a
            ]
            ++ pkgs.lib.optionals (system == "x86_64-darwin" || system == "x86_64-linux") [
              system-images-android-34-google-apis-x86-64
              system-images-android-34-google-apis-playstore-x86-64
            ]
          );
        }
        // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
          # Android Studio in nixpkgs is currently packaged for x86_64-linux only.
          android-studio = pkgs.androidStudioPackages.stable;
        }
      );

      devShells = forAllSystems (
        { pkgs, ... }:
        {
          default =
            with pkgs;
            mkShell rec {
              motd = ''
                Welcome to the Tauri Android App Development environment.
              '';

              nativeBuildInputs = with pkgs; [
                pkg-config
                gobject-introspection
                cargo
                cargo-tauri
                nodejs
              ];

              buildInputs = [
                #-- tauri
                (rust-bin.stable.latest.default.override {
                  targets = [
                    "aarch64-linux-android"
                    "x86_64-linux-android"
                    "armv7-linux-androideabi"
                    "i686-linux-android"
                  ];
                })
                at-spi2-atk
                nodejs
                atkmm
                cairo
                gdk-pixbuf
                harfbuzz
                pnpm
                nodePackages."@angular/cli"
                curl
                wget
                pkg-config
                dbus
                openssl
                glib
                gtk3
                libsoup_2_4
                webkitgtk_4_1
                librsvg
                pango
                # android utilities
                androidenv.androidPkgs.platform-tools # adb
                apksigner
                zulu
                self.packages.${system}.android-studio
                self.packages.${system}.android-sdk

                #-- other tools
                just
                eza
                fd

                # LSPs
                vscode-langservers-extracted
                typescript-language-server
                nodePackages.prettier
                nodePackages.vscode-langservers-extracted
                rust-analyzer
                emmet-ls
              ];

              shellHook = ''
                alias ls=eza
                alias find=fd

                pnpm install
              '';

              LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH";
              OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include/openssl";
              OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
              OPENSSL_ROOT_DIR = "${pkgs.openssl.out}";

              GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules/";

              # Android
              ANDROID_HOME = "${pkgs.android-sdk}/share/android-sdk";
              ANDROID_SDK_ROOT = "${pkgs.android-sdk}/share/android-sdk";
              JAVA_HOME = "${pkgs.jdk.home}";
              NDK_HOME = "${pkgs.android-sdk}/share/android-sdk/ndk/26.1.10909125";
              GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${pkgs.android-sdk}/share/android-sdk/build-tools/34.0.0/aapt2";

              # other?
              XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
            };
        }
      );
    };
}

18:50:23
@beatscherrer:matrix.orgstencill *

Hi all,

anyone has a working android dev (tauri in particular) flake? I got a working flake that just stopped working due to android build error (gradlew) with

* What went wrong:
platform encoding not initialized

flake in question is:

{
  description = "A Tauri Angular Android development flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    rust-overlay.url = "github:oxalica/rust-overlay";
    android.url = "github:tadfisher/android-nixpkgs";
  };

  outputs =
    {
      self,
      nixpkgs,
      rust-overlay,
      android,
      ...
    }:
    let
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];

      forAllSystems =
        function:
        nixpkgs.lib.genAttrs systems (
          system:
          function ({
            pkgs = import nixpkgs {
              inherit system;
              overlays = [
                rust-overlay.overlays.default
                self.overlay
              ];
              config = {
                allowUnfree = true;
                android_sdk.accept_license = true;
              };
            };
            inherit system;
          })
        );
    in
    {
      overlay = final: prev: {
        inherit (self.packages.${final.system}) android-sdk android-studio;
      };

      packages = forAllSystems (
        { pkgs, system }:
        {
          android-sdk = android.sdk.${system} (
            sdkPkgs:
            with sdkPkgs;
            [
              # Useful packages for building and testing.
              build-tools-34-0-0
              cmdline-tools-latest
              emulator
              platform-tools
              platforms-android-34

              # Other useful packages for a development environment.
              ndk-26-1-10909125
              # skiaparser-3
              # sources-android-34
            ]
            ++ pkgs.lib.optionals (system == "aarch64-darwin") [
              system-images-android-34-google-apis-arm64-v8a
              system-images-android-34-google-apis-playstore-arm64-v8a
            ]
            ++ pkgs.lib.optionals (system == "x86_64-darwin" || system == "x86_64-linux") [
              system-images-android-34-google-apis-x86-64
              system-images-android-34-google-apis-playstore-x86-64
            ]
          );
        }
        // pkgs.lib.optionalAttrs (system == "x86_64-linux") {
          # Android Studio in nixpkgs is currently packaged for x86_64-linux only.
          android-studio = pkgs.androidStudioPackages.stable;
        }
      );

      devShells = forAllSystems (
        { pkgs, ... }:
        {
          default =
            with pkgs;
            mkShell rec {
              motd = ''
                Welcome to the Tauri Android App Development environment.
              '';

              nativeBuildInputs = with pkgs; [
                pkg-config
                gobject-introspection
                cargo
                cargo-tauri
                nodejs
              ];

              buildInputs = [
                #-- tauri
                (rust-bin.stable.latest.default.override {
                  targets = [
                    "aarch64-linux-android"
                    "x86_64-linux-android"
                    "armv7-linux-androideabi"
                    "i686-linux-android"
                  ];
                })
                at-spi2-atk
                nodejs
                atkmm
                cairo
                gdk-pixbuf
                harfbuzz
                pnpm
                nodePackages."@angular/cli"
                curl
                wget
                pkg-config
                dbus
                openssl
                glib
                gtk3
                libsoup_2_4
                webkitgtk_4_1
                librsvg
                pango
                # android utilities
                androidenv.androidPkgs.platform-tools # adb
                apksigner
                zulu
                self.packages.${system}.android-studio
                self.packages.${system}.android-sdk

                #-- other tools
                just
                eza
                fd

                # LSPs
                vscode-langservers-extracted
                typescript-language-server
                nodePackages.prettier
                nodePackages.vscode-langservers-extracted
                rust-analyzer
                emmet-ls
              ];

              shellHook = ''
                alias ls=eza
                alias find=fd

                pnpm install
              '';

              LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH";
              OPENSSL_INCLUDE_DIR = "${pkgs.openssl.dev}/include/openssl";
              OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib";
              OPENSSL_ROOT_DIR = "${pkgs.openssl.out}";

              GIO_MODULE_DIR = "${pkgs.glib-networking}/lib/gio/modules/";

              # Android
              ANDROID_HOME = "${pkgs.android-sdk}/share/android-sdk";
              ANDROID_SDK_ROOT = "${pkgs.android-sdk}/share/android-sdk";
              JAVA_HOME = "${pkgs.jdk.home}";
              NDK_HOME = "${pkgs.android-sdk}/share/android-sdk/ndk/26.1.10909125";
              GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${pkgs.android-sdk}/share/android-sdk/build-tools/34.0.0/aapt2";

              # other?
              XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
            };
        }
      );
    };
}

Not really a flake issue I reckon but maybe someone with a working tauri/android flake ran into the same issues. All the proposed fixes on SO with setting the encoding in some way or another did not help unfortunately.

18:51:30
4 May 2025
@gasu:matrix.orggasu joined the room.08:06:33
@blackswan319:matrix.orgBlackswan319 joined the room.16:21:29
5 May 2025
@andtheysay:matrix.organdtheysay joined the room.16:09:20
6 May 2025
@2007corolla:matrix.org2007 Corolla joined the room.02:46:54

Show newer messages


Back to Room ListRoom Version: 6