!SgYlXivkogarTVcnZO:nixos.org

Nix Flakes

858 Members
176 Servers

Load older messages


SenderMessageTime
8 Dec 2024
@mwoodpatrickmx:matrix.orgmwoodpatrickmxThat worked21:39:49
9 Dec 2024
@bryan.bennett:matrix.orgBryan I just pgrep -fal nginx and grab the config from there. 14:03:05
10 Dec 2024
@mwoodpatrickmx:matrix.orgmwoodpatrickmx Many thanks🙂 00:32:26
@assert-inequality:matrix.orgAssertInequality Hi Everyone
I know flake-parts is the recommended way to modularize a flake, but I'm finding it a bit confusing. If the main purpose is to manage system, why can't perSystem take arbitrary options?
I'm trying to set a custom output called pkgs-unstable to be able to do nix run .#pkgs-unstable.hello along with nix run .#hello that pulls from nixos-stable
this seem to only be possible through flake = {} and not perSystem = {}? Which then defeats the purpose as I'd need to manually set the system of the unstable nixpkgs input.
19:52:37
@assert-inequality:matrix.orgAssertInequality is there a way to set arbitrary options on perSystem? 19:54:30
@assert-inequality:matrix.orgAssertInequality

Here are two examples:

Vanilla Flakes

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      pkgs = import nixpkgs {
        system = "aarch64-darwin";
      };
    in
    {
      upkgs = import nixpkgs-unstable {
        system = "aarch64-darwin";
      };
      packages."aarch64-darwin" = pkgs;
    };
}

Flake Utils

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
        "aarch64-darwin"
      ];
    in
    flake-utils.lib.eachSystem supportedSystems
      (system:
      let
        pkgs = import nixpkgs {
          inherit system;
        };
      in
      {
        packages = pkgs;
      }) //
    flake-utils.lib.eachSystemPassThrough supportedSystems
      (system: {
        upkgs = import nixpkgs-unstable {
          inherit system;
        };
      });
}

In the Flake Util example, I'm able to build a multi-platform flake that exposes upkgs for each architecture.

Can anyone help me with recreating this minimal Flake Util setup in flake-parts ?

22:07:41
@assert-inequality:matrix.orgAssertInequality *

Here are two examples:

Vanilla Flakes

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      pkgs = import nixpkgs {
        system = "aarch64-darwin";
      };
    in
    {
      upkgs = import nixpkgs-unstable {
        system = "aarch64-darwin";
      };
      packages."aarch64-darwin" = pkgs;
    };
}

Flake Utils

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
        "aarch64-darwin"
      ];
    in
    flake-utils.lib.eachSystem supportedSystems
      (system:
      let
        pkgs = import nixpkgs {
          inherit system;
        };
      in
      {
        packages = pkgs;
      }) //
    flake-utils.lib.eachSystemPassThrough supportedSystems
      (system: {
        upkgs = import nixpkgs-unstable {
          inherit system;
        };
      });
}

In the Flake Util example, I'm able to build a multi-platform flake that exposes upkgs for each architecture.

Can anyone help me with recreating this minimal Flake Util setup in flake-parts ?

22:08:07
@assert-inequality:matrix.orgAssertInequality *

Here are two examples:

Vanilla Flakes

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      pkgs = import nixpkgs {
        system = "aarch64-darwin";
      };
    in
    {
      upkgs = import nixpkgs-unstable {
        system = "aarch64-darwin";
      };
      packages."aarch64-darwin" = pkgs;
    };
}

Flake Utils

{
  description = "Minimal multi-branch example";

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

  outputs =
    inputs@{ self
    , nixpkgs
    , nixpkgs-unstable
    , flake-utils
    , ...
    }:
    let
      supportedSystems = [
        "x86_64-linux"
        "aarch64-linux"
        "aarch64-darwin"
      ];
    in
    flake-utils.lib.eachSystem supportedSystems
      (system:
      let
        pkgs = import nixpkgs {
          inherit system;
        };
      in
      {
        packages = pkgs;
      }) //
    flake-utils.lib.eachSystemPassThrough supportedSystems
      (system: {
        upkgs = import nixpkgs-unstable {
          inherit system;
        };
      });
}

In the Flake Util example, I'm able to build a multi-platform flake that exposes upkgs for each architecture.

Can anyone help me with recreating this minimal Flake Util setup in flake-parts ?

22:34:36
11 Dec 2024
@dminca:matrix.org@dminca:matrix.org left the room.14:19:07
@marijan:matrix.orgmarijan changed their profile picture.14:20:33
12 Dec 2024
@mrtni:matrix.orgmrtni joined the room.06:24:39
@bryan.bennett:matrix.orgBryanRedacted or Malformed Event17:41:20
@bryan.bennett:matrix.orgBryanGood afternoon - we've got a large deployment (~45 hosts in each of 3 tiers, each looking ~identical but with differing hostnames and the like) we're hoping to manage with deploy-rs or colmena (we've yet to choose). We've started using flake-parts for integration with other tools (mostly treefmt and numtide/devshell). This has been working well so far and we are making some decent use of the module system to abstract everything well. We are now looking to handle system abstraction. We know our fleet is entirely x86_64-linux, so we don't require that abstracted at all, but I am struggling to handle the system definition generation. Currently we have a function that we want to import to make the api for definition a bit cleaner, but I am struggling to get it importing without infinite recursion. Is anyone abstracting their system definitions somehow that might be able to provide pointers? Is there some way to import a library of functions that aren't held to the nixos/flake-parts module schema?17:46:26
@bryan.bennett:matrix.orgBryanUnfortunately, I can't share much of the code we have now, but I can describe in more detail if that helps anyone.17:47:18
@wiiplayer2:matrix.orgWaldemar Tomme (they/them) joined the room.22:26:27
13 Dec 2024
@mfrischohio:matrix.org@mfrischohio:matrix.org left the room.01:25:53
16 Dec 2024
@tomberek:matrix.orgtomberekThis can happen when using the module system to define options later used to define other options. Is it possible you are using some output of the final configuration in a conditional somewhere else? Sometimes, using a simple "import" rather than the module system's "imports" is helpful for re-use. 00:56:04
@tomberek:matrix.orgtomberekAnything in the debug output that can help trace the issue. I know it can be hard to read, but sometimes it does tell you exactly what you need to investigate.00:56:55
@tomberek:matrix.orgtomberekOtherwise, feel free to DM if you want to go more in-depth.00:57:29
@orowith2os:fedora.imOro (any/all) changed their display name from Oro (they/she) to Oro (any/all).02:25:27
@ole6edev:matrix.orgolebedev changed their profile picture.09:32:09
@ksonj:matrix.org@ksonj:matrix.org left the room.15:00:32
@felix.herrmann:matrix.sabix.de@felix.herrmann:matrix.sabix.de joined the room.17:37:45
18 Dec 2024
@steeringwheelrules:tchncs.desteeringwheelrules left the room.13:53:50
19 Dec 2024
@er10:matrix.org@er10:matrix.org joined the room.19:37:20
@fgrsnau:matrix.orgStefan joined the room.21:44:48
20 Dec 2024
@xiaoxiangmoe:matrix.org🐰 xiaoxiangmoe joined the room.13:58:44
21 Dec 2024
@stablejoy:matrix.org@stablejoy:matrix.org left the room.05:08:16
@pizzium:matrix.orgpizzium joined the room.12:41:30
@dimitarnestorov:matrix.orgDimitar joined the room.19:46:24

Show newer messages


Back to Room ListRoom Version: 6