This commit is contained in:
Peder Bergebakken Sundt 2023-03-19 04:23:38 +01:00
parent 9216212d12
commit 18488deb72
16 changed files with 102 additions and 76 deletions

10
.envrc
View File

@ -10,15 +10,21 @@ if ! test -s .direnv/pull-date || test "$now" != "$(cat .direnv/pull-date)"; the
fi fi
if command -v nixos-rebuild >/dev/null; then if command -v nixos-rebuild >/dev/null; then
use flake .#nomos-rebuild use flake .#nixos-rebuild-nom
elif ! command -v nixos-rebuild >/dev/null; then elif ! command -v nixos-rebuild >/dev/null; then
use flake .#non-nixos use flake .#non-nixos
fi fi
if test -s .remote.toml; then if test -s .remote.toml; then
use flake .#remote if ! command -v remote-init >/dev/null; then
use flake .#remote
fi
echo echo
echo "Current remote: $(remote-host)" echo "Current remote: $(remote-host)"
tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r tomlq <.remote.toml '.hosts | to_entries[] | "remote-set \(.key+1) # -> \(.value.host)"' -r
echo echo
fi fi
if rg 'TODO' -q ; then
echo "There are $(rg 'TODO' | wc -l ) 'TODO'"
fi

View File

@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
eval "$(nix print-dev-env .#nomos-rebuild)" eval "$(nix print-dev-env .#nixos-rebuild-nom)"
echo Entered $(hostname --fqdn) echo Entered $(hostname --fqdn)

View File

@ -18,6 +18,9 @@
* [ ] add a hidpi profile? https://wiki.archlinux.org/title/HiDPI * [ ] add a hidpi profile? https://wiki.archlinux.org/title/HiDPI
* [ ] rocm * [ ] rocm
* [ ] xclip * [ ] xclip
* [ ] https://git.m-labs.hk/M-Labs/wfvm
* [ ] https://github.com/kholia/OSX-KVM
* [ ] mlflow / wandb
* [ ] xforwarding over ssh * [ ] xforwarding over ssh
* [ ] autogenerate ssh keys * [ ] autogenerate ssh keys
* [ ] switch to systemd networkd * [ ] switch to systemd networkd

122
flake.nix
View File

@ -1,23 +1,28 @@
{ {
description = "pbsds' system/home flake"; description = "pbsds' system/home flake";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11"; inputs = {
inputs.unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
inputs.nur.url = "github:nix-community/NUR"; unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
inputs.home-manager.url = "github:nix-community/home-manager"; #/release-22.11"; nur.url = "github:nix-community/NUR";
inputs.home-manager.inputs.nixpkgs.follows = "nixpkgs"; home-manager.url = "github:nix-community/home-manager"; #/release-22.11";
inputs.nixos-hardware.url = "github:NixOS/nixos-hardware"; home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware";
#TODO: #TODO:
#sops-nix.url = "github:Mic92/sops-nix"; #sops-nix.url = "github:Mic92/sops-nix";
#sops-nix.inputs.nixpkgs.follows = "nixpkgs"; #sops-nix.inputs.nixpkgs.follows = "nixpkgs";
#matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix #matrix-next.url = "github:dali99/nixos-matrix-modules"; # see https://git.pvv.ntnu.no/Drift/pvv-nixos-config/src/main/flake.nix
inputs.pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git"; # TODO: somehow make these private repos optional (a lazy fetch would be nice)
inputs.pbsds-papers.flake = false; pbsds-papers.url = "git+ssh://git@github.com/pbsds/papers.git";
pbsds-papers.flake = false;
# temp # temporary stuff i want to use
inputs.pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14"; # TODO: can i fetch a subset of files if these? ^
pr-polaris14.url = "github:pbsds/nixpkgs/polaris-14";
pr-remote-exec.url = "github:pbsds/nixpkgs/remote-exec-init";
};
outputs = { outputs = {
self, self,
@ -35,7 +40,7 @@
"aarch64-linux" "aarch64-linux"
#"riscv64-linux" #"riscv64-linux"
]; ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system); forAllSystems = f: nixlib.genAttrs systems (system: f system);
overlays = nixlib.mapAttrsToList (name: val: val) self.overlays; overlays = nixlib.mapAttrsToList (name: val: val) self.overlays;
# TODO: move unstable and nur here? # TODO: move unstable and nur here?
@ -43,11 +48,12 @@
disabledModules = [ "services/misc/polaris.nix" ]; disabledModules = [ "services/misc/polaris.nix" ];
imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ]; imports = [ "${inputs.pr-polaris14}/nixos/modules/services/misc/polaris.nix" ];
nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ? nixpkgs.overlays = [(final: prev: { # TODO: nixpkgs.config.packageOverrides ?
remote-exec = prev.python3Packages.callPackage "${inputs.pr-remote-exec}/pkgs/tools/misc/remote-exec" { };
polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { }; polaris = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris" { };
polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { }; polaris-web = prev.callPackage "${inputs.pr-polaris14}/pkgs/servers/polaris/web.nix" { };
})]; })];
}; };
mkConfig = hostname: system: modules: nixpkgs.lib.nixosSystem { mkConfig = hostname: system: modules: nixlib.nixosSystem {
inherit system; inherit system;
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({ modules = modules ++ [ ./base.nix "${self}/hosts/${hostname}" tmpConfig ({
@ -78,57 +84,51 @@
inherit inputs; inherit inputs;
overlays.remote-exec = (final: prev: { overlays.remote-exec = (final: prev: {
remote-exec = prev.python3Packages.callPackage ./pkgs/remote-exec.nix {}; remote-exec = prev.python3Packages.callPackage ( inputs.pr-remote-exec + "/pkgs/tools/misc/remote-exec" ) {};
}); });
packages = forAllSystems(system: packages = forAllSystems(system:
let pkgs = import nixpkgs { inherit system overlays; }; let pkgs = nixpkgs.legacyPackages.${system}; in {
in { inherit (pkgs) remote-exec; } inherit (self.overlays.remote-exec null pkgs) remote-exec;
);
nixosConfigurations.noximilien = mkConfig "noximilien" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]);
nixosConfigurations.bolle = mkConfig "bolle" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel ]);
#nixosConfigurations.nord = mkConfig "nord" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-amd ]);
nixosConfigurations.nord = mkConfig "nord" "x86_64-linux" (with nixos-hardware.nixosModules; [ common-pc common-pc-ssd common-cpu-intel common-gpu-amd ]);
homeConfigurations = forAllSystems (system: {
pbsds = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [ ./users/pbsds/home ];
};
pbsds-gnome = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [ ./users/pbsds/home/gnome.nix ];
};
}); });
devShells = forAllSystems (system: { # TODO: apply my overlays? nixosConfigurations = let nm = nixos-hardware.nixosModules; in {
#default = nixpkgs.legacyPackages.${system}.mkShell { # TODO: move nixos-hardware imports to the nixos configs?
# packages = with nixpkgs.legacyPackages.${system}; [ noximilien = mkConfig "noximilien" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]);
# ]; bolle = mkConfig "bolle" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel ]);
#}; nord = mkConfig "nord" "x86_64-linux" (with nm; [ common-pc common-pc-ssd common-cpu-intel-cpu-only common-gpu-amd ]);
nomos-rebuild = nixpkgs.legacyPackages.${system}.mkShell { };
packages = with nixpkgs.legacyPackages.${system}; [
(writeScriptBin "nixos-rebuild" '' homeConfigurations = forAllSystems (system: let
exec ${nixos-rebuild}/bin/nixos-rebuild "$@" |& ${nix-output-monitor}/bin/nom mkHome = modules: home-manager.lib.homeManagerConfiguration {
'') pkgs = nixpkgs.legacyPackages.${system};
]; inherit modules;
};
non-nixos = nixpkgs.legacyPackages.${system}.mkShell {
packages = with nixpkgs.legacyPackages.${system}; [
(writeScriptBin "nixos-rebuild" ''
exec ${nixos-rebuild}/bin/nixos-rebuild "$@" |& ${nix-output-monitor}/bin/nom
'')
nix-output-monitor
home-manager
];
};
remote = nixpkgs.legacyPackages.${system}.mkShell {
packages = with nixpkgs.legacyPackages.${system}; [
self.packages.${system}.remote-exec
yq
];
}; };
in {
pbsds = mkHome [ ./users/pbsds/home ];
pbsds-gnome = mkHome [ ./users/pbsds/home/gnome.nix ];
});
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
remote-exec = pkgs.remote-exec or (self.overlays.remote-exec pkgs pkgs).remote-exec;
nixos-rebuild-nom = pkgs.writeScriptBin "nixos-rebuild" ''
exec ${pkgs.nixos-rebuild}/bin/nixos-rebuild "$@" |& ${pkgs.nix-output-monitor}/bin/nom
'';
mkShell = packages: pkgs.mkShell { inherit packages; };
in {
nixos-rebuild-nom = mkShell [
nixos-rebuild-nom
];
non-nixos = mkShell [
nixos-rebuild-nom
pkgs.home-manager
pkgs.nix-output-monitor
];
remote = mkShell [
remote-exec
pkgs.yq
];
}); });
}; };

View File

@ -1,7 +1,13 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
services.xserver.videoDrivers = [ "amdgpu" ]; # for some reason nixos-hardware uses "modesetting"
# assumes common-gpu-amd from nixos-hardware is also added # assumes common-gpu-amd from nixos-hardware is also added
# TODO: should we move it from flake.nix to here?
# https://libreddit.noximilien.pbsds.net/r/archlinux/comments/nih9c9/amdgpu_vs_modesetting_in_current_510_kernels_xorg/
services.xserver.videoDrivers = [ "amdgpu" ]; # use gpu, adaptive sync and and hardware page flipping
#services.xserver.videoDrivers = [ "modesetting" ]; # integrated (non-accelerated) framebuffer, KMS
nixpkgs.config.rocmSupport = true; nixpkgs.config.rocmSupport = true;
systemd.tmpfiles.rules = [ systemd.tmpfiles.rules = [
"L+ /opt/rocm/hip - - - - ${pkgs.hip}" "L+ /opt/rocm/hip - - - - ${pkgs.hip}"

View File

@ -76,6 +76,8 @@
flat-remix-icon-theme flat-remix-icon-theme
feh feh
zotero
firefox firefox
]; ];

View File

@ -1,12 +1,14 @@
{ lib { lib
, fetchFromGitHub , fetchFromGitHub
, buildPythonApplication , buildPythonApplication
# inputs
# runtime
, click , click
, toml , toml
, pydantic , pydantic
, watchdog , watchdog
# testing
# check
, pytestCheckHook , pytestCheckHook
, rsync , rsync
}: }:

View File

@ -4,6 +4,8 @@
programs.steam.remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play programs.steam.remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
programs.steam.dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server programs.steam.dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
# TODO: gamemode?
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"steam" "steam"
"steam-original" "steam-original"

View File

@ -7,7 +7,7 @@ in
options = with lib; { options = with lib; {
services.domeneshop-updater.target = mkOption { services.domeneshop-updater.target = mkOption {
type = types.str; type = types.str; #TODO list of string
#default = config.networking.fqdn; #default = config.networking.fqdn;
}; };
}; };

View File

@ -16,7 +16,7 @@ let
sshUser = "pbsds"; sshUser = "pbsds";
maxJobs = 12; # 12 cores maxJobs = 12; # 12 cores
#maxJobs = 1; # at least for big-parallel #maxJobs = 1; # at least for big-parallel
speedFactor = 2; speedFactor = 3;
supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ]; supportedFeatures = [ "kvm" "big-parallel" "nixos-test" ];
#mandatoryFeatures = [ ]; #mandatoryFeatures = [ ];
publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeOB/57N1fQPVorIUlkkJZaQduBo+4+km2Qbj4ebd/k"; publicKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILeOB/57N1fQPVorIUlkkJZaQduBo+4+km2Qbj4ebd/k";
@ -52,7 +52,7 @@ let
proxy.host = "isvegg.pvv.ntnu.no"; proxy.host = "isvegg.pvv.ntnu.no";
proxy.publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU="; proxy.publicKey = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGurF7rdnrDP/VgIK2Tx38of+bX/QGCGL+alrWnZ1Ca5llGneMulUt1RB9xZzNLHiaWIE+HOP0i4spEaeZhilfU=";
} }
/**/ /** /
{ {
systems = [ "x86_64-linux" "wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ]; systems = [ "x86_64-linux" "wasm32-wasi" "wasm64-wasi" "x86_64-windows" "aarch64-linux" "riscv64-linux" ];
hostName = "nord.pbsds.net"; # TODO: port 24 hostName = "nord.pbsds.net"; # TODO: port 24

View File

@ -27,6 +27,8 @@
strace strace
killall killall
pciutils
htop htop
glances glances

View File

@ -3,7 +3,7 @@
#imports = [ <home-manager/nixos> ]; #imports = [ <home-manager/nixos> ];
imports = [ inputs.home-manager.nixosModule ]; imports = [ inputs.home-manager.nixosModule ];
home-manager.useGlobalPkgs = true; # go brrr home-manager.useGlobalPkgs = true; # go brrr
#home-manager.useUserPackages = true # needed if VM, will also go a bit more brrr #home-manager.useUserPackages = true # needed if VM, somewhat brrr, installs user packages to /etc instead of ~/.nix-profile
# When adding a new user accounts: Don't forget to set a password with passwd! # When adding a new user accounts: Don't forget to set a password with passwd!
} }

View File

@ -116,6 +116,7 @@
manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix''; manix-fzf = ''manix "" 2>/dev/null | grep '^# ' | sed 's/^# \(.*\) (.*/\1/;s/ (.*//;s/^# //' | fzf --preview="manix '{}'" | xargs manix'';
# TODO: move to /run/user/... # TODO: move to /run/user/...
# TODO: add --nom once released - https://github.com/Mic92/nixpkgs-review/pull/303
nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review''; nixpkgs-review = ''mkdir -p /dev/shm/nixpkgs-review && ln -sfn /dev/shm/nixpkgs-review $HOME/.cache/nixpkgs-review && nixpkgs-review'';
}; };

View File

@ -1,6 +1,6 @@
[general] [general]
fontname=Monospace 14 fontname=Monospace 14
selchars=-A-Za-z0-9,./?%&#:_ selchars=-A-Za-z0-9,./?%&#:_+
scrollback=5000 scrollback=5000
bgcolor=rgb(0,0,0) bgcolor=rgb(0,0,0)
fgcolor=rgb(211,215,207) fgcolor=rgb(211,215,207)

View File

@ -2,12 +2,13 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
bat bat
bat-extras.batman #bat-extras.batman
]; ];
# bat - TODO: condition these on programs.bat.enable ? # bat - TODO: condition these on programs.bat.enable ?
home.shellAliases.cat = "bat --style=plain --paging=never"; home.shellAliases.cat = "bat --style=plain --paging=never";
home.shellAliases.man = "batman"; #home.shellAliases.man = "batman";
home.shellAliases.man = "PAGER=${pkgs.most}/bin/most man";
# TODO: implement programs.bat.enableAliases # TODO: implement programs.bat.enableAliases
programs.bat = { programs.bat = {

View File

@ -25,17 +25,18 @@
"gogs.*".forwardX11 = false; "gogs.*".forwardX11 = false;
"git.*".forwardX11 = false; "git.*".forwardX11 = false;
"*.pbsds.net".forwardX11 = true; "*.pbsds.net".forwardX11 = true;
"*.pbsds.net".forwardX11Trusted = true;
"*.ntnu.no".user = "pederbs"; "*.ntnu.no".user = "pederbs";
"*.pvv.org".user = "pederbs"; "*.pvv.org".user = "pederbs";
"*.hpc.ntnu.no".proxyJump = "isvegg.pvv.ntnu.no"; "*.hpc.ntnu.no".proxyJump = "isvegg.pvv.ntnu.no";
"*.idi.ntnu.no".proxyJump = "isvegg.pvv.ntnu.no"; "*.idi.ntnu.no".proxyJump = "isvegg.pvv.ntnu.no";
# me # me
"roxm.pbsds.net".proxyJump = "isvegg.pvv.ntnu.no";
"noximilien.pbsds.net" = {};
"bolle.pbsds.net".proxyJump = "isvegg.pvv.ntnu.no"; "bolle.pbsds.net".proxyJump = "isvegg.pvv.ntnu.no";
"knut.pbsds.net".port = 23; "knut.pbsds.net".port = 23;
"nord.pbsds.net".port = 24; "nord.pbsds.net".port = 24;
"noximilien.pbsds.net" = {};
"rocm.pbsds.net".proxyJump = "isvegg.pvv.ntnu.no";
# ntnu # ntnu
"stud.ntnu.no".hostname = "login.stud.ntnu.no"; "stud.ntnu.no".hostname = "login.stud.ntnu.no";