Comments (6)
@shadowrylander I'm not sure, I think nixos-rebuild
assumes it can distinguish machines by their hostname
s, each associated with single system
. Either way it's not related to flake-utils
. Possibly https://discourse.nixos.org/ or https://github.com/NixOS/nix/issues would be more appropriate
from flake-utils.
@shadowrylander In advance: pardon me if I misunderstood or oversimplified your problem, I just skimmed through.
Flakes support a dedicated output type for nixos configurations. The wiki page demonstrates the interface:
{ self, ... }@inputs:
{
# ...
packages."<system>"."<packagename>" = /* ... */;
nixosConfigurations."<hostname>" = /* ... */ ;
# ...
}
You seem to be putting your nixosSystem
into flake's packages
output.:
packages = flake-utils.lib.flattenTree {
nixosConfigurations = let /* ... */ in nixosSystem /* ... */;
};
If nixosConfigurations
are per-hostname
and not per-system
, you probably don't even need flake-utils
's eachSystem
here.
if you want your flake to also provide some packages you probably can merge the output of flake-utils
with an attrset that has just nixosConfigurations
. That's a slippery slope though, since you're not supposed to be performing computations in your flake.nix
{
# ...
outputs = inputs@{ self, nixpkgs, flake-utils, ... }: (
with flake-utils.lib; eachSystem allSystems (system: let
pkgs = (import nixpkgs {}).legacyPackages.${system};
in rec {
packages = flake-utils.lib.flattenTree {
/* whatever */
}
defaultPackage = packages./* ... */;
})
) // {
nixosConfigurations.siluam = nixosSystem { /* ... */ };
};
}
On the side note, for the apps
you'd probably need to find the script that applies nixos configuration. An example with home-manager
(found somewhere on reddit): https://github.com/newkozlukov/dotfiles/blob/14ad265db18b58ee18198ccdb2612ac344d64676/flake.nix#L24
from flake-utils.
Fair enough! However, the packages
thing was me trying to (unsuccessfully) build my NixOS configuration for all possible systems; would your method do that? Or do you think it's not possible at all?
from flake-utils.
Idk, you could take defaultSystems
list (available in flake-utils
) and apply genAttrs
. The nixosSystem
function has a system
argument. As for where to put the output, I wouldn't know. That wouldn't be related to flake-utils
from flake-utils.
If I use genAttrs
, I wouldn't be able to use the flake without specifying a build target / system configuration, such as by using #configuration
, because without modifying the host name to reflect the system, the rebuild command wouldn't be able to automatically detect the correct configuration.
Sorry if this is confusing; basically, I'm worried that, instead of a configuration like hostname.system
, similar to how packages are defined with an attribute per system, the configurations would end up like hostname_system
, where the latter itself is the hostname of the machine.
from flake-utils.
Hmm... Which means the problem is with the usage of nixosConfigurations
, not eachSystem
... That's fair. Thanks for the help anyway; I think I know a way to build the systems dynamically!
from flake-utils.
Related Issues (20)
- feat: Cut more releases
- by-name HOT 7
- Q: why does flattenTree rely on recurseIntoAttrs? HOT 4
- eachDefaultSystem leads to missing architecture attributes HOT 4
- simpleFlake to support defaultSystems HOT 2
- Outputs spec update makes `eachSystemMap` powerful HOT 2
- flake-utils.lib.mkApp is broken with nix 2.8 HOT 4
- move functions to nixpkgs HOT 2
- Use `meta.mainProgram` by default in `mkApp` HOT 4
- Request for Semantic Version Pinning HOT 1
- Request for Semantic Version Pinning HOT 1
- `flattenTree` cannot seem to flatten `legacyPackages` to a `packages`-compatible format HOT 5
- Should `filterPackages` check `meta.hydraPlatforms`? HOT 2
- nixops support HOT 4
- self parameter for eachSystem/eachDefaultSystem HOT 2
- single arch+os override flake HOT 15
- Potential feature-freeze or deprecation in favor of flake-parts HOT 2
- master rename to main breaks nix flake update HOT 3
- eachDefaultSystem docs are sorely missing a real example HOT 4
- This `flake.system.nix` approach... relies on a broken nix feature
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flake-utils.