1
0
Fork 0

Compare commits

..

4 commits

8 changed files with 66 additions and 62 deletions

View file

@ -1,8 +1,6 @@
#!/usr/bin/env bash
# Wrapper script for nixos-rebuild
#set -e
# Configuration parameters
operation="switch" # The nixos-rebuild operation to use
hostname=$(hostname) # The name of the host to build
@ -24,14 +22,15 @@ function usage() {
}
function run_operation {
echo "Full operation: nixos-rebuild $1 --flake $flakeDir#$hostname $( [ "$buildHost" != "" ] && echo "--build-host $buildHost" ) $remainingArgs"
echo "Full operation: nixos-rebuild $1 --flake $flakeDir#$hostname $( [ "$buildHost" != "" ] && echo "--build-host $buildHost" ) $remainingArgs --use-remote-sudo"
nixos-rebuild $operation --flake .#$hostname $remainingArgs --use-remote-sudo
# Only request super-user permission if we're switching
if [[ "$1" =~ ^(switch|boot|test)$ ]]; then
sudo nixos-rebuild $operation --flake .#$hostname $remainingArgs
else
nixos-rebuild $operation --flake .#$hostname $remainingArgs
fi
#if [[ "$1" =~ ^(switch|boot|test)$ ]]; then
# nixos-rebuild $operation --flake .#$hostname $remainingArgs --use-remote-sudo
#else
# nixos-rebuild $operation --flake .#$hostname $remainingArgs
#fi
}
# Argument processing logic shamelessly stolen from https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
@ -85,11 +84,6 @@ if [ $commit = true ]; then
git push
fi
# If this is a remote build, run the build as non-sudo first
if [[ "$buildHost" != "" ]]; then
run_operation "build"
fi
run_operation $operation
exit 0

View file

@ -196,6 +196,21 @@
"type": "github"
}
},
"lib": {
"locked": {
"dir": "lib",
"lastModified": 1726973702,
"narHash": "sha256-3MhRNhPikBf/rfqI+z1kprqeyR8OZFgCL6G6ZTFBjR8=",
"rev": "d7762a5a78273ffb76da6f6902245983143f63f6",
"type": "tarball",
"url": "https://git.auxolotl.org/api/v1/repos/auxolotl/labs/archive/d7762a5a78273ffb76da6f6902245983143f63f6.tar.gz?rev=d7762a5a78273ffb76da6f6902245983143f63f6"
},
"original": {
"dir": "lib",
"type": "tarball",
"url": "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz"
}
},
"lix": {
"flake": false,
"locked": {
@ -252,11 +267,11 @@
},
"nixos-hardware": {
"locked": {
"lastModified": 1727437159,
"narHash": "sha256-v4qLwEw5OmprgQZTT7KZMNU7JjXJzRypw8+Cw6++fWk=",
"lastModified": 1727528503,
"narHash": "sha256-wZd8OqPeQt9h7VU2VxsW4Vx0Ze+3hDLHql3pNbIMYEU=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "d830ad47cc992b4a46b342bbc79694cbd0e980b2",
"rev": "c1f051bf032273b9f0e707c8826eb25122d279fa",
"type": "github"
},
"original": {
@ -316,11 +331,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1727264057,
"narHash": "sha256-KQPI8CTTnB9CrJ7LrmLC4VWbKZfljEPBXOFGZFRpxao=",
"lastModified": 1727397532,
"narHash": "sha256-pojbL/qteElw/nIXlN8kmHn/w6PQbEHr7Iz+WOXs0EM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "759537f06e6999e141588ff1c9be7f3a5c060106",
"rev": "f65141456289e81ea0d5a05af8898333cab5c53d",
"type": "github"
},
"original": {
@ -362,6 +377,7 @@
"gnome-triplebuffering": "gnome-triplebuffering",
"home-manager": "home-manager",
"lanzaboote": "lanzaboote",
"lib": "lib",
"lix-module": "lix-module",
"nix-flatpak": "nix-flatpak",
"nixos-hardware": "nixos-hardware",

View file

@ -10,6 +10,25 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Repository for Gnome triple buffering patch
# For details, see https://wiki.nixos.org/wiki/GNOME#Dynamic_triple_buffering
gnome-triplebuffering = {
url = "gitlab:vanvugt/mutter/triple-buffering-v4-46?host=gitlab.gnome.org";
flake = false;
};
# Home-manager support
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# SecureBoot support
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
# Aux lib
lib.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=lib";
# Use Lix in place of Nix.
# If you'd rather use regular Nix, remove `lix-module.nixosModules.default` from the `modules` section below.
# To learn more about Lix, see https://lix.systems/
@ -21,24 +40,8 @@
# Flatpak support
nix-flatpak.url = "github:gmodena/nix-flatpak/v0.4.1";
# SecureBoot support
lanzaboote.url = "github:nix-community/lanzaboote/v0.4.1";
# NixOS hardware quirks
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
# Home-manager support
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
# Repository for Gnome triple buffering patch
# For details, see https://wiki.nixos.org/wiki/GNOME#Dynamic_triple_buffering
gnome-triplebuffering = {
url = "gitlab:vanvugt/mutter/triple-buffering-v4-46?host=gitlab.gnome.org";
flake = false;
};
};
outputs =

View file

@ -61,9 +61,11 @@ in
];
};
# Improve Khanda's responsiveness
kernel.sysctl = {
# Try to reduce swappiness - Khanda hates paging, even to NVMe storage
"vm.swappiness" = 20;
"vm.swappiness" = 20; # Try to reduce swappiness - Khanda hates paging, even to NVMe storage
"vm.vfs_cache_pressure" = 50; # https://wiki.archlinux.org/title/Sysctl#VFS_cache
"kernel.core_pattern" = "|${pkgs.coreutils}/bin/false"; # Disable core dumps per https://wiki.archlinux.org/title/Core_dump#Using_sysctl
};
kernelModules = [
@ -100,9 +102,10 @@ in
};
};
# Change I/O scheduler to BFQ to try and reduce stuttering under load.
# Change I/O scheduler to Kyber to try and reduce stuttering under load.
# NVME supports `mq-deadline` and `kyber` schedulers
services.udev.extraRules = ''
ACTION=="add|change", KERNEL=="nvme0*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
ACTION=="add|change", KERNEL=="nvme0n1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
'';
hardware = {

View file

@ -17,6 +17,9 @@
zellij # Terminal multiplexer
];
# Install the nos helper script
aux.system.nixos-upgrade-script.enable = true;
nixpkgs.overlays = [
(final: _prev: {
# Allow packages from the unstable repo by using 'pkgs.unstable'

View file

@ -57,16 +57,10 @@ in
forgejo = {
enable = true;
settings.server = {
DOMAIN =
let
parsedURL = (lib.strings.splitString "." cfg.url);
in
builtins.concatStringsSep "." [
(builtins.elemAt parsedURL 1)
(builtins.elemAt parsedURL 2)
];
DOMAIN = pkgs.util.getDomainFromURL cfg.url;
ROOT_URL = cfg.url;
HTTP_PORT = 3000;
REPO_INDEXER_ENABLED = true; # Enable code indexing
};
useWizard = true;
} // lib.optionalAttrs (cfg.home != null) { stateDir = cfg.home; };

View file

@ -23,17 +23,7 @@ in
type = lib.types.str;
default = "monthly";
};
nixos-upgrade-script = {
enable = lib.mkEnableOption "Installs the nos (nixos-upgrade-script) helper script.";
configDir = lib.mkOption {
type = lib.types.str;
description = "Path to your NixOS configuration files.";
};
user = lib.mkOption {
type = lib.types.str;
description = "The user to run the upgrade script as.";
};
};
nixos-upgrade-script.enable = lib.mkEnableOption "Installs the nos (nixos-upgrade-script) helper script.";
};
};
config = {

View file

@ -90,6 +90,7 @@ in
theme = "gentoo";
};
shellAliases = {
nos = lib.mkIf config.aux.system.nixos-upgrade-script.enable "nixos-upgrade-script";
z = "zellij";
update = "upgrade";
upgrade = "nh os boot --update --ask";