Skip to content
This repository was archived by the owner on Aug 21, 2025. It is now read-only.

Add flake.nix#7

Open
supermarin wants to merge 2 commits intonikosdion:mainfrom
supermarin:main
Open

Add flake.nix#7
supermarin wants to merge 2 commits intonikosdion:mainfrom
supermarin:main

Conversation

@supermarin
Copy link
Copy Markdown
Contributor

Feel free to close this one if you strongly feel against nix - I'll keep it in my fork.
For nix(os) users:

This PR enables a couple of things, like running asdcontrol without installing:

nix run github:nikosdion/asdcontrol

The flake also exposes a nix module that installs asdcontrol and enables udev rules for Studio Display and XDR Display.

# in flake.nix
inputs.asdcontrol.url = "github:nikosdion/asdcontrol";

# in configuration.nix or flake.nix in machine section
imports = [
  inputs.asdcontrol.modules.asdcontrol
];

# in configuration.nix
programs.asdcontrol.enable = true;

Build with:
$ nix build
The module automatically installs asdcontrol and the corresponding udev
rules. Usage:

1. Add the input in flake.nix
inputs.asdcontrol.url = "github:supermarin/asdcontrol";

2. Import the module in machine's configuration
imports = [
  inputs.asdcontrol.modules.asdcontrol
];

3. Enable asdcontrol in configuration.nix:
programs.asdcontrol.enable = true;
@nikosdion
Copy link
Copy Markdown
Owner

Don't worry, I am not the typical FOSS extremist you find on the Internet 🤣 I understand that my personal preference of distro has to do with my use case. I am fully aware that people with a different use case will find NixOS a match made in heaven for them. All I say about that is: Yay! More people using a FOSS OS!

I just have one question. Is the lock file necessary to be committed to the repository? I am mostly worried that since I don't have a NixOS installation I would never be able to update the lock file, which I assume would eventually fall behind, to the point it might start blocking installation. Kindly note that I have not used NixOS myself, so my question is based entirely on my experience with lock files from dependency managers for PHP and JavaScript which is my primary focus and area of expertise.

Thank you in advance for your reply!

@supermarin
Copy link
Copy Markdown
Contributor Author

That's a valid question!

The lock file ensures quite the opposite: say that in 2 years everything updates, from kernel to gcc. The lock file captures a state where everything works "with this version of nixpkgs(contains libs, gcc,...)".
If you didn't have a lock file, you'd need to start looking back what versions of the software this used to compile with, obtain it etc.
If you're concerned about the rest of codebase changing and flake.nix being stale, we can do 2 things:

  1. Add a GitHub action to compile every commit, or
  2. Tie the flake to a specific commit of this repo I think 1) is better because people will keep getting an older (although working) version of asscontrol

@nikosdion
Copy link
Copy Markdown
Owner

The lock file captures a state where everything works "with this version of nixpkgs(contains libs, gcc,...)".

Well, that's exactly my worry. This is a very simple program which compiles on pretty much anything. It came from a patched version of https://github.com/taylor/acdcontrol (from 2007, I kid you not) to which I had added support for the 27" Apple Cinema Display back in 2015. If you tried to compile the 2007 version it would still compile – it just doesn't know about the hardware released in the past 18 years.

Option 1 requires some headache to set up, and won't even update all that often since commits here are few and far between.

Option 2 appears to beat the purpose of having a package, since it will always serve the older version.

What I don't know is what will happen if the lock file is not present. Will it be installable or not?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants