Skip to content

chillcicada/nixos-config

Repository files navigation

NixOS-config

Stargazers NIXOS Version

This repo stores some cc's nixos and home-manager configurations.

Hint: this repo contains my hardware configuration, you shouldn't directly use the config to build your system.

Run just --list to see all recipes.

Structure

.
├── flake.lock
├── flake.nix
├── home
│   ├── apps/
│   ├── modules/
│   └── minimal.nix
├── hosts
│   ├── <machine>/
│   ├── default.nix
│   └── vars.nix
├── justfile
├── LICENSE
├── modules/
├── README.md
└── treefmt.toml

A brief description of the structure:

  • flake.lock: the lock file for the flake.
  • flake.nix: the main entry point of the flake.
  • home: the home-manager configurations.
    • apps: the auto-imported app-specific configurations.
    • modules: the reusable modules for home-manager.
    • minimal.nix: the minimal configuration for home-manager.
  • hosts: the host-specific configurations.
    • <machine>/: the configurations for a specific machine.
    • default.nix: the import configuration for all hosts.
    • vars.nix: the shared variables used in the host configurations.
  • justfile: the file that contains the recipes for the just command.
  • LICENSE: the license file for the repo.
  • modules: contains the reusable top-level modules for different purposes.
  • README.md: this file.
  • treefmt.toml: the configuration file for treefmt, a tool to format the directory tree.

Miscellaneous

Below are some miscellaneous notes.


Set a temporary proxy for nix-daemon:

#!/usr/bin/env bash
mkdir /run/systemd/system/nix-daemon.service.d
cat > /run/systemd/system/nix-daemon.service.d/override.conf << EOF
[Service]
Environment="http_proxy=<your_proxy>"
Environment="https_proxy=<your_proxy>"
Environment="all_proxy=<your_proxy>"
EOF
systemctl daemon-reload
systemctl restart nix-daemon

Format the repo:

treefmt

Clean the machine:

nh clean all

Get the dependency graph of a package:

nix-store --gc --print-roots | rg -v '/proc/' | rg -Po '(?<= -> ).*' | xargs -o nix-tree

Then type / and the package name to get the dependency graph.

This nixos config is designed to build remote nixos system on a local machine, use

just push <remote-host>

Here the <remote-host> is the hostname of the remote machine, which is defined in the ssh config, and the recipe is a wrapper of the following command:

nixos-rebuild --target-host {{TARGET}} --use-remote-sudo switch --flake

Other Configs

License

GLWTS

Contributors 3

  •  
  •  
  •