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

Add NixOS Flake #26

Merged
merged 66 commits into from
Jun 1, 2024
Merged

Add NixOS Flake #26

merged 66 commits into from
Jun 1, 2024

Conversation

Svenum
Copy link
Contributor

@Svenum Svenum commented Apr 20, 2024

I try to add the nixos flake, but I am not very experienced. So if you want to help, fell free. 😄

@mdvmeijer
Copy link

Hello, thank you for the PR. I also tried my hand at creating a Nix package for fw-fanctrl a while ago, but without the flake.

Using your package + flake, if I run nix build and run the resulting executable, I get the following repeated output:

Could not start dynamically linked executable: ectool
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

Are you able to successfully run fw-fanctrl using your flake? If so, how?

@Svenum
Copy link
Contributor Author

Svenum commented Apr 28, 2024

Ok, I am able to build it just like you sad nix build and then there is the "result/bin" folder with the needed executables in it.

@Svenum
Copy link
Contributor Author

Svenum commented Apr 28, 2024

I run my system on unstable branch of NixOS maybe that is something?

@dantefromhell
Copy link

I'm running into the same issue as @mdvmeijer reported, running on nixpkgs-unstable@2748d22b - although a slightly outdated (2 weeks old).

❯ cat /etc/os-release
ANSI_COLOR="1;34"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="24.05.20240413.90055d5"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 24.05 (Uakari)"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="24.05 (Uakari)"
VERSION_CODENAME=uakari
VERSION_ID="24.05"
❯ nix build 'github:TamtamHero/fw-fanctrl/68a710cd3ac6ed0000cbb0bd147b6de4e0bd6689' && result/bin/ectool
Could not start dynamically linked executable: result/bin/ectool
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

@Svenum
Copy link
Contributor Author

Svenum commented Apr 28, 2024

Ok, just to be sure you did this:

  1. git clone https://github.com/Svenum/fw-fanctrl
  2. cd fw-fanctrl
  3. git checkout add-flake
  4. nix build .

@mdvmeijer
Copy link

Yes, I followed those four steps. I'm wondering, are you using NixOS or just the Nix package manager on another distro? It seems like the package should just not work on NixOS since it uses the ./bin/ectool binary directly from this repo without any changes done for NixOS.

My guess for fixing this:

I would try this myself, but https://github.com/ssddq/fw-ectool doesn't seem to be updated to support AMD yet, so I'll first have to make a PR for that. I don't have easy access to my Intel FW for now.

@Svenum
Copy link
Contributor Author

Svenum commented Apr 28, 2024

Ok, weird. I use NixOS. I dont understand why I could build this and you dont. Yes to add it as build input could work.
I'll try. I have an framework 16 I hope it works if you say it does not work on amd.

@mdvmeijer
Copy link

Hmm okay, then I'm not sure. Could be that you have ectool already installed globally? But if not then I'm also out of ideas.

@Svenum
Copy link
Contributor Author

Svenum commented Apr 28, 2024

Not that I know.... But does not matter. I add it to the build inputs that it work for everyone 😉

@Svenum
Copy link
Contributor Author

Svenum commented May 3, 2024

Sorry for the late respond @mdvmeijer @dantefromhell. I added the built input now.

@Svenum
Copy link
Contributor Author

Svenum commented May 3, 2024

@mdvmeijer @dantefromhell @TamtamHero:

I have got it working, but now I got this errors:

Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC
Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC
model: Framework laptop 13, cpu_type: AMD, fan_count: 0
Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC
speed: 15% temp: 0°C movingAverage: 0.0°C
Missing Chromium EC memory map.
Cannot find I2C adapter
Unable to establish host communication
Couldn't find EC

And I have an Framework 16 but it says: model: Framework laptop 13, cpu_type: AMD, fan_count: 0

@Svenum Svenum mentioned this pull request May 3, 2024
@leopoldhub
Copy link
Collaborator

Just synced the nix branch

@Svenum
Copy link
Contributor Author

Svenum commented Jun 1, 2024

@leopoldhub please check my answers and the new code. 😄

install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
pre-uninstall.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
@leopoldhub
Copy link
Collaborator

I will check everything one more time, but it should be good 👍

Copy link
Collaborator

@leopoldhub leopoldhub left a comment

Choose a reason for hiding this comment

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

should be the last small one

.github/workflows/nix-build.yml Outdated Show resolved Hide resolved
@leopoldhub
Copy link
Collaborator

Congratulations 🎉
All is well on my end, thanks again for all your hard work and contribution to this project!
@Svenum , would you like to be assigned automatically when a nix-related issue is opened?

@Svenum
Copy link
Contributor Author

Svenum commented Jun 1, 2024

Yes, I would love too help in the future on the nix side of this project. So assigning me is fine 👍

@leopoldhub leopoldhub merged commit f7afb49 into TamtamHero:packaging/nix Jun 1, 2024
@Svenum Svenum deleted the add-flake branch June 28, 2024 11:50
Svenum added a commit to Svenum/fw-fanctrl that referenced this pull request Aug 24, 2024
* initial

* update gitignore

* update inputs

* add fw-ectool dependencie

* add module

* fix tabs

* fix package

* fix typo

* fix service

* fix type

* add options

* fix service

* fix build inputs

* add Readme + add suspend script

* remove unneeded };

* fix pkgs.writeShellScript

* remvoe \

* try

* add self

* fix module

* update package

* fix package

* use sleep script

* add config options

* fix typo

* fix typo

* add defaults

* fix type

* add prettyier

* remove beautifyer

* udpate readme

* update installer script

* add missing path

* Update README.md

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update flake.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update nix/module.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* add descriptions

* fix uninstall

* update readme

* add description

* remove requiremetns.txt + add github actions

* update action

* rename workflow test

* fix service

* try

* try

* Update README.md

* Update README.md

* chagne flake description

* fix suspend script

* fix script

* fix path

* fix install.sh

* fix --no-sudo

* add --no-sudo to other scripts

* fix check

* add option check

* add missing "

* Rename nix action

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Svenum added a commit to Svenum/fw-fanctrl that referenced this pull request Aug 25, 2024
* initial

* update gitignore

* update inputs

* add fw-ectool dependencie

* add module

* fix tabs

* fix package

* fix typo

* fix service

* fix type

* add options

* fix service

* fix build inputs

* add Readme + add suspend script

* remove unneeded };

* fix pkgs.writeShellScript

* remvoe \

* try

* add self

* fix module

* update package

* fix package

* use sleep script

* add config options

* fix typo

* fix typo

* add defaults

* fix type

* add prettyier

* remove beautifyer

* udpate readme

* update installer script

* add missing path

* Update README.md

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update flake.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update nix/module.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* add descriptions

* fix uninstall

* update readme

* add description

* remove requiremetns.txt + add github actions

* update action

* rename workflow test

* fix service

* try

* try

* Update README.md

* Update README.md

* chagne flake description

* fix suspend script

* fix script

* fix path

* fix install.sh

* fix --no-sudo

* add --no-sudo to other scripts

* fix check

* add option check

* add missing "

* Rename nix action

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Svenum added a commit to Svenum/fw-fanctrl that referenced this pull request Aug 25, 2024
* initial

* update gitignore

* update inputs

* add fw-ectool dependencie

* add module

* fix tabs

* fix package

* fix typo

* fix service

* fix type

* add options

* fix service

* fix build inputs

* add Readme + add suspend script

* remove unneeded };

* fix pkgs.writeShellScript

* remvoe \

* try

* add self

* fix module

* update package

* fix package

* use sleep script

* add config options

* fix typo

* fix typo

* add defaults

* fix type

* add prettyier

* remove beautifyer

* udpate readme

* update installer script

* add missing path

* Update README.md

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update flake.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update nix/module.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* add descriptions

* fix uninstall

* update readme

* add description

* remove requiremetns.txt + add github actions

* update action

* rename workflow test

* fix service

* try

* try

* Update README.md

* Update README.md

* chagne flake description

* fix suspend script

* fix script

* fix path

* fix install.sh

* fix --no-sudo

* add --no-sudo to other scripts

* fix check

* add option check

* add missing "

* Rename nix action

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
leopoldhub added a commit that referenced this pull request Aug 25, 2024
* Adding @Svenum as an assignee to nix-related issues (#43)

* Fixing adding @Svenum as an assignee to nix-related issues (#44)

(non contributors cannot be assigned to issues)

* Reload will report if config couldn't be parsed and the service keeps running. (#46)

Authored-by: Nina Alexandra Klama <nina-git@klama.name>

* Removing binary blobs from the project (#51)

* removing binary blobs from the project.
we now fetch the ectool from the gitlab artifacts and confirm the checksum.

* remove bin references from README.md

* extracting $TEMP_FOLDER from installEctool

* Fix README spelling/grammer, fix "FrameWork" capitalization in service description (#52)

* Review README spelling/grammar

* Fix "FrameWork" capitalization in service

* Clarify behaviour on service stop or pause (#53) (#55)

* Separating FanController into different subclasses to allow HardwareController and SocketController diversity. 2 (Repost of #50) (#58)

* separating `FanController` into different subclasses to allow `HardwareController` and `SocketController` diversity

* adding the new arguments into the README.md

* fixing an indentation error causing `--strategy <strategy>` not to work (the simple `<strategy>` still worked)

* fixing missing print for command execution (#63)

* forcing utf-8 encoding for socket messages and usage of stopServerSocket method instead of manual closing, as well as updating error detection pattern (#64)

* README.md documentation update (#65)

* forcing utf-8 encoding for socket messages and usage of stopServerSocket method instead of manual closing, as well as updating error detection pattern

* README.md documentation update

* change log format on fatal crash

* fix badges links

* adding windows platform badge and issue template

* fix `:` instead of `=`

* disabling part of the README.md while waiting for merge

* Command arguments refactoring Pt.1 (#66)

* forcing utf-8 encoding for socket messages and usage of stopServerSocket method instead of manual closing, as well as updating error detection pattern

* README.md documentation update

* change log format on fatal crash

* fix badges links

* adding windows platform badge and issue template

* fix `:` instead of `=`

* first part of the command argument refactoring.

the old argument format is deprecated but still usable.

improved feedback when executing commands.

#31

* trim blank lines in README.md

* finishing touches (#67)

* add no battery mode for mainboards without battery (#69)

* add configuration for no battery mode in hardware controller

* fix wrong line getting noBatteryMode

* dynamically fetching battery sensor on init/reload

* add --no-battery flag for install

* update readme with --no-battery flag

* rework no battery config to come from service args

* change sensors to be ectool specific

- reword the argument to be more clear about battery sensors
- move `noBatteryMode` and `nonBatterySensors` to EctoolHardwareController
- update `getNonBatterySensors` to be able to handle more than one sensor
- update installer and readme accordingly

* update grep command for checking existing `--no-battery-sensors`

* combine getTemperature functions to one

* add documentation for run option `--no-battery-sensors`

* rename variable `NO_BATTERY` to `NO_BATTERY_SENSOR`

* update the installer to use existing placeholder format

* rename noBatterySensorMode variables and functions for clarity

* rename placeholder to `NO_BATTERY_SENSOR_OPTION` for clarity

* update comments in installer to reflect new argument name

* adding ectool sub-dependency to documentation (#70)

* typo "tempurature" => "temperature" (#71)

typo "tempurature" => "temperature"

* typo "tempurature" => "temperature" (#72)

typo "tempurature" => "temperature"

* Add ToC + link to NixOS Documentation (#75)

* add doc folder

* update nix link

* add toc

* add link

* add missin #

* add doc

* fix link

* add new line under titles

* add --no-sudo option (#76)

* Add choice to print fan speed percentage (#78)

* Add option to print current speed percentage

* Update README.md

* Update commands.md

* Add print choice descriptions to help text

* add missing no_sudo check (#79)

* Add NixOS Flake (#26)

* initial

* update gitignore

* update inputs

* add fw-ectool dependencie

* add module

* fix tabs

* fix package

* fix typo

* fix service

* fix type

* add options

* fix service

* fix build inputs

* add Readme + add suspend script

* remove unneeded };

* fix pkgs.writeShellScript

* remvoe \

* try

* add self

* fix module

* update package

* fix package

* use sleep script

* add config options

* fix typo

* fix typo

* add defaults

* fix type

* add prettyier

* remove beautifyer

* udpate readme

* update installer script

* add missing path

* Update README.md

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update flake.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update nix/module.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* add descriptions

* fix uninstall

* update readme

* add description

* remove requiremetns.txt + add github actions

* update action

* rename workflow test

* fix service

* try

* try

* Update README.md

* Update README.md

* chagne flake description

* fix suspend script

* fix script

* fix path

* fix install.sh

* fix --no-sudo

* add --no-sudo to other scripts

* fix check

* add option check

* add missing "

* Rename nix action

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update branch to main branch (#54)

* Adding @Svenum as an assignee to nix-related issues (#43)

* Fixing adding @Svenum as an assignee to nix-related issues (#44)

(non contributors cannot be assigned to issues)

* Reload will report if config couldn't be parsed and the service keeps running. (#46)

Authored-by: Nina Alexandra Klama <nina-git@klama.name>

* Removing binary blobs from the project (#51)

* removing binary blobs from the project.
we now fetch the ectool from the gitlab artifacts and confirm the checksum.

* remove bin references from README.md

* extracting $TEMP_FOLDER from installEctool

* Fix README spelling/grammer, fix "FrameWork" capitalization in service description (#52)

* Review README spelling/grammar

* Fix "FrameWork" capitalization in service

* use ectool form nixpkgs

* update flake

* remove old deps

* remove duplicated pkgs

---------

Co-authored-by: Léopold Hubert <hubertleopold01@gmail.com>
Co-authored-by: Nina Alexandra Klama <github@fklama.de>
Co-authored-by: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com>

* Update to main branch + switch to fw-ectool (#61)

* Adding @Svenum as an assignee to nix-related issues (#43)

* Fixing adding @Svenum as an assignee to nix-related issues (#44)

(non contributors cannot be assigned to issues)

* Reload will report if config couldn't be parsed and the service keeps running. (#46)

Authored-by: Nina Alexandra Klama <nina-git@klama.name>

* Removing binary blobs from the project (#51)

* removing binary blobs from the project.
we now fetch the ectool from the gitlab artifacts and confirm the checksum.

* remove bin references from README.md

* extracting $TEMP_FOLDER from installEctool

* Fix README spelling/grammer, fix "FrameWork" capitalization in service description (#52)

* Review README spelling/grammar

* Fix "FrameWork" capitalization in service

* Clarify behaviour on service stop or pause (#53) (#55)

* Separating FanController into different subclasses to allow HardwareController and SocketController diversity. 2 (Repost of #50) (#58)

* separating `FanController` into different subclasses to allow `HardwareController` and `SocketController` diversity

* adding the new arguments into the README.md

* fixing an indentation error causing `--strategy <strategy>` not to work (the simple `<strategy>` still worked)

* add fw-ectool in module

* fixing missing print for command execution (#63)

---------

Co-authored-by: Léopold Hubert <hubertleopold01@gmail.com>
Co-authored-by: Nina Alexandra Klama <github@fklama.de>
Co-authored-by: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com>

* add doc + .gitignore

* Add NixOS Flake (#26)

* initial

* update gitignore

* update inputs

* add fw-ectool dependencie

* add module

* fix tabs

* fix package

* fix typo

* fix service

* fix type

* add options

* fix service

* fix build inputs

* add Readme + add suspend script

* remove unneeded };

* fix pkgs.writeShellScript

* remvoe \

* try

* add self

* fix module

* update package

* fix package

* use sleep script

* add config options

* fix typo

* fix typo

* add defaults

* fix type

* add prettyier

* remove beautifyer

* udpate readme

* update installer script

* add missing path

* Update README.md

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update flake.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update nix/module.nix

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* add descriptions

* fix uninstall

* update readme

* add description

* remove requiremetns.txt + add github actions

* update action

* rename workflow test

* fix service

* try

* try

* Update README.md

* Update README.md

* chagne flake description

* fix suspend script

* fix script

* fix path

* fix install.sh

* fix --no-sudo

* add --no-sudo to other scripts

* fix check

* add option check

* add missing "

* Rename nix action

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

* Update branch to main branch (#54)

* Adding @Svenum as an assignee to nix-related issues (#43)

* Fixing adding @Svenum as an assignee to nix-related issues (#44)

(non contributors cannot be assigned to issues)

* Reload will report if config couldn't be parsed and the service keeps running. (#46)

Authored-by: Nina Alexandra Klama <nina-git@klama.name>

* Removing binary blobs from the project (#51)

* removing binary blobs from the project.
we now fetch the ectool from the gitlab artifacts and confirm the checksum.

* remove bin references from README.md

* extracting $TEMP_FOLDER from installEctool

* Fix README spelling/grammer, fix "FrameWork" capitalization in service description (#52)

* Review README spelling/grammar

* Fix "FrameWork" capitalization in service

* use ectool form nixpkgs

* update flake

* remove old deps

* remove duplicated pkgs

---------

Co-authored-by: Léopold Hubert <hubertleopold01@gmail.com>
Co-authored-by: Nina Alexandra Klama <github@fklama.de>
Co-authored-by: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com>

* Update to main branch + switch to fw-ectool (#61)

* Adding @Svenum as an assignee to nix-related issues (#43)

* Fixing adding @Svenum as an assignee to nix-related issues (#44)

(non contributors cannot be assigned to issues)

* Reload will report if config couldn't be parsed and the service keeps running. (#46)

Authored-by: Nina Alexandra Klama <nina-git@klama.name>

* Removing binary blobs from the project (#51)

* removing binary blobs from the project.
we now fetch the ectool from the gitlab artifacts and confirm the checksum.

* remove bin references from README.md

* extracting $TEMP_FOLDER from installEctool

* Fix README spelling/grammer, fix "FrameWork" capitalization in service description (#52)

* Review README spelling/grammar

* Fix "FrameWork" capitalization in service

* Clarify behaviour on service stop or pause (#53) (#55)

* Separating FanController into different subclasses to allow HardwareController and SocketController diversity. 2 (Repost of #50) (#58)

* separating `FanController` into different subclasses to allow `HardwareController` and `SocketController` diversity

* adding the new arguments into the README.md

* fixing an indentation error causing `--strategy <strategy>` not to work (the simple `<strategy>` still worked)

* add fw-ectool in module

* fixing missing print for command execution (#63)

---------

Co-authored-by: Léopold Hubert <hubertleopold01@gmail.com>
Co-authored-by: Nina Alexandra Klama <github@fklama.de>
Co-authored-by: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com>

---------

Co-authored-by: Léopold Hubert <hubertleopold01@gmail.com>
Co-authored-by: Nina Alexandra Klama <github@fklama.de>
Co-authored-by: DeflateAwning <11021263+DeflateAwning@users.noreply.github.com>
Co-authored-by: Oli Thornton <50975890+saizo80@users.noreply.github.com>
Co-authored-by: Ryan <speenah@pm.me>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
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.

6 participants