Giter VIP home page Giter VIP logo

nix-config's Introduction

Nix Configurations

This is my humble flakes-only collection of all and everything needed to set up and maintain all my nixified devices.

Features

Supported configurations

  • NixOS-managed
    • argon (Oracle Cloud Compute Instance)
    • krypton (private server)
    • neon (private laptop)
    • xenon (Raspberry Pi 3B+)
  • home-manager-managed
    • bwpm-FP2CYXKY2V
    • gamer on WSL2 with Ubuntu 20.04 (windows dual boot for games and stuff)
    • R2026
  • nix-on-droid-managed
    • pixel7a

See flake.nix for more information like system.

First installation

If any of these systems need to be reinstalled, you can run:

nix run \
  --extra-experimental-features "nix-command flakes" \
  github:Gerschtli/nix-config#setup

Manual instructions for some systems

Darwin

# Install nix via Determinate Nix Installer https://determinate.systems/posts/determinate-nix-installer
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install

echo "trusted-users = $USER" | sudo tee -a /etc/nix/nix.conf
sudo launchctl stop org.nixos.nix-daemon
sudo launchctl start org.nixos.nix-daemon

# see and execute files/scripts/darwin-setup.sh

nix run github:Gerschtli/nix-config#setup

NixOS

  1. Set up like written in the NixOS manual with image from nix build ".#installer-image"
  2. Add the following to configuration.nix:
    {
      users.users.root.password = "nixos";
      users.users.tobias = {
        password = "nixos";
        isNormalUser = true;
        extraGroups = [ "wheel" ];
      };
    }
  3. When booted in the new NixOS system, login as tobias and run setup script

Raspberry Pi

  1. Build image
    nix build ".#rpi-image"
  2. Copy (dd) result/sd-image/*.img to sd-card
  3. Inject sd-card in raspberry and boot
  4. When booted in the new NixOS system, login as tobias and run setup script
Update firmware

Firmware of Raspberry Pi needs to be updated manually on a regular basis with the following steps:

  1. Build firmware
    nix build ".#rpi-firmware"
  2. Mount /dev/disk/by-label/FIRMWARE
  3. Create backup of all files
  4. Copy result/* to firmware partition (ensure that old ones are deleted)
  5. Unmount and reboot

Ubuntu 20.04

# update and install system packages
sudo apt update
sudo apt upgrade
sudo apt install zsh

# install nix setup
sh <(curl -L https://nixos.org/nix/install) --no-channel-add --no-modify-profile
. ~/.nix-profile/etc/profile.d/nix.sh
nix run \
  --extra-experimental-features "nix-command flakes" \
  github:Gerschtli/nix-config#setup

# download and install UbuntuMono from nerdfonts.com

# set login shell
chsh -s /bin/zsh

# configure inotify watcher
echo "fs.inotify.max_user_watches = 524288" | sudo tee /etc/sysctl.d/local.conf

# set default shell (needed if using home-manager to setup xsession)
sudo ln -snf bash /bin/sh

Oracle Cloud ARM Compute Instance

  1. Create final boot volume

    1. Create any instance
    2. Detach boot volume
  2. Create bootstrap instance

    1. Create "VM.Standard.A1.Flex"

      1. with Ubuntu 20.04
      2. 1 OCPUs and 6 GB of memory
      3. set ssh public key
      4. Attach previously created boot volume as block volume (via ISCSI)
    2. ssh into instance with ubuntu user

    3. Login as root

    4. Set ssh public key in /root/.ssh/authorized_keys and run nixos-infect:

      cat /home/ubuntu/.ssh/authorized_keys > /root/.ssh/authorized_keys
      curl https://raw.githubusercontent.com/elitak/nixos-infect/master/nixos-infect | NIX_CHANNEL=nixos-22.05 bash -x
    5. ssh into instance with root user

    6. Add the following to /etc/nixos/configuration.nix:

      {
        boot.loader.grub.efiSupport = true;
        boot.loader.grub.device = "nodev";
        services.openiscsi.enable = true;
        services.openiscsi.name = "x";
      }
    7. Activate with nixos-rebuild switch

    8. Copy and run ISCSI mount commands from Oracle Cloud WebUI

    9. Partion mounted boot volume

    10. Install NixOS like described in NixOS manual with following options:

      {
        services.openssh.enable = true;
        services.openssh.settings.PermitRootLogin = "yes";
      
        users.users.root.password = "nixos";
        users.users.tobias = {
          password = "nixos";
          isNormalUser = true;
          extraGroups = [ "wheel" ];
        };
      }
    11. Copy and run ISCSI unmount commands from Oracle Cloud WebUI

    12. Detach volume in Oracle Cloud WebUI

  3. Create final instance

    1. Create instance of previously created boot volume
    2. ssh into instance with tobias user and password
    3. Run setup script

Note: This is all needed to be able to partition the volume to have more than 100MB available in /boot. The boot volume of the bootstrap instance can be reused at any time.

nix-config's People

Contributors

573 avatar gerschtli avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

573 furioncycle

nix-config's Issues

Question: How do I apply the new commonConfig scheme to nix-on-droid's extraOptions ?

How would I translate:

  nix = {
    extraOptions = ''
      keep-derivations = true
      keep-outputs = true
      substituters = ${concatStringsSep " " substituters}
      trusted-public-keys = ${concatStringsSep " " trustedPublicKeys}
    '';
  };

to something analogous to

  nix = {
    inherit (commonConfig.nix) package;
      settings = {
        inherit (commonConfig.nix.settings)
          substituters
          trusted-public-keys
          ;
	};
  };

but keeping the extraOptions as a string interpolating the values of i. e. trusted-public-keys from commonConfig.nix.settings ?

[Question] To use a service from nixpkgs-unstable in your framework what would I do ?

If I wanted services.photoprism.enable⋅=⋅true; probably in my host's configuration.nix but that services' definition was in nixpkgs-unstable only what would the best line of fitting into nix-config be ?

All I could find so far was the line imports = [ "${inputs.unstable}/nixos/modules/services/web-apps/photoprism.nix" ]; but still wouldn't know where to put that exactly.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • cachix/install-nix-action v27
  • cachix/cachix-action v15
  • cachix/cachix-action v15
.github/workflows/update.yml
  • actions/checkout v4
  • cachix/install-nix-action v27
  • actions/checkout v4

  • Check this box to trigger a request for Renovate to run again on this repository

[Question] Can you pls help with overlay ?

As I'm using a fork of your config may I kindly ask how the overlays work in the case of nix-on-droid ?

What I'm trying to achieve is using vimPlugins as of input unstable while generally following release-22.05 still.

While i. e. alejandra has the version I expect (3.0.0 as of current) the vim plugins finally installed still all date of not after May 2022 while they have new version in the unstable repository branch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.