initial commit
All checks were successful
Deploy docs / build-and-deploy (push) Successful in 3s

This commit is contained in:
sid 2026-02-23 20:34:35 +01:00
commit 95a533c876
451 changed files with 18255 additions and 0 deletions

View file

@ -0,0 +1,70 @@
# NixOS Container
Imperative container NixOS configuration.
## References:
- [NixOS Manual](https://nixos.org/manual/nixos/stable/#sec-imperative-containers)
- [NixOS Wiki](https://wiki.nixos.org/wiki/NixOS_Containers#Define_and_create_nixos-container_from_a_Flake_file)
## Setup
In your host configuration, set:
```nix
boot.enableContainers = true;
```
Create a new directory and initialize the template inside of it:
> `nxc` is an arbitrary name
```bash
mkdir -p nxc
cd nxc
nix flake init -t git+https://git.sid.ovh/sid/synix#container
```
## Usage
Create the container:
```bash
sudo nixos-container create nxc --flake .
```
Start the container:
```bash
sudo nixos-container start nxc
```
Rebuild the container:
```bash
sudo nixos-container update nxc --flake .
```
Log in as root:
```bash
sudo nixos-container root-login nxc
```
Stop the container:
```bash
sudo nixos-container stop nxc
```
Destroy the container:
```bash
sudo nixos-container destroy nxc
```
For more, see the help page:
```bash
nixos-container --help
```

View file

@ -0,0 +1,32 @@
# Edit this only if you know what you're doing.
{ outputs, ... }:
{
boot = {
isContainer = true;
isNspawnContainer = true;
};
nix = {
channel.enable = false;
settings = {
experimental-features = "nix-command flakes";
builders-use-substitutes = true;
substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
];
trusted-public-keys = [
"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
nixpkgs.overlays = [
outputs.overlays.synix-packages
outputs.overlays.local-packages
];
system.stateVersion = "25.11";
}

View file

@ -0,0 +1,5 @@
{
networking.hostName = "nxc";
# Add the rest of your configuration here
}

View file

@ -0,0 +1,6 @@
{
imports = [
./base.nix
./configuration.nix
];
}

View file

@ -0,0 +1,58 @@
{
description = "Container NixOS configurations";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
synix.url = "git+https://git.sid.ovh/sid/synix.git?ref=release-25.11";
synix.imputs.nixpkgs.follows = "nixpkgs";
};
outputs =
{
self,
nixpkgs,
...
}@inputs:
let
inherit (self) outputs;
system = "x86_64-linux";
lib = nixpkgs.lib.extend (final: prev: inputs.synix.lib or { });
in
{
packages =
let
pkgs = nixpkgs.legacyPackages.${system};
in
import ./pkgs { inherit pkgs; };
overlays = import ./overlays { inherit (self) inputs; };
devShells =
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShell {
buildInputs = with pkgs; [
nixos-container
tmux
];
};
};
nixosModules = import ./modules;
nixosConfigurations = {
container = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ ./config ];
specialArgs = {
inherit inputs outputs lib;
};
};
};
};
}

View file

@ -0,0 +1,3 @@
{
# example = import ./example;
}

View file

@ -0,0 +1,7 @@
{ inputs, ... }:
{
synix-packages = final: prev: { synix = inputs.synix.overlays.additions final prev; };
local-packages = final: prev: { local = import ../pkgs { pkgs = final; }; };
}

View file

@ -0,0 +1,5 @@
{ pkgs, ... }:
{
# example = pkgs.callPackage ./example { };
}