From 70cc223444059ea2885275dac9ef55f970b92281 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Wed, 2 Jun 2021 15:28:48 +0200 Subject: treewide: NixOS 20.09 -> NixOS 21.05 --- common/commandline/htop.nix | 127 ++++++++++++++++++++++++---------- common/tinc.nix | 7 -- flake.lock | 16 ++--- flake.nix | 28 ++++++-- usecases/desktop/graphical/mpv.nix | 3 +- usecases/desktop/graphical/sway.nix | 6 +- usecases/desktop/pipewire.nix | 7 -- usecases/server/hydra-server.nix | 5 +- usecases/server/jellyfin.nix | 1 - usecases/server/monitoring-server.nix | 4 +- usecases/server/radicale.nix | 9 ++- usecases/server/taskserver.nix | 3 +- 12 files changed, 132 insertions(+), 84 deletions(-) diff --git a/common/commandline/htop.nix b/common/commandline/htop.nix index 95763a0..dd04405 100644 --- a/common/commandline/htop.nix +++ b/common/commandline/htop.nix @@ -3,44 +3,101 @@ inputs: { config, ... }: { - home-manager.users.minijackson = { ... }: - { - programs.htop = { - enable = true; - - fields = [ - "PID" "USER" - "PRIORITY" "NICE" - "STATE" - "IO_PRIORITY" "IO_READ_RATE" "IO_WRITE_RATE" - "PERCENT_CPU" "PERCENT_MEM" - "TIME" - "COMM" - ]; - - hideThreads = true; - hideUserlandThreads = true; - showThreadNames = true; - shadowOtherUsers = true; - - highlightBaseName = true; - - # On NixOS? NO. - showProgramPath = false; - - treeView = true; - - meters = { - left = [ "LeftCPUs2" "Memory" "Swap" "Blank" { kind = "Battery"; mode = 1; } ]; - right = [ "RightCPUs2" "Blank" "Tasks" "LoadAverage" "Uptime" ]; + home-manager.users.minijackson = { config, ... }: + { + programs.htop = { + enable = true; + + settings = { + fields = with config.lib.htop.fields; [ + PID + USER + PRIORITY + NICE + STATE + IO_PRIORITY + IO_READ_RATE + IO_WRITE_RATE + PERCENT_CPU + PERCENT_MEM + TIME + COMM + ]; + + hide_threads = true; + hide_kernel_threads = true; + hide_userland_threads = true; + show_thread_names = true; + shadow_other_users = true; + + highlight_base_name = true; + + # On NixOS? NO. + show_program_path = false; + + tree_view = true; + + left_meters = [ + "LeftCPUs" + "Memory" + "Swap" + "Zram" + "Blank" + "Battery" + ]; + left_meter_modes = with config.lib.htop.modes; [ + Bar + Bar + Bar + Bar + Text + Bar + ]; + + right_meters = [ + "RightCPUs" + "Blank" + "Tasks" + "LoadAverage" + "Uptime" + "Systemd" + ]; + right_meter_modes = with config.lib.htop.modes; [ + Bar + Text + Text + Text + Text + Text + ]; + # TODO: this doesn't keep the order: + # https://github.com/nix-community/home-manager/issues/2060 + /* + } // (with config.lib.htop; leftMeters { + LeftCPUs2 = modes.Bar; + Memory = modes.Bar; + Swap = modes.Bar; + Blank = modes.Text; + Battery = modes.Bar; + }) // (with config.lib.htop; rightMeters { + RightCPUs2 = modes.Bar; + Blank = modes.Text; + Tasks = modes.Text; + LoadAverage = modes.Text; + Uptime = modes.Text; + }); + */ + }; }; }; - }; home-manager.users.root = { ... }: - { - programs.htop = config.home-manager.users.minijackson.programs.htop // { - shadowOtherUsers = false; + { + programs.htop = { + enable = true; + settings = config.home-manager.users.minijackson.programs.htop.settings // { + shadowOtherUsers = false; + }; + }; }; - }; } diff --git a/common/tinc.nix b/common/tinc.nix index c77afb7..d176355 100644 --- a/common/tinc.nix +++ b/common/tinc.nix @@ -5,13 +5,6 @@ inputs: with lib; with builtins; { - # TODO: remove use of unstable for NixOS 21.05 - imports = [ - (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/networking/tinc.nix") - ]; - - disabledModules = [ "services/networking/tinc.nix" ]; - options.topology = { mainVpn = { interfaceName = mkOption { diff --git a/flake.lock b/flake.lock index 9008184..5a8ac54 100644 --- a/flake.lock +++ b/flake.lock @@ -37,16 +37,16 @@ ] }, "locked": { - "lastModified": 1622312678, - "narHash": "sha256-LsVDvO6TBnSQNNoV+Dt10+jx91eS74k8hf4zIOMAyR0=", + "lastModified": 1622312560, + "narHash": "sha256-xBWgiwnPaL/iZasPxw3BuvPAee/2jiToiZjKvKLs+PA=", "owner": "nix-community", "repo": "home-manager", - "rev": "49706878e1580d796cc99b63574310405935113f", + "rev": "ab64dc32493996c24607eab2cae6663466ddfb8a", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-20.09", + "ref": "release-21.05", "repo": "home-manager", "type": "github" } @@ -76,16 +76,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1622559709, - "narHash": "sha256-wnZUu3JNQTwu7q301TOsZFGxAcgBV8C3qks/aB8wztQ=", + "lastModified": 1622577619, + "narHash": "sha256-ODWgeRVXJz++vvapHSNO2G7AACfRjQoWMomuLhl+OcQ=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cee3ca37c68dad981396365bf4b1d0c807ac4eb4", + "rev": "5237039cc1e7633a7697ed7999afd1f80d91ff14", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-20.09", + "ref": "nixos-21.05", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index e4ac862..1e630a6 100644 --- a/flake.nix +++ b/flake.nix @@ -1,11 +1,11 @@ { description = "My NixOS configurations"; - inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09"; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05"; inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; inputs.flake-utils.url = "github:numtide/flake-utils"; inputs.home-manager = { - url = "github:nix-community/home-manager/release-20.09"; + url = "github:nix-community/home-manager/release-21.05"; inputs.nixpkgs.follows = "nixpkgs"; }; inputs.neovim-master = { @@ -26,8 +26,8 @@ test = { config, ... }: { imports = [ self.nixosModules.default ]; - home-manager.users.minijackson.home.stateVersion = "20.09"; - home-manager.users.root.home.stateVersion = "20.09"; + home-manager.users.minijackson.home.stateVersion = "21.05"; + home-manager.users.root.home.stateVersion = "21.05"; users.users.minijackson.initialHashedPassword = ""; users.users.root.initialHashedPassword = ""; @@ -109,6 +109,15 @@ modules = [ self.nixosModules.test self.nixosModules.profiles.desktop + + ({ modulesPath, ... }: { + imports = [ + (modulesPath + "/virtualisation/qemu-vm.nix") + ]; + + virtualisation.memorySize = 1024; + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + }) ]; }; @@ -118,6 +127,15 @@ self.nixosModules.test self.nixosModules.profiles.desktop self.nixosModules.usecases.desktop.development + + ({ modulesPath, ... }: { + imports = [ + (modulesPath + "/virtualisation/qemu-vm.nix") + ]; + + virtualisation.memorySize = 1024; + virtualisation.qemu.options = [ "-vga none -device virtio-gpu-pci" ]; + }) ]; }; @@ -201,8 +219,6 @@ networking.hostId = "4e98920d"; services.hydra = { - hydraURL = "localhost:3000"; - notificationSender = "hydra@localhost"; secretKeyLocation = builtins.toFile "store-secret-key" "testServer:0d5jJjOxIoe6sTr2YKWkQxsM3ZcW+9GAk52yYNVxfYBUxS2nUfzfQk5Jo0OwHnT95bTLXCVNQETGV4m6KHsVCA=="; diff --git a/usecases/desktop/graphical/mpv.nix b/usecases/desktop/graphical/mpv.nix index 381b893..219c86c 100644 --- a/usecases/desktop/graphical/mpv.nix +++ b/usecases/desktop/graphical/mpv.nix @@ -9,8 +9,7 @@ inputs: hwdec = "auto"; profile = "gpu-hq"; }; - # TODO: for 21.05 - #defaultProfiles = [ "gpu-hq" ]; + defaultProfiles = [ "gpu-hq" ]; scripts = with pkgs.mpvScripts; [ mpris sponsorblock ]; }; } diff --git a/usecases/desktop/graphical/sway.nix b/usecases/desktop/graphical/sway.nix index ab04de3..ab5d997 100644 --- a/usecases/desktop/graphical/sway.nix +++ b/usecases/desktop/graphical/sway.nix @@ -171,8 +171,6 @@ in }; }; - # TODO: 21.05 - /* services.wlsunset = { enable = true; latitude = "48.864716"; @@ -184,7 +182,6 @@ in }; systemdTarget = "sway-session.target"; }; - */ # TODO: upstream a PR to beautify this xdg.configFile."swaylock/config".text = with globalConfig.theme.colors; '' @@ -254,8 +251,7 @@ in environment.systemPackages = with pkgs; [ qt5.qtwayland ]; - # TODO: in 21.05 - #programs.xwayland.enable = true; + programs.xwayland.enable = true; security.pam.services.swaylock = { }; xdg.portal.extraPortals = with pkgs; [ diff --git a/usecases/desktop/pipewire.nix b/usecases/desktop/pipewire.nix index e742ba9..cd327ee 100644 --- a/usecases/desktop/pipewire.nix +++ b/usecases/desktop/pipewire.nix @@ -3,13 +3,6 @@ inputs: { pkgs, ... }: { - imports = [ - (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/desktops/pipewire/pipewire.nix") - (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/desktops/pipewire/pipewire-media-session.nix") - ]; - - disabledModules = [ "services/desktops/pipewire.nix" ]; - services.pipewire = { enable = true; package = pkgs.unstable.pipewire; diff --git a/usecases/server/hydra-server.nix b/usecases/server/hydra-server.nix index 3a1d62e..db09a6e 100644 --- a/usecases/server/hydra-server.nix +++ b/usecases/server/hydra-server.nix @@ -15,9 +15,8 @@ inputs: config = { services.hydra = { enable = true; - # TODO: for NixOS 21.05 - #hydraURL = "https://hydra.${config.networking.fqdn}"; - #notificationSender = "hydra@${config.networking.fqdn}"; + hydraURL = "https://hydra.${config.networking.fqdn}"; + notificationSender = "hydra@${config.networking.fqdn}"; buildMachinesFiles = [ ]; # Don't build *everything* from source useSubstitutes = true; diff --git a/usecases/server/jellyfin.nix b/usecases/server/jellyfin.nix index 0e0a0e4..6f62c34 100644 --- a/usecases/server/jellyfin.nix +++ b/usecases/server/jellyfin.nix @@ -3,7 +3,6 @@ inputs: { config, lib, pkgs, ... }: { - # TODO: for NixOS 21.05 imports = [ (inputs.nixpkgs-unstable.outPath + "/nixos/modules/services/misc/jellyfin.nix") ]; diff --git a/usecases/server/monitoring-server.nix b/usecases/server/monitoring-server.nix index 823f4f9..c39b145 100644 --- a/usecases/server/monitoring-server.nix +++ b/usecases/server/monitoring-server.nix @@ -12,9 +12,7 @@ inputs: listenAddress = "127.0.0.1"; - # TODO: for NixOS 21.05 - extraFlags = [ "--storage.tsdb.retention=15w" ]; - #retentionTime = "15w"; + retentionTime = "15w"; scrapeConfigs = [ { diff --git a/usecases/server/radicale.nix b/usecases/server/radicale.nix index a998643..b20bff8 100644 --- a/usecases/server/radicale.nix +++ b/usecases/server/radicale.nix @@ -3,13 +3,12 @@ inputs: { config, ... }: { - # TODO: use RFC42 settings for NixOS 21.05 services.radicale = { enable = true; - config = '' - [server] - hosts = ${config.topology.mainVpn.currentNodeIP}:5232 - ''; + settings = { + # Bind address on VPN interface only + server.hosts = "[${config.topology.mainVpn.currentNodeIP}]:5232"; + }; }; networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [ diff --git a/usecases/server/taskserver.nix b/usecases/server/taskserver.nix index e459e5c..614828c 100644 --- a/usecases/server/taskserver.nix +++ b/usecases/server/taskserver.nix @@ -5,8 +5,7 @@ inputs: { services.taskserver = { enable = true; - # TODO: for NixOS 21.05 - #fqdn = "tasks.${config.networking.fqdn}"; + fqdn = "tasks.${config.networking.fqdn}"; listenHost = config.topology.mainVpn.currentNodeIP; organisations.default.users = [ "minijackson" ]; -- cgit v1.2.3