Compare commits
4 commits
9e849b95a8
...
c7975eb119
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c7975eb119 | ||
![]() |
74a189c5b6 | ||
![]() |
7322ee25d0 | ||
![]() |
28d717a556 |
6 changed files with 24 additions and 185 deletions
2
.envrc
2
.envrc
|
@ -1 +1 @@
|
||||||
use flake
|
use nix
|
||||||
|
|
20
default.nix
20
default.nix
|
@ -9,26 +9,28 @@ let
|
||||||
inherit (pkgs) lib;
|
inherit (pkgs) lib;
|
||||||
inherit (lib.filesystem) listFilesRecursive;
|
inherit (lib.filesystem) listFilesRecursive;
|
||||||
inherit (lib.strings) hasSuffix;
|
inherit (lib.strings) hasSuffix;
|
||||||
|
inherit (lib.attrsets) genAttrs;
|
||||||
|
|
||||||
|
nixosSystem = import (sources.nixpkgs + "/nixos/lib/eval-config.nix");
|
||||||
mkSystem =
|
mkSystem =
|
||||||
hostname:
|
hostname:
|
||||||
import (src.nixpkgs + "/nixos/lib/eval-config.nix") {
|
nixosSystem {
|
||||||
|
system = null;
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit sources;
|
inherit sources;
|
||||||
self = ./.;
|
self = ./.;
|
||||||
};
|
};
|
||||||
modules = [
|
modules = [
|
||||||
# This is used to pre-emptively set the hostPlatform for nixpkgs.
|
|
||||||
# Also, we set the system hostname here.
|
|
||||||
{ networking.hostName = hostname; }
|
{ networking.hostName = hostname; }
|
||||||
./hosts/common.nix
|
|
||||||
./hosts/${hostname}
|
./hosts/${hostname}
|
||||||
]
|
]
|
||||||
++ ((listFilesRecursive ./modules) |> filter (hasSuffix ".mod.nix"));
|
++ ((listFilesRecursive ./modules) |> filter (hasSuffix ".mod.nix"));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hosts = [
|
||||||
|
"temperance"
|
||||||
|
"hermit"
|
||||||
|
"tower"
|
||||||
|
];
|
||||||
in
|
in
|
||||||
{
|
genAttrs hosts mkSystem
|
||||||
temperance = mkSystem "temperance";
|
|
||||||
hermit = mkSystem "hermit";
|
|
||||||
tower = mkSystem "tower";
|
|
||||||
}
|
|
||||||
|
|
|
@ -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:
|
|
|
@ -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";
|
|
||||||
}
|
|
|
@ -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
12
shell.nix
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
pkgs ? import <nixpkgs> { },
|
||||||
|
sources ? import ./npins,
|
||||||
|
}:
|
||||||
|
pkgs.mkShellNoCC {
|
||||||
|
|
||||||
|
packages = [
|
||||||
|
(pkgs.callPackage (sources.npins + "/npins.nix") { })
|
||||||
|
pkgs.nil
|
||||||
|
pkgs.nixfmt
|
||||||
|
];
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue