Icy-Thought / snowflake

A repository which contains my current Nix (flake-based) setup!
GNU Affero General Public License v3.0
174 stars 11 forks source link

Installing Nix-Flake System section needs an update (maybe) #25

Closed HassanYA closed 4 months ago

HassanYA commented 4 months ago

Hello Many thanks for sharing your amazing setup. I want to try it out. I cannot help but get confused by the "Installing Nix-Flake System" section. I think either the command or the text is incorrect.

Icy-Thought commented 4 months ago

It is outdated indeed, I need to revise it at some point. Hopefully I can do that this weekend otherwise the week after. Nonetheless, you can always comment here and I will try to help you out! :blush:

Icy-Thought commented 4 months ago

I had some spare time to rewrite bits of the README.md. (more to come)

Any suggestions that you reckon I should add to the installation section?

HassanYA commented 4 months ago

Thanks. I'll go through the entire thing Sunday or Monday. I am a newbie to nix and ricing in general. I'll be sure to leave feedback if necessary.

HassanYA commented 4 months ago

Hello again. So I followed the steps except for hiding files from file managers. I did one additional step to add a label to ext4 partition.

when i run: nixos-rebuild switch --use-remote-sudo --flake .#conf-name --impure

I get the following message: error: flake 'git+file:///home/hasan/Workspace/public/snowflake?shallow=1' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."conf-name".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."conf-name".config.system.build.nixos-rebuild' or 'nixosConfigurations."conf-name".config.system.build.nixos-rebuild'

I executed this command on my ~/Workspace/public/snowflake . I do not know if that made a difference. I do not know where to place DEVICE-X in nixos-rebuild switch --use-remote-sudo --flake .#conf-name --impure

can you please help

Icy-Thought commented 4 months ago

I need to clarify that part, DEVICE-X is the name you choose as a hostname for your device and then you replace the conf-name bit with that name (the DEVICE-X)

HassanYA commented 4 months ago

I have executed the below, more or less it's the same error :(

[nix-shell:~/Workspace/public/snowflake]$ sudo nixos-rebuild switch --flake .#hasan --impure
warning: Git tree '/home/hasan/Workspace/public/snowflake' is dirty
error: flake 'git+file:///home/hasan/Workspace/public/snowflake?shallow=1' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."hasan".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."hasan".config.system.build.nixos-rebuild' or 'nixosConfigurations."hasan".config.system.build.nixos-rebuild'
HassanYA commented 4 months ago

I can add my stuff into a remote repo if you'd like. maybe i made a mistake

icefishii commented 4 months ago

Getting the exact same error as @HassanYA moved the stuff to hosts/laptop and ran sudo nixos-rebuild switch --flake .#laptop --impure even checked again if i was in the right folder

Icy-Thought commented 4 months ago

Going to replicate the setup in tomorrow and try to document + respond with the proper answer. Apologies y'all.

icefishii commented 4 months ago

No worries, if u need someone to test it again just @ me here

Icy-Thought commented 4 months ago

@HassanYA just to make sure I got you right, where did you store your device configuration files?

HassanYA commented 4 months ago

Inside ~/Workspace/public/snowflake/hosts/hasan

Icy-Thought commented 4 months ago

@HassanYA Try git add ./hosts/hasan/* from snowflake repo then nixos-rebuild switch --use-remote-sudo --flake .#hasan --impure

Icy-Thought commented 4 months ago

@icefishii if you have some spare time, please try the above suggestion too and report back if it fixed the issue. :)

icefishii commented 4 months ago

okii, will try it when I get home tonight

icefishii commented 4 months ago

that worked! tried it in a vm and it went smooth this time :)

HassanYA commented 4 months ago

for me, it did a bunch of copying then failed with below. Unlike @icefishii, I am not using a VM

$ sudo nixos-rebuild switch --flake .#hasan --impure

error:
       … while calling the 'seq' builtin

         at /nix/store/lwyjz70qh12nq6cb7fixl85vryzxqm3c-source/lib/modules.nix:322:18:

          321|         options = checked options;
          322|         config = checked (removeAttrs config [ "_module" ]);
             |                  ^
          323|         _module = checked (config._module);

       … while calling the 'throw' builtin

         at /nix/store/lwyjz70qh12nq6cb7fixl85vryzxqm3c-source/lib/modules.nix:298:18:

          297|                     ''
          298|             else throw baseMsg
             |                  ^
          299|         else null;

       error: The option `modules.desktop.extensions.player' does not exist. Definition values:
       - In `/nix/store/lwyjz70qh12nq6cb7fixl85vryzxqm3c-source/flake.nix':
           {
             music = {
               enable = true;
             };
             video = {
           ...
icefishii commented 4 months ago

you'll need to change up some stuff in the config I think it was in the default.nix under ./hosts/xyz

icefishii commented 4 months ago

cause the module it's referencing doesn't exist

Icy-Thought commented 4 months ago

Finally, thanks for confirming it and happy nixing @icefishii !!! xD

@HassanYA, modules.desktop.extensions.player is actually modules.desktop.toolset.player and I am to blame for that issue.. forgot to update the structure of the template. Apologies..

Going to push the updated version in a couple of minutes.

Icy-Thought commented 4 months ago

Done!

Also, I don't know if you read the hardware.nix file or not, but make sure to enable/disable the other CPU configuration setting!

https://github.com/Icy-Thought/snowflake?tab=readme-ov-file#2-remove-redundant-cpu-setting

HassanYA commented 4 months ago

I am using /etc/hardware-configuration.nix so I should Ran following commands $ git reset head --hard $ git pull $ cp -r templates/hosts/desktop hosts/hasan $ cp /etc/nixos/hardware-configuration.nix hosts/hasan/hardware.nix $ git add . $ nixos-rebuild switch --use-remote-sudo --flake .#hasan --impure

I get this output:

trace: warning: The option `services.gnome.chrome-gnome-shell.enable' defined in `/nix/store/3pzj0xnxy8jzmqkpnm0lvzz7la3x315k-source' has been renamed to `services.gnome.gnome-browser-connector.enable'.
error: builder for '/nix/store/ylwd5hpl30gnkn9izj1xhp18r8q58nir-user-units.drv' failed with exit code 1;
       last 1 log lines:
       > ln: failed to create symbolic link '/nix/store/q7bqggcchzcncg6663xcx3vs6j4gjj2g-user-units/xdg-desktop-portal-gtk.service': File exists
       For full logs, run 'nix log /nix/store/ylwd5hpl30gnkn9izj1xhp18r8q58nir-user-units.drv'.
error: 1 dependencies of derivation '/nix/store/fpsk5i922g6h5zz3d6d9y9wf7kgb5p70-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/86q74qi9vi7r8mawdbmr80qn4h7ywgkj-nixos-system-hasan-24.05.20240229.1536926.drv' failed to build

Sorry for the bother

Icy-Thought commented 4 months ago

@HassanYA What you do when you have similar errors is grep for the complaint and disable/enable or replace with newer setting version found in the nixos option site.

As you can see, this time it complained about services.gnome.chrome-gnome-shell.enable was renamed to services.gnome.gnome-browser-connector.enable. You can just replace it where defined with your option. (will update repo soon)

Icy-Thought commented 4 months ago

Also, the hardware.nix file in your hosts/hassan (or whatever you choose to name your host device) will override hardware-configuration.nix. Therefore you ought to copy and paste the necessary bits into that file before you proceed with the installation.

HassanYA commented 4 months ago

After some tweaking, it finally works. Many thanks for the lessons and setup <3

Icy-Thought commented 4 months ago

Let's go!!! :rocket:

No worries, happy to help!