Skip to content

Instantly share code, notes, and snippets.

@edouard-lopez
Last active June 4, 2025 14:53
Show Gist options
  • Save edouard-lopez/a789cd58e38a566550137fd56ea336d1 to your computer and use it in GitHub Desktop.
Save edouard-lopez/a789cd58e38a566550137fd56ea336d1 to your computer and use it in GitHub Desktop.
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{
inputs,
lib,
config,
pkgs,
...
}: {
imports = [
# You can also split up your configuration and import pieces of it here:
# ./users.nix
];
nixpkgs = {
overlays = [ ];
# Configure your nixpkgs instance
config = {
# Disable if you don't want unfree packages
allowUnfree = true;
};
};
nix = let
flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs;
in {
settings = {
# Enable flakes and new 'nix' command
experimental-features = "nix-command flakes";
# Opinionated: disable global registry
flake-registry = "";
# Workaround for https://github.com/NixOS/nix/issues/9574
nix-path = config.nix.nixPath;
};
# Opinionated: disable channels
channel.enable = false;
# Opinionated: make flake registry and nix path match flake inputs
registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs;
nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs;
};
# FIXME: Add the rest of your current configuration
# TODO: Configure your system-wide user settings (groups, etc), add more users as needed.
users.users = {
# FIXME: Replace with your username
root = {
# TODO: You can set an initial password for your user.
# If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
# Be sure to change it (using passwd) after rebooting!
initialPassword = "123";
isNormalUser = true;
# TODO: Be sure to add any other groups you need (such as networkmanager, audio, docker, etc)
extraGroups = ["wheel"];
};
};
# https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion
system.stateVersion = "23.05";
}
23.04 Activating writeBoundary
23.05 Creating new profile generation
23.10 Activating installPackages
23.14 installing 'home-manager-path'
23.15 building '/nix/store/w0y8pcjg8s11h98fibdiqvcl74l1mbks-user-environment.drv'...
23.26 error: Unable to build profile. There is a conflict for the following files:
23.26
23.26 /nix/store/6y6ijw6avikf17cyks2k07vc9q1wq31v-man-db-2.13.0/etc/man_db.conf
23.26 /nix/store/qrjriw7d294yg3fkwrbq19l7ijrzb8pr-home-manager-path/etc/man_db.conf
23.28 error: builder for '/nix/store/w0y8pcjg8s11h98fibdiqvcl74l1mbks-user-environment.drv' failed with exit code 1
23.29
23.29 Oops, Nix failed to install your new Home Manager profile!
23.29
23.29 Perhaps there is a conflict with a package that was installed using
23.29 "nix-env -i"? Try running
23.29
23.29 nix-env -q
23.29
23.29 and if there is a conflicting package you can remove it with
23.29
23.29 nix-env -e {package name}
23.29
23.29 Then try activating your Home Manager configuration again.
------
nix.Dockerfile:28
--------------------
26 | # home.nix and pure-local.nix are expected to be in the current WORKDIR.
27 | # The pure-local.nix uses `src = ../.` which correctly points to `/pure-dev/`.
28 | >>> RUN home-manager switch -f ./home.nix --show-trace
29 |
30 | # Set the working directory to the root of the pure project for running tests
--------------------
ERROR: failed to solve: process "/bin/sh -c home-manager switch -f ./home.nix --show-trace" did not complete successfully: exit code: 1
make: *** [makefile:65: build-pure-on-nix] Error 1
# This is your home-manager configuration file
# Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix)
{ inputs, lib, config, pkgs, ... }: {
imports = [ ];
nixpkgs = {
# Configure your nixpkgs instance
config = { };
};
# TODO: Set your username
home = {
username = "root";
homeDirectory = "/root";
};
# Add stuff for your user as you see fit:
# programs.neovim.enable = true;
# Enable home-manager and git
programs.home-manager.enable = true;
programs.git.enable = true;
programs.fish.enable = true;
home.packages = with pkgs; [ fishPlugins.fishtape_3 ];
# Nicely reload system units when changing configs
systemd.user.startServices = "sd-switch";
home.stateVersion = "23.05";
}
# Use a base Nix image
FROM nixos/nix:latest
# Set environment variables for Nix and locale
ENV LANG=C.UTF-8 \
LC_ALL=C.UTF-8
ENV NIX_CONFIG="experimental-features = nix-command flakes"
# Install base dependencies as root using nix-env
# These are needed for setting up the user environment and Home Manager
RUN nix-env -iA \
nixpkgs.nix \
nixpkgs.git \
nixpkgs.fish \
nixpkgs.home-manager
# Copy the entire 'pure' project source code into the user's home directory
# This makes relative paths in Nix files (like src = ../.;) work correctly.
# The source code will be at /home/nemo/pure_project
COPY ../. /pure-dev
# Set the working directory to where the Nix configuration files will be referenced
WORKDIR /pure-dev/docker
# Apply the Home Manager configuration.
# home.nix and pure-local.nix are expected to be in the current WORKDIR.
# The pure-local.nix uses `src = ../.` which correctly points to `/pure-dev/`.
RUN home-manager switch -f ./home.nix --show-trace
# Set the working directory to the root of the pure project for running tests
WORKDIR /pure-dev/
# Default command to run when the container starts: execute fishtape tests.
# Assumes your tests are in the 'tests' directory at the root of your 'pure' project.
CMD ["fish", "-c", "fishtape tests/*.test.fish"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment