/nix/store/dlwqlnbaj5vfm9aw20r1yxk8y56lmgif-repo/header.tmpl

Compare commits

..

4 commits

Author SHA1 Message Date
faukah
c7975eb119 default.nix: refactor, cleanup 2025-08-31 13:52:07 +02:00
faukah
74a189c5b6 hosts/{common.nix, default.nix}: drop 2025-08-31 13:51:41 +02:00
faukah
7322ee25d0 docs: drop 2025-08-31 13:51:35 +02:00
faukah
28d717a556 shell.nix: init 2025-08-31 13:51:31 +02:00
6 changed files with 24 additions and 185 deletions

2
.envrc
View file

@ -1 +1 @@
use flake
use nix

View file

@ -9,26 +9,28 @@ let
inherit (pkgs) lib;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix;
inherit (lib.attrsets) genAttrs;
nixosSystem = import (sources.nixpkgs + "/nixos/lib/eval-config.nix");
mkSystem =
hostname:
import (src.nixpkgs + "/nixos/lib/eval-config.nix") {
nixosSystem {
system = null;
specialArgs = {
inherit sources;
self = ./.;
};
modules = [
# This is used to pre-emptively set the hostPlatform for nixpkgs.
# Also, we set the system hostname here.
{ networking.hostName = hostname; }
./hosts/common.nix
./hosts/${hostname}
]
++ ((listFilesRecursive ./modules) |> filter (hasSuffix ".mod.nix"));
};
hosts = [
"temperance"
"hermit"
"tower"
];
in
{
temperance = mkSystem "temperance";
hermit = mkSystem "hermit";
tower = mkSystem "tower";
}
genAttrs hosts mkSystem

View file

@ -1,55 +0,0 @@
# Dualbooting NixOS and FreeBSD
Out of curiosity, I decided to dual-boot NixOS and FreeBSD on my laptop, sharing
one disk. I document the process here for future reference:
## Linux install
First, flash a stick with NixOS, then boot into it, wipe your disk, create two
partitions, one being boot, the other your main NixOS partition. Then, follow
these commands:
```bash
sudo su
cryptsetup luksFormat /dev/diskname/partition
cryptsetup open /dev/diskname/partition crypt
mkfs.btrfs -L nixos /dev/mapper/crypt
mount /dev/mapper/crypt /mnt
btrfs create subvolume /mnt/nix
btrfs create subvolume /mnt/home
btrfs create subvolume /mnt/persist
mkdir /mnt/boot
mount /dev/partition # boot partition
```
Then, copy [my nixos flake](https://github.com/bloxx12/nichts) to `/mnt`, you
can remove it from there later on.
```bash
git clone https://github.com/bloxx12/nichts /mnt
```
In there, change the file system uuids to the correct ones, you can see them
using
```bash
sudo blkid
```
Then, install NixOS itself:
```bash
nixos-install --impure --flake /mnt/nichts#<hostname> -j 1 --cores 2
```
Wait for that to finish, then reboot.
If your system works, great! if not, redo from the beginning.
After that, set up FreeBSD the following way:

View file

@ -1,50 +0,0 @@
# This is for packages I want in all systems.
# Keeping this list as small as possible is important,
# since these also get installed to server,
# which should have a small attack surface.
{
lib,
pkgs,
...
}:
let
inherit (lib.meta) hiPrioSet;
in
{
environment.systemPackages =
builtins.attrValues {
inherit (pkgs)
cachix
calc
delta
difftastic
eza
gcc
git
httpie
inetutils
jujutsu
just
lazygit
linuxHeaders
neofetch
microfetch
mprocs
nmap
ripgrep
smartmontools
television
trash-cli
util-linux
w3m
wireguard-tools
zip
zoxide
;
}
++ builtins.attrValues (hiPrioSet {
})
++ [ (lib.hiPrio pkgs.uutils-coreutils-noprefix) ];
# helix as the only editor, a reasonable choice.
environment.variables.EDITOR = "hx";
}

View file

@ -1,70 +0,0 @@
{
sources,
nixpkgs,
self,
...
}:
let
inherit (builtins) filter map toString;
inherit (nixpkgs) lib;
inherit (lib.attrsets) recursiveUpdate;
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.lists) concatLists flatten singleton;
inherit (lib.strings) hasSuffix;
inherit (lib) nixosSystem;
# NOTE: This was inspired by raf, and I find this
# to be quite a sane way of managing all modules in my flake.
mkSystem =
{
system,
hostname,
...
}@args:
nixosSystem {
specialArgs = recursiveUpdate {
inherit lib;
inputs = sources;
inherit self;
} args.specialArgs or { };
modules = concatLists [
# This is used to pre-emptively set the hostPlatform for nixpkgs.
# Also, we set the system hostname here.
(singleton {
networking.hostName = hostname;
nixpkgs.hostPlatform = system;
})
(
concatLists [
# configuration for the host, passed as an argument.
(singleton ./${hostname}/default.nix)
# common configuration, which all hosts share.
(singleton ./common.nix)
# Import all files called module.nix from my modules directory.
(map toString (listFilesRecursive ../modules) |> filter (hasSuffix "module.nix"))
(map toString (listFilesRecursive ../modules) |> filter (hasSuffix ".mod.nix"))
]
|> flatten
)
];
};
in
{
temperance = mkSystem {
system = "x86_64-linux";
hostname = "temperance";
};
hermit = mkSystem {
system = "x86_64-linux";
hostname = "hermit";
};
tower = mkSystem {
system = "aarch64-linux";
hostname = "tower";
};
# world = mkSystem {
# system = "x86_64-linux";
# hostname = "world";
# };
}

12
shell.nix Normal file
View file

@ -0,0 +1,12 @@
{
pkgs ? import <nixpkgs> { },
sources ? import ./npins,
}:
pkgs.mkShellNoCC {
packages = [
(pkgs.callPackage (sources.npins + "/npins.nix") { })
pkgs.nil
pkgs.nixfmt
];
}