aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

migrate system configuration to flake.nix #11

Closed aleeusgr closed 1 year ago

aleeusgr commented 1 year ago

I want to have functionality similar to this repo: https://github.com/harryprayiv/nix-config but I want to build it bottom up.

  1. Tweag Blog 3

needed to change https://github.com/aleeusgr/nix-things/blob/b5ed3889f1bb15217e7106b8e77c5f1b628a6461/flake.nix#L9

  1. Separate configs into system, home and per-project. https://nixos.wiki/wiki/Home_Manager https://gvolpe.com/blog/nix-flakes/

  2. Set Up GitHub CI

aleeusgr commented 1 year ago
Warning ``` trace: warning: system.stateVersion is not set, defaulting to 23.05. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion. ``` ``` trace: warning: The option `nix.binaryCaches' defined in `/nix/store/n9pa6xavxwkbhc68a8yky22x1zkayx08-source/configuration.nix' has been renamed to `nix.settings.substituters'. trace: warning: The option `nix.binaryCachePublicKeys' defined in `/nix/store/n9pa6xavxwkbhc68a8yky22x1zkayx08-source/configuration.nix' has been renamed to `nix.settings.trusted-public-keys'. ```
aleeusgr commented 1 year ago
error: cannot look up home-manager/nixos in pure evaluation error: cannot look up '' in pure evaluation mode (use '--impure' to override) at /nix/store/zsrmbgg6gz5v99jz2yp8rxkq2sckpxdx-source/configuration.nix:11:7: 10| ./hardware-configuration.nix 11| | ^ 12| ]; (use '--show-trace' to show detailed location information) ``` error: The option `home-manager' does not exist. Definition values: - In `/nix/store/isbn9mrmqbwdsg75g4jddi2g92grmjfm-source/configuration.nix': { useGlobalPkgs = true; users = { alex = ; }; ... ``` trace: warning: The option `nix.binaryCaches' defined in `/nix/store/n9pa6xavxwkbhc68a8yky22x1zkayx08-source/configuration.nix' has been renamed to `nix.settings.substituters'. trace: warning: The option `nix.binaryCachePublicKeys' defined in `/nix/store/n9pa6xavxwkbhc68a8yky22x1zkayx08-source/configuration.nix' has been renamed to `nix.settings.trusted-public-keys'.
aleeusgr commented 1 year ago

Adding a flake changed my channel to unstable.

I just scrolled through it, and the environment.systemPackages contains a lot of stuff thats better suited in a project based shell, rather than installed globally

aleeusgr commented 1 year ago

https://nix-community.github.io/home-manager/index.html#sec-install-nixos-module https://mipmip.github.io/home-manager-option-search/

aleeusgr commented 1 year ago

Try this

aleeusgr commented 1 year ago

Solved:

Hello! How do I setup my home manager in a flake?

I got flake.nix from here and home.nix here

I get an error:

09:01 $ sudo nixos-rebuild switch --flake .
error: flake 'git+file:///home/alex/workshop/nix-things' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild' or 'nixosConfigurations."nixos".config.system.build.nixos-rebuild'

What should I change? Thank you

My code: https://github.com/aleeusgr/nix-things/tree/home

Nobbz:

The flake has the "hostname" system as its output, though your machines hostname is "nixos", so you have to change one