Comments (10)
i tried to do it myself but i still struggle with the syntax and the understanding for nix :(
https://github.com/luxus/nix-config/blob/mychanges/lib/default.nix
from nix-config.
Hey,
The issue with your file is that you have one function input and one output. It should be:
{
mkNixos = {
hostname,
system,
persistence ? false,
}:
nixosSystem {
inherit system;
pkgs = outputs.legacyPackages.${system};
specialArgs = {
inherit inputs outputs hostname persistence;
};
modules =
attrValues (import ../modules/nixos)
++ [
../hosts/nixos/${hostname}
];
};
mkDarwin = {
hostname,
system,
persistence ? false,
}:
darwinSystem {
inherit system;
pkgs = outputs.legacyPackages.${system};
specialArgs = {
inherit inputs outputs hostname persistence;
};
modules =
attrValues (import ../modules/darwin)
++ [
../hosts/darwin/${hostname}
];
};
}
from nix-config.
Oh and by the way, you might be better served trying out my nix-starter-configs. They are really complete, yet easy to understand for people starting out with nix (package manager and/or language).
My config is a tad complex (you probably don't need to make a function for defining systems, for example) and overall "here be dragons".
from nix-config.
okay.. i think it was too late yesterday :D
i still struggle to get it working. i will take a further look tomorrow. maybe i will figure it out
i'm pretty far with your config i got it working on 2 computers and from now on it looks a lot easier.
impersistence is a pain in the ass but i got it mostly.
https://mt-caret.github.io/blog/posts/2020-06-29-optin-state.html
i will try to use the diff script there to see what i'm still missing (my volume resets)
from nix-config.
@Misterio77 if you have the time to take a look on my fork of your config https://github.com/luxus/nix-config/blob/mychanges/lib/default.nix i would really appreciate it :D
from nix-config.
Looks good :)
But I'd advise you to instead start with a smaller config and work your way up. Nix code can be cryptic, so it's best if you start with code that you fully understand (of course, that isn't possible at the very beggining, so start with the simplest code possible), and build your own complexity as you progress. Dealing with complex abstractions you don't need will make it a LOT harder to learn.
from nix-config.
If you're interested in the abstractions, go right ahead. But if the thing you need is impermanence, I can help you write a minimum viable flake.
from nix-config.
thanks for the advice, your config is not the first i tried :D and you are right it's easier with a smaller config. but i want to use the config on at least 5 machines, so your abstactions are really helpful.
as i posted in a other issue. your config is so far the most easiest to understand "complex config". i got nearly everything working and understand most of it so far. but the abstraction is a little bit much. :D
i moved the nixOS configs to /hosts/nixOS/
but couldn't access common ../../common
didn't work? is it not possible to go 2 folders up?
when i try to use the config on a mac i got following error:
❯ darwin-rebuild switch --flake .
warning: Git tree '/Users/luxus/Source/nix-config' is dirty
building the system configuration...
warning: Git tree '/Users/luxus/Source/nix-config' is dirty
error: attribute 'darwinSystem' missing
at /nix/store/vmfbw1rwrfq3sm4dmlisx76lwjd65210-source/lib/default.nix:1:19:
1| {inputs, ...}: let
| ^
2| inherit (inputs) self home-manager nixpkgs deploy-rs ;
do i have to separate the mkHome between darwin and nixOS aswell?
from nix-config.
your config is so far the most easiest to understand "complex config". i got nearly everything working and understand most of it so far. but the abstraction is a little bit much. :D
that makes sense.
but couldn't access common ../../common
Hm, it should work. In which file is this error happening?
error: attribute 'darwinSystem' missing
In lib/default.nix
line 6, you're trying to import darwinSystem
from nixpkgs.lib
. You should import it from darwin.lib
instead. Like so:
{inputs, ...}: let
inherit (inputs) self home-manager nixpkgs deploy-rs darwin;
inherit (self) outputs;
inherit (builtins) elemAt match any mapAttrs attrValues attrNames listToAttrs;
inherit (nixpkgs.lib) nixosSystem filterAttrs genAttrs mapAttrs';
inherit (darwin.lib) darwinSystem;
inherit (home-manager.lib) homeManagerConfiguration;
activate = type: config: deploy-rs.lib.${config.pkgs.system}.activate.${type} config;
in rec {
# ...
}
from nix-config.
thanks that worked..
i could be more clever and just add a if statement with stdenv.hostplatform.isDarwin
from nix-config.
Related Issues (20)
- have anyone used nix-generator with this config? HOT 1
- Ci/Cd? HOT 1
- SOPS and fresh installation HOT 12
- libsForQt5.qtstyleplugins messes up QT apps. HOT 1
- Do you persist `/etc/nixos`? HOT 2
- Question: How to deploy on Raspberry Pi 4 HOT 2
- Home Manager environment not activating under an impermanence setup HOT 1
- Advice for encrypt secrets that can't be encrypted with sops-nix because they are needed during runtime HOT 3
- QUESTION: How did you fix the problem of wofi on waybar with systemd integration setup? HOT 3
- Firefox add-ons issue HOT 2
- error: The option `home-manager.users.eyduh.fontProfiles' does not exist. HOT 1
- Thanks for sharing, helped me setup sops, multiuser multi nodes :) HOT 2
- Invalid Hyprland configuration generated with hyprbars
- Redundant directory creation in ephemeral-btrfs.nix
- QUESTION: how to configure new Hydra project? HOT 5
- How does Hydra know the ip of the two worker desktops?
- Installation guide HOT 1
- Question on LSP in nvim
- QUESTION about nix-shell getting error: input 'hyprland-plugins/systems' follows a non-existent input 'hyprland-plugins/hyprland/systems'
- QUESTION: impermanence and standalone home-manager HOT 1
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 nix-config.