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

[ENHANCEMENT]: Use nixosModules #13

Closed
DerDennisOP opened this issue Jul 9, 2024 · 42 comments
Closed

[ENHANCEMENT]: Use nixosModules #13

DerDennisOP opened this issue Jul 9, 2024 · 42 comments
Labels
enhancement New feature or request

Comments

@DerDennisOP
Copy link
Contributor

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

@DerDennisOP DerDennisOP added the enhancement New feature or request label Jul 9, 2024
@D3vil0p3r
Copy link
Member

Try to use flakes

@DerDennisOP
Copy link
Contributor Author

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

@D3vil0p3r
Copy link
Member

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)

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Jul 13, 2024

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"; ... }

@D3vil0p3r
Copy link
Member

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

@DerDennisOP
Copy link
Contributor Author

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

@D3vil0p3r
Copy link
Member

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.

@DerDennisOP
Copy link
Contributor Author

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?

@D3vil0p3r
Copy link
Member

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

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Jul 13, 2024

I can make 3 PRs by next week:

@DerDennisOP
Copy link
Contributor Author

@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.

@D3vil0p3r
Copy link
Member

D3vil0p3r commented Aug 1, 2024

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.

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Aug 1, 2024

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.

@D3vil0p3r
Copy link
Member

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.

@D3vil0p3r
Copy link
Member

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.

@DerDennisOP
Copy link
Contributor Author

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

@DerDennisOP
Copy link
Contributor Author

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

@D3vil0p3r
Copy link
Member

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 = {

@DerDennisOP
Copy link
Contributor Author

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?

@D3vil0p3r
Copy link
Member

Just athena

@DerDennisOP
Copy link
Contributor Author

changed.

@D3vil0p3r
Copy link
Member

I get:

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

@DerDennisOP
Copy link
Contributor Author

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

@D3vil0p3r
Copy link
Member

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.

@DerDennisOP
Copy link
Contributor Author

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

@D3vil0p3r
Copy link
Member

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

@DerDennisOP
Copy link
Contributor Author

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.

@D3vil0p3r
Copy link
Member

Try to set up a VM

@DerDennisOP
Copy link
Contributor Author

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

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Aug 1, 2024

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

@D3vil0p3r
Copy link
Member

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?

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Aug 1, 2024

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.

@DerDennisOP
Copy link
Contributor Author

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?

@D3vil0p3r
Copy link
Member

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.

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Aug 15, 2024

@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
Copy link
Member

@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.

@DerDennisOP
Copy link
Contributor Author

@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.

@D3vil0p3r
Copy link
Member

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).

@DerDennisOP
Copy link
Contributor Author

DerDennisOP commented Aug 15, 2024

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.

@AkechiShiro
Copy link
Contributor

Is this issue still relevant ? @DerDennisOP

@DerDennisOP
Copy link
Contributor Author

Is this issue still relevant ? @DerDennisOP

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

@D3vil0p3r
Copy link
Member

Yes. Let's open a dedicated issue ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants