Skip to content

Add Flake support#12

Open
lomenzel wants to merge 10 commits intoheadcounter:masterfrom
lomenzel:master
Open

Add Flake support#12
lomenzel wants to merge 10 commits intoheadcounter:masterfrom
lomenzel:master

Conversation

@lomenzel
Copy link
Contributor

This repository is quite out of date. With a flake.nix it can be imported in nixos-unstable or a newer release with pkgs for shabitica pinned at 21.05

i also changed git:// to https:// in the generated file for the node packages.

fixes #11

Copy link
Member

@aszlig aszlig left a comment

Choose a reason for hiding this comment

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

I'm all in support for this, just don't want to add unnecessary dependencies as commented. Will change the Hydra channel to the Flake.

@aszlig
Copy link
Member

aszlig commented Feb 11, 2025

Thanks, jobset added at https://hydra.build/jobset/shabitica/master, right now there aren't any hydraJobs so it doesn't yet evaluate.

README.rst Outdated
.. code-block:: nix

{ inputs, ... }: {
imports = [inputs.shabitica.nixosModules."x86_64-linux".default]; # change "x86_64-linux" to your actual system
Copy link
Member

Choose a reason for hiding this comment

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

Btw. this is not how nixosModules is supposed to work with Flakes, because the system attribute is implied by the current NixOS configuration rather than an individual module.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed it to inputs.shabitica.nixosModules.default

@lomenzel
Copy link
Contributor Author

the go-camo package had the problem that 25.5 will depricate buildGoPackage so i passed the pkgs from the default module to imageproxy. dont know if its the cleanest way

@lomenzel lomenzel requested a review from aszlig February 12, 2025 13:30
flake.nix Outdated
Comment on lines 6 to 15
nixosModules.default = { lib, config, ... }: {
imports = [
(import ./default.nix {
inherit lib config;
pkgs = import nixpkgs {
inherit (config.nixpkgs.localSystem) system;
};
})
];
};
Copy link
Member

Choose a reason for hiding this comment

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

The default.nix in the project root is for supporting Hydra channels, so you can just boil it down to the module entrypoint:

Suggested change
nixosModules.default = { lib, config, ... }: {
imports = [
(import ./default.nix {
inherit lib config;
pkgs = import nixpkgs {
inherit (config.nixpkgs.localSystem) system;
};
})
];
};
nixosModules.default.imports = [ ./modules ];


in {
imports = [ ./imageproxy.nix ];
imports = [ (import ./imageproxy.nix { inherit config pkgs lib; }) ];
Copy link
Member

Choose a reason for hiding this comment

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

Why are you doing this?

Providing the module as an attribute set shouldn't be needed here because it is already a NixOS module.

Even if it would not be a NixOS module, providing a module as an attribute set like this would miss the key attribute which makes errors less readable since the module name is missing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because else it would default to the pkgs defined by the user for the rest of the system, but for example pkgs.buildGoPackage is depricated and removed in newer channels so it has to use the 21.05 channel

Copy link
Member

Choose a reason for hiding this comment

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

because else it would default to the pkgs defined by the user for the rest of the system, but for example pkgs.buildGoPackage is depricated and removed in newer channels so it has to use the 21.05 channel

Yeah, noticed that already, see my comment below.

Comment on lines +89 to +92
{ inputs, ... }: {
imports = [ inputs.shabitica.nixosModules.default ];
#... add your configuration
}
Copy link
Member

Choose a reason for hiding this comment

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

If I'd look at this from a beginner perspective: Where does the inputs attribute come from? Is it a module argument? Is it from another Flake?

@aszlig
Copy link
Member

aszlig commented Feb 12, 2025

the go-camo package had the problem that 25.5 will depricate buildGoPackage so i passed the pkgs from the default module to imageproxy. dont know if its the cleanest way

Ah, that explains why you passed the module as an attribute set. This however not only has the mentioned issues but also makes it hard to change the module (eg. if the module no longer is a function, we'd need to change the import).

I'd instead add another internal option, eg. shabitica.pinnedPkgs and pass it via the flake's module definition. That way we can not only use it for the go-camo case but also for eg. Node.js 10, which I'm pretty sure won't work on newer NixOS releases.

@lomenzel
Copy link
Contributor Author

I'd instead add another internal option, eg. shabitica.pinnedPkgs and pass it via the flake's module definition.

thats defenitly a better idea 💡

@lomenzel
Copy link
Contributor Author

ok now i messed it up completely. trying to rebuild the system now throws:

 error: Please be informed that this pseudo-package is not the only part of
       Nixpkgs that fails to evaluate. You should not evaluate entire Nixpkgs
       without some special measures to handle failing packages, like those taken
       by Hydra.

@lomenzel
Copy link
Contributor Author

still does not work

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.

git:// not working anymore, can't change git:// to https://

2 participants