Skip to content

seqizz/nixos-system-flake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

345 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

My system flake for NixOS + Home Manager

Machines

Name Hardware Role
splinter Dell XPS 14 9440 (Intel + Nvidia) Primary laptop
bebop Dell XPS 9310 2-in-1 (Intel) Secondary laptop
rocksteady Vultr VPS Server (mail, forgejo, gotosocial, etc.)

Directory Layout

.
β”œβ”€β”€ flake.nix               # Inputs & outputs (machines, overlays, home-manager)
β”œβ”€β”€ plumbing/               # Overlay machinery, all magic happens here
β”‚   β”œβ”€β”€ default.nix         # Grafts auto-discovery, nixos/hm module lists
β”‚   β”œβ”€β”€ helpers.nix         # overrideSrc, mkVimPlugin, fromFlake
β”‚   └── README.md
β”œβ”€β”€ grafts/                 # Package additions and overrides β€” drop files here
β”‚   β”œβ”€β”€ mpv.nix             # override: example β€” prev.mpv-unwrapped.override { ... }
β”‚   β”œβ”€β”€ ionicons.nix        # addition: example β€” final.callPackage { ... } {}
β”‚   β”œβ”€β”€ vim-plugins.nix     # set: merges vim plugins into pkgs
β”‚   β”œβ”€β”€ nixos/              # NixOS modules (auto-applied to all nixosConfigurations)
β”‚   β”œβ”€β”€ home/               # HM modules (auto-applied to all homeConfigurations)
β”‚   β”œβ”€β”€ _dormant/           # Inactive packages β€” move to grafts/ to activate
β”‚   └── README.md
β”œβ”€β”€ machines/               # Machine-specific settings
β”‚   β”œβ”€β”€ splinter.nix
β”‚   β”œβ”€β”€ bebop.nix
β”‚   β”œβ”€β”€ rocksteady.nix
β”‚   └── README.md
└── config/                 # All configurations
    β”œβ”€β”€ nixos/
    β”‚   β”œβ”€β”€ base.nix        # Shared base: overlays, nix settings, registry
    β”‚   β”œβ”€β”€ common.nix      # All machines: locale, nix, users, packages
    β”‚   β”œβ”€β”€ laptop/         # Shared laptop config
    β”‚   β”œβ”€β”€ server/         # Server config
    β”‚   └── helper-modules/ # Reusable NixOS modules
    β”œβ”€β”€ home/
    β”‚   β”œβ”€β”€ home.nix        # HM entry point
    β”‚   β”œβ”€β”€ common.nix      # Orchestrator
    β”‚   └── ...
    └── README.md

How to Override or Add a Package

Expose a flake package or pin a nixpkgs source (no graft file needed):

Name the input <pkgname>-src in flake.nix. The passthrough-overlay handles it automatically β€” new packages appear as pkgs.<pkgname>; flake = false inputs where <pkgname> exists in nixpkgs pin that package's source in-place.

Override or add a package from scratch:

Create grafts/<pkgname>.nix. It is auto-discovered β€” no other file needs editing.

The file receives { final, prev, inputs, helpers, ... }:

# grafts/mpv.nix β€” override existing nixpkgs package
{ prev, ... }:
prev.mpv-unwrapped.override { ffmpeg = prev.ffmpeg_6-full; }

# grafts/mytool.nix β€” add new package
{ final, ... }:
final.callPackage ({ stdenv, ... }: stdenv.mkDerivation { ... }) {}

# grafts/greenclip.nix β€” pin source to flake input
{ prev, inputs, helpers, ... }:
helpers.overrideSrc prev.greenclip inputs.greenclip-src

See grafts/README.md for full documentation.

How to Add a NixOS or Home-Manager Module

Drop a .nix file in grafts/nixos/ (NixOS) or grafts/home/ (home-manager). It is auto-applied to all configurations.

Module Hierarchy

config/nixos/base.nix (all machines β€” overlays + nix settings)
└── config/nixos/common.nix (locale, nix, users, packages)
    β”œβ”€β”€ config/nixos/laptop/common.nix (splinter + bebop)
    β”‚   └── machines/{splinter,bebop}.nix (kernel, GPU, boot, disk)
    └── config/nixos/server/common.nix (rocksteady)
        └── machines/rocksteady.nix (boot, network)

Usage

# Build/switch NixOS
nixos-rebuild build --flake .#splinter
nixos-rebuild switch --flake .#splinter

# Build/switch home-manager
home-manager build --flake .#gurkan@splinter
home-manager switch --flake .#gurkan@splinter

# Build a graft package
nix build .#ionicons
nix build .#remark42

About

A combined configuration of my nixos and home-manager πŸš€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors