This is @ajhalili2006's NixOS + Home Manager configuration for his laptop and homelabs, in sync with the nixpkgs-specific dotfiles repository. Also planned to be used in Hack Club Nest soon.
Workflow Name and Type | CI Platform | Badge/Link |
---|---|---|
Nix Flake Builds (push) | GitHub Actions | |
Nix Flake Builds (schedule, every 06:30 UTC Saturday) | GitHub Actions |
It is recommended to install NixOS using either the Calamares-based graphical
installer or manually through the nixos-install
utility, especially
when you have consider partitioning on your drive to ensure that you can roll back
safely in case things go wrong.
After installation, copy the generated NixOS configuration files from /etc/nixos
into a new directory named hosts/<host-name>
. Note that on the rest of
the README, the placeholder <host-name>
is used to denote the hostname of a new
or existing machine under Nix flake-based setup.
cp -rv /etc/nixos/ hosts/<host-name>/
On the flake.nix
file, under the nixosConfigurations
block, add the new host using the template below
<host-name> = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./hosts/<host-name>/configuration.nix
# load Determinate Nix and the rest
determinate.nixosModules.default
home-manager.nixosModules.home-manager
vscode-server.nixosModules.default
nix-ld.nixosModules.nix-ld
# one-liners?
{ programs.nix-ld.dev.enable = true; }
];
};
Then on your hosts/<host-name>/configuration.nix
, add the needed imports
as needed:
imports = [
./hardware-configuration.nix
../../shared/gnupg.nix
../../shared/meta-configs.nix
../../shared/server/ssh.nix
../../shared/server/tailscale.nix
../../shared/systemd.nix
../../shared/yubikey.nix
# add more imports here
]
Adjust as needed before running a nixos-rebuild switch
EDITOR="nano" # or code if you do
$EDITOR <path/to/nixfile.nix>
git stage <path/to/nixfile.nix>
git commit --signoff
# update the flake.lock file manually
nix flake update
# on the another machine...
# change {hostname} to something like stellapent-cier
sudo nixos-rebuild --flake github:andreijiroh-dev/nixops-config#{hostname} <switch|boot|build>
From a local copy:
# update the flake.lock file manually
nix flake update
# change {hostname} to something like stellapent-cier
sudo nixos-rebuild --flake .#{hostname} <switch|boot|build>
You can easily use this flake as an external module in your own flake-based NixOS configuration if you want to reuse some of my configurations.
{
description = "My NixOS configuration";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/24.11";
inputs.andreijiroh-dev.url = "github:andreijiroh-dev/nixops-config";
# needed if you use stable instead of unstable
inputs.andreijiroh-dev.inputs.nixpkgs.follows = "nixpkgs";
outputs = { self, andreijiroh-dev, nixpkgs }: {
let
# change {hostname} to something like stellapent-cier
# if you like to reuse my configs
system = nixops-config.nixosConfigurations.{hostname};
in
{
nixosConfigurations.{hostname} = system {
# your customizations here
};
nixosConfigurations.your-mom = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
andreijiroh-dev.nixosModules.networking # or any other modules
];
};
};
}
Currently available as amd64
(x86-64
) Linux ISO only for now, but you can copy
the recoverykit-amd64
NixOS configuration and change system
to any supported CPU
architectures by NixOS.
# Build using the sources as remote
nix build github:andreijiroh-dev/nixops-config/main#nixosConfigurations.recoverykit-amd64.config.system.build.isoImage
# ...or via a local clone
nix build .#nixosConfigurations.recoverykit-amd64.config.system.build.isoImage
flatpak.nix
: NixOS for enabling Flatpaksgnupg.nix
: GnuPG configurationlocale.nix
: Locale configurationmeta-configs.nix
: Meta configurations for the system, mostly related to Nix and nixpkgs.networking.nix
: Networking configuration, currently DNS resolver settings forsystemd-resolved
ssh-keys.nix
: SSH keys configuration as NixOS module, intended to be in sync with my keys on git forgesserver/devenv.nix
: Development environment configuration, plus Docker and VM configurations.server/ssh.nix
: SSH server configuration
MPL-2.0