Skip to content

Conversation

@LiGoldragon
Copy link

A function to use atoms to create flake outputs.
The following code can be found in a test repo here:
https://github.com/LiGoldragon/aidiyz/blob/f25e895fb9aa32d8ae30fece60845db42fedd34a/flake.nix#L1

# flake.nix
{
  description = "An Atomic Flake";

  inputs.atom.url = "github:LiGoldragon/atom";

  outputs =
    inputs@{ self, atom, ... }:
    atom.mkAtomicFlake {
      manifest = ./. + "/[email protected]";
      noSystemManifest = ./. + "/[email protected]";
    };
}
# [email protected]
[atom]
id = "simple"
version = "0.1.0"

[local.local-lib]
path = "[email protected]"

[fetch.nixpkgs]
name = "nixpkgs"
import = true

[features]
default = ["system"]

[backend.nix]
fetcher = "npins"
# simple/mod.nix
let
  pkgs = use.nixpkgs {
    inherit system;
  };

  mkStringPackage =
    string:
    pkgs.runCommand string { } ''
      mkdir $out
      echo ${string} > $out/string.txt
    '';

in
{
  Packages.default = pkgs.hello;
  Packages.simpleString = mkStringPackage use.local-lib.simpleString;
  Packages.hashString = mkStringPackage use.local-lib.stringHash;

}
# [email protected]
[atom]
id = "local-lib"
version = "0.1.0"
# local-lib/mod.nix
{
  SimpleString = "A simple string";
  StringHash = std.hashString "sha256" mod.simpleString;
}

@ic4-y
Copy link

ic4-y commented Dec 22, 2024

I think this is going in a similar direction as #40 . Hence the same questions apply. It might not be the intended direction of atom-nix to support flakes more directly than necessary.

What do you think @nrdxp ?

@nrdxp
Copy link
Owner

nrdxp commented Dec 22, 2024

I'm not against a flake utility function, in principle, as it might ease adoption, but it might be a bit before I can review this in depth. I have some pretty major overhauls to make in terms of atom-nix's internal API #48, so I don't necessarily want to lock any compatible mechanism down before that is a bit more stable.

There is also the question of whether something like this might better live in an small "flake" utility library atom.

@nrdxp nrdxp mentioned this pull request Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants