update nixpkgs, home-manager, remove root password, refactor, use tmpfs, c2: use disk labels

This commit is contained in:
Henri Dohmen 2025-04-19 22:36:22 +02:00
parent 59a71b5cf2
commit 62d3765e58
8 changed files with 109 additions and 39 deletions

27
flake.lock generated
View file

@ -1,12 +1,32 @@
{ {
"nodes": { "nodes": {
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1745071558,
"narHash": "sha256-bvcatss0xodcdxXm0LUSLPd2jjrhqO3yFSu3stOfQXg=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "9676e8a52a177d80c8a42f66566362a6d74ecf78",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1744463964, "lastModified": 1744932701,
"narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", "narHash": "sha256-fusHbZCyv126cyArUwwKrLdCkgVAIaa/fQJYFlCEqiU=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", "rev": "b024ced1aac25639f8ca8fdfc2f8c4fbd66c48ef",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -18,6 +38,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View file

@ -1,10 +1,18 @@
{ {
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = outputs =
{ self, nixpkgs }@inputs: {
self,
nixpkgs,
home-manager,
}@inputs:
let let
lib = nixpkgs.lib; lib = nixpkgs.lib;
mod = import ./mod { inherit lib; }; mod = import ./mod { inherit lib; };
@ -25,6 +33,6 @@
}; };
}; };
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-rfc-style; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
}; };
} }

View file

@ -26,7 +26,7 @@
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = { fileSystems."/" = {
device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; device = "/dev/disk/by-label/nixroot";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
"noatime" "noatime"
@ -36,7 +36,7 @@
}; };
fileSystems."/nix" = { fileSystems."/nix" = {
device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; device = "/dev/disk/by-label/nixroot";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
"noatime" "noatime"
@ -46,7 +46,7 @@
}; };
fileSystems."/home" = { fileSystems."/home" = {
device = "/dev/disk/by-uuid/0aa43f8a-a6e8-47aa-800d-b02d98f2cb8a"; device = "/dev/disk/by-label/nixroot";
fsType = "btrfs"; fsType = "btrfs";
options = [ options = [
"noatime" "noatime"
@ -56,7 +56,7 @@
}; };
fileSystems."/boot/efi" = { fileSystems."/boot/efi" = {
device = "/dev/disk/by-uuid/829B-BDFC"; device = "/dev/disk/by-label/NIXENV";
fsType = "vfat"; fsType = "vfat";
options = [ options = [
"fmask=0022" "fmask=0022"
@ -64,7 +64,11 @@
]; ];
}; };
swapDevices = [ ]; swapDevices = [
{
device = "/dev/disk/by-label/nixswap";
}
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's # (the default) this is the recommended approach. When using systemd-networkd it's

View file

@ -9,5 +9,9 @@
}; };
}; };
# otherwise /tmp is on disk. This *may* be problematic as nix
# builds in /tmp but I think my swap is large enough...
boot.tmp.useTmpfs = true;
boot.kernelPackages = pkgs.linuxPackages_6_13; boot.kernelPackages = pkgs.linuxPackages_6_13;
} }

View file

@ -1,31 +1,54 @@
{ lib, ... }:
{ {
nix.settings = { lib,
experimental-features = [ inputs,
"nix-command" config,
"flakes" ...
]; }:
trusted-users = [ {
"root" config = {
"@wheel" nix.settings = {
]; experimental-features = [
auto-optimise-store = true; "nix-command"
"flakes"
];
trusted-users = [
"root"
"@wheel"
];
auto-optimise-store = true;
};
programs.nix-ld.enable = true;
nixpkgs.config.allowUnfree = false;
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"nvidia-x11"
"nvidia-settings"
"vscode"
"obsidian"
"steam"
"steam-unwrapped"
"gateway" # jetbrains
"spotify"
"rust-rover"
];
home.home.stateVersion = config.system.stateVersion; # is this safe?
}; };
programs.nix-ld.enable = true; imports = [
inputs.home-manager.nixosModules.home-manager
];
nixpkgs.config.allowUnfree = false; # I don't think this will ever be multi user,
nixpkgs.config.allowUnfreePredicate = # no need to seperate home-manager. `home` is used
pkg: # in users.nix, I should prbably refactor...
builtins.elem (lib.getName pkg) [ options = {
"nvidia-x11" home = lib.mkOption {
"nvidia-settings" type = lib.types.attrs;
"vscode" default = { };
"obsidian" };
"steam" };
"steam-unwrapped"
"gateway" # jetbrains
"spotify"
"rust-rover"
];
} }

View file

@ -19,6 +19,7 @@
unzip unzip
wget wget
wl-clipboard wl-clipboard
nixfmt-rfc-style
]; ];
programs = { programs = {

View file

@ -21,7 +21,6 @@
wireguard-tools wireguard-tools
bitwarden bitwarden
kitty kitty
nixfmt-rfc-style
nil nil
]; ];

View file

@ -1,8 +1,15 @@
{ pkgs, ... }:
{ {
users.users.hd = { pkgs,
lib,
options,
...
}:
{
users.users."hd" = {
description = "Henri"; description = "Henri";
isNormalUser = true; isNormalUser = true;
createHome = true;
home = "/home/hd";
extraGroups = [ extraGroups = [
"networkmanager" "networkmanager"
"wheel" "wheel"
@ -10,4 +17,7 @@
shell = pkgs.fish; shell = pkgs.fish;
packages = [ ]; packages = [ ];
}; };
home-manager.users."hd" = lib.mkAliasDefinitions options.home;
users.users.root.hashedPassword = "!";
} }