Compare commits
No commits in common. "09af51fce864a4e7b033b5dd96084628ee996ed0" and "31a2504bea966251a391646380ca781ab15588ab" have entirely different histories.
09af51fce8
...
31a2504bea
|
@ -1,6 +1,8 @@
|
|||
#!/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
|
||||
|
@ -22,15 +24,14 @@ function usage() {
|
|||
}
|
||||
|
||||
function run_operation {
|
||||
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
|
||||
echo "Full operation: nixos-rebuild $1 --flake $flakeDir#$hostname $( [ "$buildHost" != "" ] && echo "--build-host $buildHost" ) $remainingArgs"
|
||||
|
||||
# Only request super-user permission if we're switching
|
||||
#if [[ "$1" =~ ^(switch|boot|test)$ ]]; then
|
||||
# nixos-rebuild $operation --flake .#$hostname $remainingArgs --use-remote-sudo
|
||||
#else
|
||||
# nixos-rebuild $operation --flake .#$hostname $remainingArgs
|
||||
#fi
|
||||
if [[ "$1" =~ ^(switch|boot|test)$ ]]; then
|
||||
sudo nixos-rebuild $operation --flake .#$hostname $remainingArgs
|
||||
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
|
||||
|
@ -84,6 +85,11 @@ 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
|
||||
|
|
28
flake.lock
28
flake.lock
|
@ -196,21 +196,6 @@
|
|||
"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": {
|
||||
|
@ -267,11 +252,11 @@
|
|||
},
|
||||
"nixos-hardware": {
|
||||
"locked": {
|
||||
"lastModified": 1727528503,
|
||||
"narHash": "sha256-wZd8OqPeQt9h7VU2VxsW4Vx0Ze+3hDLHql3pNbIMYEU=",
|
||||
"lastModified": 1727437159,
|
||||
"narHash": "sha256-v4qLwEw5OmprgQZTT7KZMNU7JjXJzRypw8+Cw6++fWk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixos-hardware",
|
||||
"rev": "c1f051bf032273b9f0e707c8826eb25122d279fa",
|
||||
"rev": "d830ad47cc992b4a46b342bbc79694cbd0e980b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -331,11 +316,11 @@
|
|||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1727397532,
|
||||
"narHash": "sha256-pojbL/qteElw/nIXlN8kmHn/w6PQbEHr7Iz+WOXs0EM=",
|
||||
"lastModified": 1727264057,
|
||||
"narHash": "sha256-KQPI8CTTnB9CrJ7LrmLC4VWbKZfljEPBXOFGZFRpxao=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "f65141456289e81ea0d5a05af8898333cab5c53d",
|
||||
"rev": "759537f06e6999e141588ff1c9be7f3a5c060106",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -377,7 +362,6 @@
|
|||
"gnome-triplebuffering": "gnome-triplebuffering",
|
||||
"home-manager": "home-manager",
|
||||
"lanzaboote": "lanzaboote",
|
||||
"lib": "lib",
|
||||
"lix-module": "lix-module",
|
||||
"nix-flatpak": "nix-flatpak",
|
||||
"nixos-hardware": "nixos-hardware",
|
||||
|
|
35
flake.nix
35
flake.nix
|
@ -10,25 +10,6 @@
|
|||
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/
|
||||
|
@ -40,8 +21,24 @@
|
|||
# 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 =
|
||||
|
|
|
@ -61,11 +61,9 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
# Improve Khanda's responsiveness
|
||||
kernel.sysctl = {
|
||||
"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
|
||||
# Try to reduce swappiness - Khanda hates paging, even to NVMe storage
|
||||
"vm.swappiness" = 20;
|
||||
};
|
||||
|
||||
kernelModules = [
|
||||
|
@ -102,10 +100,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# Change I/O scheduler to Kyber to try and reduce stuttering under load.
|
||||
# NVME supports `mq-deadline` and `kyber` schedulers
|
||||
# Change I/O scheduler to BFQ to try and reduce stuttering under load.
|
||||
services.udev.extraRules = ''
|
||||
ACTION=="add|change", KERNEL=="nvme0n1", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="kyber"
|
||||
ACTION=="add|change", KERNEL=="nvme0*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
|
||||
'';
|
||||
|
||||
hardware = {
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
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'
|
||||
|
|
|
@ -57,10 +57,16 @@ in
|
|||
forgejo = {
|
||||
enable = true;
|
||||
settings.server = {
|
||||
DOMAIN = pkgs.util.getDomainFromURL cfg.url;
|
||||
DOMAIN =
|
||||
let
|
||||
parsedURL = (lib.strings.splitString "." cfg.url);
|
||||
in
|
||||
builtins.concatStringsSep "." [
|
||||
(builtins.elemAt parsedURL 1)
|
||||
(builtins.elemAt parsedURL 2)
|
||||
];
|
||||
ROOT_URL = cfg.url;
|
||||
HTTP_PORT = 3000;
|
||||
REPO_INDEXER_ENABLED = true; # Enable code indexing
|
||||
};
|
||||
useWizard = true;
|
||||
} // lib.optionalAttrs (cfg.home != null) { stateDir = cfg.home; };
|
||||
|
|
|
@ -23,7 +23,17 @@ in
|
|||
type = lib.types.str;
|
||||
default = "monthly";
|
||||
};
|
||||
nixos-upgrade-script.enable = lib.mkEnableOption "Installs the nos (nixos-upgrade-script) helper script.";
|
||||
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.";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = {
|
||||
|
|
|
@ -90,7 +90,6 @@ 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";
|
||||
|
|
Loading…
Reference in a new issue