Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default.nix: init #209

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

default.nix: init #209

wants to merge 1 commit into from

Conversation

wegank
Copy link
Member

@wegank wegank commented May 1, 2024

This PR moves the packaging logic from flake.nix to default.nix, so that all packages, including overview and options, can be built with nix-build -A some-package, and be evaluated with nix repl --file ..

In addition, helper functions introduced in flake.nix in the previous refactor are moved to helper.nix, which also accepts nix repl --file helper.nix, making flake.nix even simpler.

default.nix Outdated Show resolved Hide resolved
@fricklerhandwerk
Copy link
Collaborator

Blocked on #222

@wegank wegank force-pushed the default-nix-init branch 6 times, most recently from 894d3ba to 6b1eda4 Compare May 16, 2024 17:09
default.nix Outdated Show resolved Hide resolved
helpers.nix Outdated Show resolved Hide resolved
@wegank wegank force-pushed the default-nix-init branch 16 times, most recently from 52ef767 to 7350e78 Compare May 16, 2024 22:11
@wegank wegank marked this pull request as ready for review May 16, 2024 22:20
helpers.nix Outdated Show resolved Hide resolved
flake-inputs.nix Outdated Show resolved Hide resolved
@wegank wegank force-pushed the default-nix-init branch 3 times, most recently from 633fee8 to a186239 Compare May 17, 2024 11:52
@wegank wegank force-pushed the default-nix-init branch 4 times, most recently from 80be2ec to 6b90854 Compare May 17, 2024 13:13
default.nix Outdated Show resolved Hide resolved
default.nix Outdated Show resolved Hide resolved
default.nix Outdated
inputs = import ./flake-inputs.nix;
in
{
nixpkgs ? inputs.nixpkgs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason we can't create the actual values here already?

Suggested change
nixpkgs ? inputs.nixpkgs,
pkgs ? import inputs.nixpkgs { inherit system; config = {}; overlays = []; },

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's the Rust overlay, I guess passing a different pkgs could break atomic-server?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though I have no idea why the overlay is there, I'll open a test PR to see what happens if it's removed.

default.nix Outdated
},
system ? builtins.currentSystem,
}: let
lib = import (nixpkgs + "/lib");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have pkgs from arguments you get

Suggested change
lib = import (nixpkgs + "/lib");
inherit (pkgs) lib;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since lib is system-agnostic, I guess inheriting it from a system-dependent pkgs is overkill.

@wegank wegank force-pushed the default-nix-init branch 8 times, most recently from 278286a to c088ddd Compare May 17, 2024 20:45
@wegank wegank force-pushed the default-nix-init branch 3 times, most recently from 8a5066d to f6ca212 Compare June 6, 2024 09:01
@cleeyv
Copy link
Collaborator

cleeyv commented Jul 10, 2024

I've been trying out this default-nix-init branch as part of testing the use of deploying NGIpkgs software with npins over at https://github.com/ngi-nix/npins-ngipkgs.

Although I haven't gotten it working yet, since it can already be used to build packages I assume that it will be feasible to use this proposed default.nix to deploy packages from NGIpkgs to NixOS using npins. However, I get the impression that there would be more substantial changes required in order to use it to deploy projects from NGIpkgs, which is currently one of the features of flake.nix version via nixosModules. Do you have a sense of how feasible it might be to implement something comparable for the default.nix as well?

@wegank wegank marked this pull request as draft September 16, 2024 13:04
@fricklerhandwerk fricklerhandwerk mentioned this pull request Sep 18, 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