Athena-OS/athena-nix

[ENHANCEMENT]: Use nixosModules

Closed this issue ยท 42 comments

I would like to import this as a nixosModule to my existing Configuration.

Try to use flakes

I'm using flakes. How do I use it with my existing configuration?

U should integrate some expressions in configuration.nix file of Athena and put in your configuration file and importing all the structure (files and folders)

image
I have a many servers, services and users in configuration.nix. Changing the entire structure is too much work. just copying the files from athena is also a lot of work. espacially if it has to be done over and over again for each individual person that is already using nix. A nixosModule would be the best way to add configutations to ones system. My entire configuration has 6181 lines of nix code, adapting to use athena (what I really would like), would be some much easier if I only would do athena = { enable = true; shell = "zsh"; ... }

Mmh, currently my Nix exp does not involve NixOSModules. Can you try to create it?

I mean I can try. Also is there going to be hyperland? There is also this project: https://github.com/end-4/dots-hyprland

I have a Hyprland theme to use. The problem is that it needs to write on files that in NixOS are intended to be read-only. If there is a simple dotfiles tested and working, I can implement in Athena Nix.

I have a Hyprland theme to use. The problem is that it needs to write on files that in NixOS are intended to be read-only. If there is a simple dotfiles tested and working, I can implement in Athena Nix.

Whats the problem exactly. Can you link some code where you want to write?

This is the env I would like to integrate: https://github.com/end-4/dots-hyprland

I can make 3 PRs by next week:

@D3vil0p3r can you review #16 and maybe you could try to add hyperland? It was already much work to refactor big parts of the code, and I'm still not done yet.

It is long to review, but I see that you refactored the code for Athena Nix Flake in order to make it more flexible... But since you edited several default.nix files, are you tested if it still works in case a user uses nixos-rebuild switch with the configuration.nix file instead of flakes?

I tested it now by using the configuration.nix file and I get:

error: The option `athena-nix.homeManagerUser' is used but not defined.

If the proposal does not work both for configuration.nix and flakes, I cannot merge the related PR.

How have you tested it? Afaik it should work with both, I have tested it and it worked for me. The error you are describing occures, when athena-nix.homeManagerUser is not set. I'll put in defaults, so this error won't happen anymore. You can try again.

how have you tested it. Afaik it should work with both, I have tested it and it worked for me. The error you are describing occures, when athena-nix.homeManagerUser is not set. I'll put in defaults, so this error won't happen anymore.

I expected that error because in configuration.nix it should be set. By the way I just cloned your forked repository, I copied all files in /etc/nixos and I run sudo nixos-rebuild switch.

Note that all the changes done by the users must be tweaked in only configuration.nix because this file is connected to the Athena installer.

Oh you are right. I haven't touched the configuration nix stuff. I can fix it really quick.

Ok, should hopefully be fixed. please test it once again.

Getting:

       error: attribute 'username' missing

       at /etc/nixos/modules/dev/tmux/default.nix:14:26:

           13|   config = lib.mkIf config.athena-nix.baseConfiguration {
           14|     home-manager.users.${config.athena-nix.username} = { pkgs, ... }: {
             |                          ^
           15|       programs.tmux = {

I'm sorry that I have to use you as a current test bench, should be fixed. Do you want the configuration option named athena-nix or just athena?

Just athena

changed.

I get:

error: The option `home-manager.users.athena.home.stateVersion' is used but not defined.

yup, also this is fixed. I got confused by the old config smh.

Another error:

       at /etc/nixos/modules/misc/nist-feed/default.nix:4:9:

            3| let
            4|   cfg = config.services.nist-feed;
             |         ^
            5|   nistFeedPkg = pkgs.callPackage ../../../pkgs/nist-feed/package.nix { };

Can you please test on your clean NixOS machine? Otherwise I stuck at testing it several times and getting errors.

I dont really have a system that I can use rn, that the problem.

Did you refactor all those files without testing in a system?

I included it in my system config. But I can't just do switching, because I don't even have an /etc/nixos/hardware-configuration.nix. I would need some clean system by any possiblity.

Try to set up a VM

I coudn't get the VM to setup, but I figured out a way to test it.

WELL, that was the last error anyway xD. Please tell me if you encounter any runtime errors.

Ok it seems to work. I need just to test it by the installer and cyber roles. My question: why did you propose this refactoring instead of the previous structure? What are the advantages?

now everything is a module. making it less a configurations, rather more a package that you can universally through at any existing configuration. I can't really explain what all the benefits of modules are, but the main advantage is that you can now change your configuration without touching this git repo / or cloneing it.

image
you basically can add it in flake inputs like "home-manager", and you have all the configuration needed to use athenaos.

Ok it seems to work. I need just to test it by the installer and cyber roles. My question: why did you propose this refactoring instead of the previous structure? What are the advantages?

@D3vil0p3r any updates?

Hey. I need to find free time to check it in deep and merge the PR. In these weeks will be hard to find time, but I try to get some dedicated moments for it.

@D3vil0p3r can you review #16 and maybe you could try to add hyperland? It was already much work to refactor big parts of the code, and I'm still not done yet.

so, have you any suggestions on using hyperland. You told me that you wanned to include an env from end-4, I didn't quite get the problem in doing it. I really enjoy the look and style of this (https://athenaos.org/en/configuration/hyperland), I'm already using hyperland, but coudn't get ags to working.

@D3vil0p3r can you review #16 and maybe you could try to add hyperland? It was already much work to refactor big parts of the code, and I'm still not done yet.

so, have you any suggestions on using hyperland. You told me that you wanned to include an env from end-4

I did some attempts time ago but it could not be possible because of immutability of NixOS env.

@D3vil0p3r can you review #16 and maybe you could try to add hyperland? It was already much work to refactor big parts of the code, and I'm still not done yet.

so, have you any suggestions on using hyperland. You told me that you wanned to include an env from end-4

I did some attempts time ago but it could not be possible because of immutability of NixOS env.

usually this shoudn't be any problem at all. Maybe you could try again, and show me the exact errors you got, then I might be able to help you.

The problem is that one component (I don't remember if ags) attempts to write on its installation folder (that in NixOS is under /nix/store, so read-only).

The problem is that one component (I don't remember if ags) attempts to write on its installation folder (that in NixOS is under /nix/store, so read-only).

Haven't you keeped the configurations files somewhere? So we can try to fix those errors? Sometimes programs try to write into their installation folder, but usually this can be fixed.

Is this issue still relevant ? @DerDennisOP

Is this issue still relevant ? @DerDennisOP

I would like to have hyprland integration, but we can make a new issue for this.

Yes. Let's open a dedicated issue ticket.