Using parts of my configuration
Hey there, stranger. Wanted to try parts of my configuration but don’t want to copy it outright since you’re feeling lazy or what-have-you? I made my configuration to be easy to use and integrate into your system.
Here’s how…
With flakes
This is the recommended method since I primarily use flakes for this project. Not to mention that with flakes, this is easier than ever to make use parts of my configuration.
To start, you can simply add my flake to your list of flake inputs.
inputs.foo-dogsquared-nixos-config.url = "github:foo-dogsquared/nixos-config";
Then, you could use parts of the config as exported from my flake which you can refer back to What’s in my flake?.
For example, you could make use of my packages by adding them as an overlay which is recommended if you’re going to use my NixOS modules anyways. Here’s one way to put as part of your NixOS configuration…
{
nixpkgs.overlays = [
inputs.foo-dogsquared-nixos-config.overlays.default
];
}
…or import them as part of nixpkgs.
import nixpkgs {
system = "x86_64-linux";
overlays = [
inputs.foo-dogsquared-nixos-config.overlays.default
];
}
If you’re going to use my stuff, why don’t take a gander and try my non-personal parts of the configuration such as my NixOS modules and home-manager modules? In that case, you can simply plop them into your list of imports for your NixOS configuration like so.
{
imports = [
inputs.foo-dogsquared-nixos-config.nixosModules.default
];
# Use my GNOME desktop configuration for some reason.
workflows.workflows.a-happy-gnome.enable = true;
}
With channels
The traditional way of managing stuff with channels. Though, I have made some efforts to make it easy to use without flakes, I cannot guarantee it’s good compared to using it with flakes.
You cannot install my NixOS configurations at all with channels so there’s another reason why (whether is valid or not is completely up to you). |
To start, as root, you have to add my project into the channels list…
nix-channel --add "https://github.com/foo-dogsquared/nixos-config/archive/master.tar.gz" foo-dogsquared-nixos-config
nix-channel --update
…then import my config as part of your configuration.
import <foo-dogsquared-nixos-config> { }
This is made with flake-compat flake which can have conflicts with the traditional method of using it.
Here’s an example snippet in a NixOS config making use of my configuration without flakes:
let
foo-dogsquared-nixos-config = import <foo-dogsquared-nixos-config> { };
in {
imports = [
foo-dogsquared-nixos-config.nixosModules.default
];
# Still using my GNOME desktop configuration for some reason.
workflows.workflows.a-happy-gnome.enable = true;
}
With manual fetching
If you really don’t want to manage stuff with channels or with flakes for some reason, I suppose you can just use something like niv. You could also pin my config similarly to how you can pin nixpkgs then use it as if you manage it as described from With channels.
Here’s a snippet of using it as part of a NixOS configuration.
let
foo-dogsquared-nixos-config = import (fetchTarball "{canonical-flake-url-tarball-specific}") { };
in {
imports = [
foo-dogsquared-nixos-config.nixosModules.default
];
# GNOME4LIFE!!!
workflows.workflows.a-happy-gnome.enable = true;
}