From 0d838e68aaa8dc3b7fdb1672c2268966b95efc3d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 20 Apr 2024 00:03:23 +0200 Subject: [PATCH 01/36] dconf-common: set button layout and enable resizing with meta+rmb --- nix-os/dconf-common.nix | 5 +++++ nix-os/desktopManagers/gnome.nix | 1 + 2 files changed, 6 insertions(+) diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index bc9c2b0..aa48a78 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -30,6 +30,11 @@ let allow-volume-above-100-percent = true; }; + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:close"; + resize-with-right-button = true; + }; + "org/gnome/mutter" = { dynamic-workspaces = true; workspaces-only-on-primary = true; diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index 9e7afa8..4f96ceb 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -17,6 +17,7 @@ "org/gnome/desktop/media-handling" "org/gnome/desktop/peripherals/mouse" "org/gnome/desktop/sound" + "org/gnome/desktop/wm/preferences" "org/gnome/mutter" "org/gnome/SessionManager" "org/gnome/settings-daemon/plugins/power" From 2042ae52321b6f80eca89c1d2f6583829caa93f4 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sat, 20 Apr 2024 03:28:18 +0200 Subject: [PATCH 02/36] shell.nix: apply HISTCONTROL to bash interactiveShellInit --- nix-os/shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 5c2bc44..99408c2 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -37,6 +37,7 @@ in ''; programs.bash.interactiveShellInit = '' + HISTCONTROL=ignoreboth if test -n "$KITTY_INSTALLATION_DIR"; then export KITTY_SHELL_INTEGRATION="enabled,no-sudo" source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash" From 04767f4059bb03ab7bf4b2cd053c3d74ea166a53 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Thu, 2 May 2024 10:00:04 +0200 Subject: [PATCH 03/36] core: replace neofetch with fastfetch --- nix-os/core.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index cd2dc96..f76fe79 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -52,7 +52,7 @@ mpv htop btop - neofetch + fastfetch ranger gimp inkscape From cab57d1dccde353d7478adfe56d60b5597fe788a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 12 May 2024 03:39:08 +0200 Subject: [PATCH 04/36] core: use direct envrioment.variables for setting nvim as default editor programs.neovim.defaultEditor only sets "nvim" which is dependent on the PATH, I don't want that --- nix-os/core.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index f76fe79..0ec595e 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -2,7 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running 'nixos-help'). -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { # Bootloader. @@ -65,7 +65,6 @@ programs.neovim = { enable = true; viAlias = true; - defaultEditor = true; configure = { customRC = '' set number @@ -92,6 +91,11 @@ }; }; + environment.variables = lib.mkIf config.programs.neovim.enable { + EDITOR = "${config.programs.neovim.finalPackage}/bin/nvim"; + VISUAL = "${config.programs.neovim.finalPackage}/bin/nvim"; + }; + programs.steam = { enable = true; remotePlay.openFirewall = true; From b5885e7fa8f15ae31679e7a97ad9204c157faa18 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 12 May 2024 03:39:48 +0200 Subject: [PATCH 05/36] core: enable vimAlias --- nix-os/core.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index 0ec595e..b87f14f 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -65,6 +65,7 @@ programs.neovim = { enable = true; viAlias = true; + vimAlias = true; configure = { customRC = '' set number From 30bee709a566fea204ddc8e945689189dabece67 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 13 May 2024 08:50:31 +0200 Subject: [PATCH 06/36] Don't use store path for environment variables --- nix-os/core.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index b87f14f..f58b699 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -92,9 +92,9 @@ }; }; - environment.variables = lib.mkIf config.programs.neovim.enable { - EDITOR = "${config.programs.neovim.finalPackage}/bin/nvim"; - VISUAL = "${config.programs.neovim.finalPackage}/bin/nvim"; + environment.variables = lib.mkIf config.programs.neovim.enable rec { + EDITOR = "/run/current-system/sw/bin/nvim"; + VISUAL = EDITOR; }; programs.steam = { From 1cc877bddb9ad1f097eeb64e0921bc1fbed5d82c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 14 May 2024 06:57:27 +0200 Subject: [PATCH 07/36] unstable-packages: store version in system derivation output --- nix-os/unstable-packages.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nix-os/unstable-packages.nix b/nix-os/unstable-packages.nix index 67f0f5b..27e0727 100644 --- a/nix-os/unstable-packages.nix +++ b/nix-os/unstable-packages.nix @@ -31,6 +31,7 @@ in }; }; config._module.args.unstablePkgs = config.unstable.pkgs; - # FIXME: move it to the system derivation output (overrideAttrs config.system.build.toplevel?) - config.environment.etc."NIXOS-UNSTABLE-VERSION".text = nixos-unstable-version; + config.system.extraSystemBuilderCmds = lib.mkIf config.unstable.enable '' + echo ${nixos-unstable-version} > $out/nixos-unstable-version + ''; } \ No newline at end of file From 5d0bf2000d4fcd33a65a94aa7b8ca5432be6625b Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 17 May 2024 11:22:52 +0200 Subject: [PATCH 08/36] virtualization: explicitly enable ovmf with OVMFFull --- nix-os/virtualization.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix-os/virtualization.nix b/nix-os/virtualization.nix index 7aaa239..c1e062f 100644 --- a/nix-os/virtualization.nix +++ b/nix-os/virtualization.nix @@ -6,5 +6,11 @@ programs.virt-manager.enable = true; virtualisation.libvirtd = { enable = true; + qemu.ovmf = { + enable = true; + packages = [ + pkgs.OVMFFull.fd + ]; + }; }; } From cae29c2484f81ff773c776c96f8c98cc6be8380d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 17 May 2024 21:45:11 +0200 Subject: [PATCH 09/36] meta: rename nix-os-configs to hosts --- {nix-os-configs => hosts}/main.nix | 0 {nix-os-configs => hosts}/vm.nix | 0 nixos-rebuild.sh | 2 +- vm.sh | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename {nix-os-configs => hosts}/main.nix (100%) rename {nix-os-configs => hosts}/vm.nix (100%) diff --git a/nix-os-configs/main.nix b/hosts/main.nix similarity index 100% rename from nix-os-configs/main.nix rename to hosts/main.nix diff --git a/nix-os-configs/vm.nix b/hosts/vm.nix similarity index 100% rename from nix-os-configs/vm.nix rename to hosts/vm.nix diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh index 0d1dda7..55aa311 100755 --- a/nixos-rebuild.sh +++ b/nixos-rebuild.sh @@ -1 +1 @@ -NIXOS_CONFIG="$(pwd)/nix-os-configs/main.nix" nixos-rebuild $@ +NIXOS_CONFIG="$(pwd)/hosts/main.nix" nixos-rebuild $@ diff --git a/vm.sh b/vm.sh index 37f0b48..1ad67ec 100755 --- a/vm.sh +++ b/vm.sh @@ -1 +1 @@ -nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./nix-os-configs/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 +nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./hosts/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 From 31994d38f6ca341577e7bcc07f56e5858fc0d204 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 19 May 2024 13:27:41 +0200 Subject: [PATCH 10/36] service/nix-binary-cache: create and use in main host --- hosts/main.nix | 1 + nix-os/services/nix-binary-cache.nix | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 nix-os/services/nix-binary-cache.nix diff --git a/hosts/main.nix b/hosts/main.nix index e09af33..49a9b8f 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -20,5 +20,6 @@ ../nix-os/adb.nix ../nix-os/account.nix ../nix-os/xdg-default-apps.nix + ../nix-os/services/nix-binary-cache.nix ]; } \ No newline at end of file diff --git a/nix-os/services/nix-binary-cache.nix b/nix-os/services/nix-binary-cache.nix new file mode 100644 index 0000000..aaff003 --- /dev/null +++ b/nix-os/services/nix-binary-cache.nix @@ -0,0 +1,8 @@ +{ + config = { + services.nix-serve = { + enable = true; + secretKeyFile = "/var/cache-priv-key.pem"; + }; + }; +} From bd309d916c38d491b5c3fd69cfb007a6bb67be24 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 20 May 2024 22:42:22 +0200 Subject: [PATCH 11/36] dconf-common: fix typos --- nix-os/dconf-common.nix | 4 ++-- nix-os/desktopManagers/gnome.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index aa48a78..1f03a56 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -144,7 +144,7 @@ let custom-keybindings = [ ( if builtins.elem pkgs.kitty config.environment.systemPackages then - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" else null ) ]; @@ -152,7 +152,7 @@ let screensaver = ["l"]; }; - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" = + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = if builtins.elem pkgs.kitty config.environment.systemPackages then { binding = "t"; command = "kitty"; diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index 4f96ceb..d64b100 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -31,7 +31,7 @@ "org/gnome/shell/keybindings" "org/gnome/desktop/default-applications/terminal" "org/gnome/settings-daemon/plugins/media-keys" - "org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" ]; }]; From 1095c7884b8ebd5ef209f2326d5e189dd55ed4cb Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 15:03:32 +0200 Subject: [PATCH 12/36] core: disable flatpak --- nix-os/core.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index f58b699..b02c4d4 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -22,9 +22,6 @@ # Enable CUPS to print documents. services.printing.enable = true; - # Enable flatpak, some software is newer here unfortunately - services.flatpak.enable = true; - # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; From ab2c2b00fb540dc4230af5ada00913423c71376e Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 15:08:52 +0200 Subject: [PATCH 13/36] core: move desktop apps to account.nix --- nix-os/account.nix | 3 +++ nix-os/core.nix | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index d6f763e..5f4cc61 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -21,6 +21,9 @@ vivaldi discord-canary unstablePkgs.vscode + gimp + inkscape + krita ]; }; users.groups.wroclaw.gid = 1000; diff --git a/nix-os/core.nix b/nix-os/core.nix index b02c4d4..4208c2c 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -51,9 +51,6 @@ btop fastfetch ranger - gimp - inkscape - krita smartmontools ddrescue ]; From 43ba0271aa8e16a8587e44fc63c7b59f78df71fd Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 15:15:01 +0200 Subject: [PATCH 14/36] core: move system.stateVersion to hosts --- hosts/main.nix | 4 ++++ nix-os/core.nix | 9 --------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/hosts/main.nix b/hosts/main.nix index 49a9b8f..81c2d7a 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -22,4 +22,8 @@ ../nix-os/xdg-default-apps.nix ../nix-os/services/nix-binary-cache.nix ]; + + config = { + system.stateVersion = "23.05"; + }; } \ No newline at end of file diff --git a/nix-os/core.nix b/nix-os/core.nix index 4208c2c..b024239 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -117,13 +117,4 @@ # Disable firewall networking.firewall.enable = false; - - # This value determines the NixOS release from which the default - # settings for stateful data, like file locations and database versions - # on your system were taken. It's perfectly fine and recommended to leave - # this value at the release version of the first install of this system. - # Before changing this value read the documentation for this option - # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = "23.05"; # Did you read the comment? - # I am lazy } From 6a7dff6a96a2fe618120b0331f6573be1331de63 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 16:09:40 +0200 Subject: [PATCH 15/36] core: remove firewall option definition --- nix-os/core.nix | 3 --- 1 file changed, 3 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index b024239..34a0801 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -114,7 +114,4 @@ X11Forwarding yes ''; }; - - # Disable firewall - networking.firewall.enable = false; } From 1786dbfac7feb5d339578cec8b85137e2c26786f Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 20:07:30 +0200 Subject: [PATCH 16/36] core: move programs.steam to account.nix --- nix-os/account.nix | 5 +++++ nix-os/core.nix | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index 5f4cc61..2b603c6 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -28,6 +28,11 @@ }; users.groups.wroclaw.gid = 1000; + programs.steam = { + enable = true; + remotePlay.openFirewall = true; + }; + services.syncthing = { enable = true; user = "wroclaw"; diff --git a/nix-os/core.nix b/nix-os/core.nix index 34a0801..ffc5a40 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -91,11 +91,6 @@ VISUAL = EDITOR; }; - programs.steam = { - enable = true; - remotePlay.openFirewall = true; - }; - # Enable fail2ban because of the OpenSSH server services.fail2ban = { enable = true; From 6d793ecb1ce9e465df855e65e5ee3874078d2425 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 20:22:26 +0200 Subject: [PATCH 17/36] core: move neovim to shell.nix --- nix-os/core.nix | 36 ------------------------------------ nix-os/shell.nix | 37 ++++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index ffc5a40..663354f 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -55,42 +55,6 @@ ddrescue ]; - # terminal text editor - programs.neovim = { - enable = true; - viAlias = true; - vimAlias = true; - configure = { - customRC = '' - set number - set hlsearch - set incsearch - set tabstop=4 - set softtabstop=4 - set shiftwidth=4 - set expandtab - set autoindent - - syntax on - set encoding=utf-8 - set wildmode=longest,list,full - set listchars=space:·,tab:┄┄» - set indentkeys-=0# - ''; - packages.myVimPackage = with pkgs.vimPlugins; { - start = [ - guess-indent-nvim - vim-visual-multi - ]; - }; - }; - }; - - environment.variables = lib.mkIf config.programs.neovim.enable rec { - EDITOR = "/run/current-system/sw/bin/nvim"; - VISUAL = EDITOR; - }; - # Enable fail2ban because of the OpenSSH server services.fail2ban = { enable = true; diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 99408c2..d742dc7 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -1,4 +1,4 @@ -{ config, pkgs, unstablePkgs, ... }: +{ config, pkgs, unstablePkgs, lib, ... }: let rangerGit = pkgs.ranger.overrideAttrs (old: { @@ -75,6 +75,41 @@ in programs.direnv.enable = true; + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + configure = { + customRC = '' + set number + set hlsearch + set incsearch + set tabstop=4 + set softtabstop=4 + set shiftwidth=4 + set expandtab + set autoindent + + syntax on + set encoding=utf-8 + set wildmode=longest,list,full + set listchars=space:·,tab:┄┄» + set indentkeys-=0# + ''; + packages.myVimPackage = with pkgs.vimPlugins; { + start = [ + guess-indent-nvim + vim-visual-multi + ]; + }; + }; + }; + + environment.variables = lib.mkIf config.programs.neovim.enable rec { + EDITOR = "/run/current-system/sw/bin/nvim"; + VISUAL = EDITOR; + }; + programs.starship = { enable = true; settings = { From 0dfba79fd33455c2a6cb213c7d000b3617d9ed21 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 21 May 2024 20:22:48 +0200 Subject: [PATCH 18/36] shell: remove unused comment --- nix-os/shell.nix | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index d742dc7..3308eab 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -127,12 +127,6 @@ in command = "echo \"✦\""; style = "bold 208"; }; - # custom.PS1 = { - # when = true; - # command = "echo -e \"\\x1b\\x5d133;A\\x1b\\x5c\""; - # format = "$output"; - # use_stdin = false; - # }; }; }; } From 22a7d47aced9963388cfa2799ebb98f6190b30cc Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 22 May 2024 15:32:40 +0200 Subject: [PATCH 19/36] core: split to core-desktop.nix --- hosts/main.nix | 1 + nix-os/core-desktop.nix | 28 ++++++++++++++++++++++++++++ nix-os/core.nix | 25 ------------------------- 3 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 nix-os/core-desktop.nix diff --git a/hosts/main.nix b/hosts/main.nix index 81c2d7a..faa817e 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -7,6 +7,7 @@ # Include device-specific overrides (if builtins.pathExists /etc/nixos/device-configuration.nix then /etc/nixos/device-configuration.nix else null) ../nix-os/core.nix + ../nix-os/core-desktop.nix ../nix-os/nvidia.nix ../nix-os/docker.nix ../nix-os/razer.nix diff --git a/nix-os/core-desktop.nix b/nix-os/core-desktop.nix new file mode 100644 index 0000000..2f5a087 --- /dev/null +++ b/nix-os/core-desktop.nix @@ -0,0 +1,28 @@ +{config, lib, pkgs, ... }: + +{ + config = { + services.printing.enable = true; + + sound.enable = true; + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + + # Enable audio interfaces renaming + wireplumber.enable = true; + }; + + environment.systemPackages = with pkgs; [ + mpv + ]; + + services.openssh.extraConfig = '' + X11Forwarding yes + ''; + }; +} \ No newline at end of file diff --git a/nix-os/core.nix b/nix-os/core.nix index 663354f..994a483 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -12,29 +12,8 @@ # kernel boot.kernelPackages = pkgs.linuxPackages_latest; - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - # Enable networking networking.networkmanager.enable = true; - - # X11 and desktop/display manager is enabled using imported files - - # Enable CUPS to print documents. - services.printing.enable = true; - - # Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - - # Enable audio interfaces renaming - wireplumber.enable = true; - }; # Allow unfree packages nixpkgs.config.allowUnfree = true; @@ -46,7 +25,6 @@ git ffmpeg yt-dlp - mpv htop btop fastfetch @@ -69,8 +47,5 @@ 22 8022 ]; - extraConfig = '' - X11Forwarding yes - ''; }; } From 99a10f35ddcbe1d427ebb9c8f6ffc888f4931bf9 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 22 May 2024 15:33:26 +0200 Subject: [PATCH 20/36] core: move bootloader to hosts --- hosts/main.nix | 3 +++ nix-os/core.nix | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hosts/main.nix b/hosts/main.nix index faa817e..c9f3d25 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -25,6 +25,9 @@ ]; config = { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + system.stateVersion = "23.05"; }; } \ No newline at end of file diff --git a/nix-os/core.nix b/nix-os/core.nix index 994a483..d79f6e9 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -5,10 +5,6 @@ { config, pkgs, lib, ... }: { - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - # kernel boot.kernelPackages = pkgs.linuxPackages_latest; From 8c352ea5ecd2cd46d1d7c17b1e72780897a08ffa Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Sun, 26 May 2024 21:15:26 +0200 Subject: [PATCH 21/36] shell/kitty: add shortcut for copying with ansi --- nix-os/shell.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index 3308eab..c13ffbe 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -54,6 +54,8 @@ in ${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else ""} background_opacity 0.8 dynamic_background_opacity yes + + map kitty_mod+alt+c copy_ansi_to_clipboard ''; environment.etc."ranger/rc.conf".text = '' From 1308bb8cc5f8bbc2f3ed734bafb9477dcb56a8d6 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 01:32:24 +0200 Subject: [PATCH 22/36] hosts/main: remove imports from etc /etc/nixos/configuration.nix should import hosts configuration instead --- hosts/main.nix | 4 ---- nixos-rebuild.sh | 1 - 2 files changed, 5 deletions(-) delete mode 100755 nixos-rebuild.sh diff --git a/hosts/main.nix b/hosts/main.nix index c9f3d25..7b7cbdf 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -2,10 +2,6 @@ { imports = [ - # Include the results of the hardware scan. - (if builtins.pathExists /etc/nixos/hardware-configuration.nix then /etc/nixos/hardware-configuration.nix else null) - # Include device-specific overrides - (if builtins.pathExists /etc/nixos/device-configuration.nix then /etc/nixos/device-configuration.nix else null) ../nix-os/core.nix ../nix-os/core-desktop.nix ../nix-os/nvidia.nix diff --git a/nixos-rebuild.sh b/nixos-rebuild.sh deleted file mode 100755 index 55aa311..0000000 --- a/nixos-rebuild.sh +++ /dev/null @@ -1 +0,0 @@ -NIXOS_CONFIG="$(pwd)/hosts/main.nix" nixos-rebuild $@ From 384fdd9172a74700d110e1298dc105f4d472487c Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 01:32:41 +0200 Subject: [PATCH 23/36] hosts: add tablet --- hosts/tablet.nix | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 hosts/tablet.nix diff --git a/hosts/tablet.nix b/hosts/tablet.nix new file mode 100644 index 0000000..b369d47 --- /dev/null +++ b/hosts/tablet.nix @@ -0,0 +1,39 @@ +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../nix-os/core.nix + ../nix-os/core-desktop.nix + ../nix-os/account.nix + ../nix-os/adb.nix + ../nix-os/locale.nix + ../nix-os/shell.nix + + ../nix-os/desktopManagers/gnome.nix + ../nix-os/displayManagers/gdm.nix + ]; + + config = { + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "wroclaw-hp"; + networking.networkmanager.enable = true; + networking.firewall.enable = true; + services.xserver.displayManager.gdm.wayland = lib.mkForce true; + hardware.sensor.iio.enable = true; + + networking.firewall.allowedTCPPortRanges = [ + # KDE Connect + rec { from = 1714; to = from + 50; } + ]; + + networking.firewall.allowedUDPPortRanges = [ + # KDE Connect + rec { from = 1714; to = from + 50; } + ]; + + system.stateVersion = "23.11"; + }; +} + From 8db3b7cc1b954b6b212958d891d5f5fb09a0bc04 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 01:39:46 +0200 Subject: [PATCH 24/36] vm: don't follow channel --- vm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm.sh b/vm.sh index 1ad67ec..1317383 100755 --- a/vm.sh +++ b/vm.sh @@ -1 +1 @@ -nix-build '' -A vm -I nixpkgs=channel:nixos-23.11 -I nixos-config=./hosts/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 +nix-build '' -A vm -I nixos-config=./hosts/vm.nix $@ && $(ls ./result/bin/run-*) -m 4096 && rm *.qcow2 From da55e963be6a0f03525165422eb7cf3b844e3ce7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 01:56:50 +0200 Subject: [PATCH 25/36] nix-os/udev: create --- hosts/main.nix | 1 + hosts/tablet.nix | 1 + hosts/vm.nix | 1 + nix-os/udev.nix | 5 +++++ 4 files changed, 8 insertions(+) create mode 100644 nix-os/udev.nix diff --git a/hosts/main.nix b/hosts/main.nix index 7b7cbdf..db6241e 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -18,6 +18,7 @@ ../nix-os/account.nix ../nix-os/xdg-default-apps.nix ../nix-os/services/nix-binary-cache.nix + ../nix-os/udev.nix ]; config = { diff --git a/hosts/tablet.nix b/hosts/tablet.nix index b369d47..4cb94ff 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -11,6 +11,7 @@ ../nix-os/desktopManagers/gnome.nix ../nix-os/displayManagers/gdm.nix + ../nix-os/udev.nix ]; config = { diff --git a/hosts/vm.nix b/hosts/vm.nix index c91a794..0b99d01 100644 --- a/hosts/vm.nix +++ b/hosts/vm.nix @@ -14,5 +14,6 @@ ../nix-os/adb.nix ../nix-os/account.nix ../nix-os/xdg-default-apps.nix + ../nix-os/udev.nix ]; } \ No newline at end of file diff --git a/nix-os/udev.nix b/nix-os/udev.nix new file mode 100644 index 0000000..5c27b88 --- /dev/null +++ b/nix-os/udev.nix @@ -0,0 +1,5 @@ +{ + config = { + hardware.ledger.enable = true; + }; +} From 4d4a007a005fa842406f55a8f7e5d27b2330d49a Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 01:58:13 +0200 Subject: [PATCH 26/36] hosts/main: store configuration previously in device-configuration.nix in git --- hosts/main.nix | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hosts/main.nix b/hosts/main.nix index db6241e..33d97a6 100644 --- a/hosts/main.nix +++ b/hosts/main.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { imports = [ @@ -19,12 +19,32 @@ ../nix-os/xdg-default-apps.nix ../nix-os/services/nix-binary-cache.nix ../nix-os/udev.nix + + (builtins.fetchTarball "https://github.com/nix-community/nixos-vscode-server/tarball/fc900c16efc6a5ed972fb6be87df018bcf3035bc") ]; config = { boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + networking.hostName = "wroclaw-main"; + + services.xrdp.enable = true; + users.groups."tsusers".members = [ "wroclaw" ]; + + services.printing.drivers = with pkgs; [ + hplip + ]; + + # nixos-vscode-server module needs this + programs.nix-ld.enable = true; + services.vscode-server = { + enable = true; + extraRuntimeDependencies = with pkgs; [ + docker + ]; + }; + system.stateVersion = "23.05"; }; -} \ No newline at end of file +} From 2670ad97e843525d73cd3df2b62de7c257ee1b55 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Mon, 27 May 2024 03:24:34 +0200 Subject: [PATCH 27/36] hosts/tablet: add special power key events handling --- hosts/tablet.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hosts/tablet.nix b/hosts/tablet.nix index 4cb94ff..32de99d 100644 --- a/hosts/tablet.nix +++ b/hosts/tablet.nix @@ -34,6 +34,16 @@ rec { from = 1714; to = from + 50; } ]; + services.logind.extraConfig = '' + HandlePowerKey=suspend + HandlePowerKeyLongPress=poweroff + HandleSuspendKey=suspend-then-hibernate + HandleSuspendKeyLongPress=hibernate + HandleLidSwitch=lock + HandleLidSwitchDocked=ignore + HandleLidSwitchExternalPower=lock + ''; + system.stateVersion = "23.11"; }; } From a91317ff35637e8ae761f312f681d5b2bf613975 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 12:06:29 +0200 Subject: [PATCH 28/36] accunt: use initialPassword field for initial password --- nix-os/account.nix | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index 2b603c6..a9ea40c 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -14,8 +14,7 @@ (if config.programs.adb.enable then "adbusers" else null) ]; linger = true; - # Initial password for the account - password = "nixos"; + initialPassword = "nixos"; packages = with pkgs; [ firefox vivaldi From af43682e8bd1c5367e539566eb210f3df2a4d79d Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 12:12:51 +0200 Subject: [PATCH 29/36] shell: always show hostname --- nix-os/shell.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-os/shell.nix b/nix-os/shell.nix index c13ffbe..cee283b 100644 --- a/nix-os/shell.nix +++ b/nix-os/shell.nix @@ -120,6 +120,9 @@ in truncation_length = 5; truncation_symbol = "…/"; }; + hostname = { + ssh_only = false; + }; username = { show_always = true; }; From a6568d4891d7323af288ba339368ac6def601b42 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 12:18:08 +0200 Subject: [PATCH 30/36] core: create git configuration --- nix-os/core.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/nix-os/core.nix b/nix-os/core.nix index d79f6e9..a5633da 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -29,6 +29,12 @@ ddrescue ]; + programs.git.config = { + init.defaultBranch = "main"; + merge.conflictstyle = "diff3"; + rerere.enabled = true; + }; + # Enable fail2ban because of the OpenSSH server services.fail2ban = { enable = true; From 5acbee323723c53b52b4674b9ee5c6ff92c81815 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 12:22:59 +0200 Subject: [PATCH 31/36] core: enable git module itself oops --- nix-os/core.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index a5633da..eaa0ea8 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -18,7 +18,6 @@ # $ nix search wget environment.systemPackages = with pkgs; [ wget - git ffmpeg yt-dlp htop @@ -29,6 +28,7 @@ ddrescue ]; + programs.git.enable = true; programs.git.config = { init.defaultBranch = "main"; merge.conflictstyle = "diff3"; From 98bba7fa6ae561e48ea06d7141d51d94acb705d3 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 21:51:35 +0200 Subject: [PATCH 32/36] core: wrap nix-build and nix-shell with default log format --- nix-os/core.nix | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index eaa0ea8..a50a316 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -4,6 +4,26 @@ { config, pkgs, lib, ... }: +let + /* + * pkgs: package - nixpkgs package + * exe: string - executable (under bin) in pkgs + * wrapperArgs: string[] - arguments to pass to the wrapper + */ + mkWrappedExecutable = {pkg, exe ? pkg.meta.mainProgram, wrapperArgs}: let inherit (pkgs) lib makeWrapper; in pkgs.stdenv.mkDerivation { + name = "${pkg.name}-wrap-${exe}"; + nativeBuildInputs = [ makeWrapper ]; + phases = ["installPhase"]; + installPhase = '' + mkdir -p $out/bin + makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} ${lib.concatStringsSep " " wrapperArgs} + ''; + }; + wrapedNixPrograms = [ + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar-with-logs"];}) + (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) + ]; +in { # kernel boot.kernelPackages = pkgs.linuxPackages_latest; @@ -26,7 +46,7 @@ ranger smartmontools ddrescue - ]; + ] ++ wrapedNixPrograms; programs.git.enable = true; programs.git.config = { From e66e4aaec073ccb5129a0ac61a4f05b9e24c0371 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 22:11:59 +0200 Subject: [PATCH 33/36] core: remove duplicate package already defined in shell.nix --- nix-os/core.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index a50a316..23dfc5f 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -43,7 +43,6 @@ in htop btop fastfetch - ranger smartmontools ddrescue ] ++ wrapedNixPrograms; From 23bfb2d2220ac0d2ec987b49e749d0bd7dbc6269 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Tue, 28 May 2024 22:55:22 +0200 Subject: [PATCH 34/36] core: make wrapped nix commands higer priority --- nix-os/core.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix-os/core.nix b/nix-os/core.nix index 23dfc5f..7f07c00 100644 --- a/nix-os/core.nix +++ b/nix-os/core.nix @@ -19,7 +19,7 @@ let makeWrapper ${pkg}/bin/${exe} $out/bin/${exe} ${lib.concatStringsSep " " wrapperArgs} ''; }; - wrapedNixPrograms = [ + wrapedNixPrograms = builtins.map lib.hiPrio [ (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-build"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar-with-logs"];}) (mkWrappedExecutable {pkg = pkgs.nix; exe = "nix-shell"; wrapperArgs = ["--add-flags" "\"--log-format\"" "--add-flags" "bar"];}) ]; From 8f15bf0e0c1bdd8d10a8046beec222052694e7eb Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Wed, 29 May 2024 04:46:18 +0200 Subject: [PATCH 35/36] dconf: create generic module and use it no more cringe function calling, yay --- nix-os/dconf-common.nix | 321 ++++++++++++++++--------------- nix-os/desktopManagers/gnome.nix | 49 +++-- nix-os/displayManagers/gdm.nix | 23 +-- nix-os/generic/dconf.nix | 46 +++++ 4 files changed, 244 insertions(+), 195 deletions(-) create mode 100644 nix-os/generic/dconf.nix diff --git a/nix-os/dconf-common.nix b/nix-os/dconf-common.nix index 1f03a56..2993f98 100644 --- a/nix-os/dconf-common.nix +++ b/nix-os/dconf-common.nix @@ -1,163 +1,166 @@ -# This file is not a NixOS system module {config, lib, pkgs, ... }: -selection: -let - settings = with lib.gvariant; { - "org/gnome/desktop/background" = { - picture-options = "zoom"; - picture-uri = "file://${../media/wallpaper.png}"; - picture-uri-dark = "file://${../media/wallpaper.png}"; +{ + imports = [ + ./generic/dconf.nix + ]; + + config = { + proot.dconf.rules = with lib.gvariant; { + "org/gnome/desktop/background" = { + picture-options = "zoom"; + picture-uri = "file://${../media/wallpaper.png}"; + picture-uri-dark = "file://${../media/wallpaper.png}"; + }; + + "org/gnome/desktop/interface" = { + clock-show-date = true; + clock-show-seconds = true; + clock-show-weekday = true; + color-scheme = "prefer-dark"; + cursor-theme = "GoogleDot-White"; + }; + + "org/gnome/desktop/media-handling" = { + automount = false; + }; + + "org/gnome/desktop/peripherals/mouse" = { + accel-profile = "flat"; + }; + + "org/gnome/desktop/sound" = { + allow-volume-above-100-percent = true; + }; + + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:close"; + resize-with-right-button = true; + }; + + "org/gnome/mutter" = { + dynamic-workspaces = true; + workspaces-only-on-primary = true; + }; + + "org/gnome/SessionManager" = { + logout-prompt = false; + }; + + "org/gnome/settings-daemon/plugins/power" = { + power-button-action = "notning"; + sleep-inactive-ac-type = "nothing"; + }; + + "org/gnome/shell" = { + enabled-extensions = [ + "drive-menu@gnome-shell-extensions.gcampax.github.com" + "pop-shell@system76.com" + "workspace-indicator@gnome-shell-extensions.gcampax.github.com" + "Vitals@CoreCoding.com" + "trayIconsReloaded@selfmade.pl" + "places-menu@gnome-shell-extensions.gcampax.github.com" + "apps-menu@gnome-shell-extensions.gcampax.github.com" + "top-bar-organizer@julian.gse.jsts.xyz" + "color-picker@tuberry" + ]; + favorite-apps = [ + (if builtins.elem pkgs.kitty config.environment.systemPackages then + "kitty.desktop" + else none) + "vivaldi-stable.desktop" + "code.desktop" + "org.gnome.Nautilus.desktop" + (if config.programs.steam.enable then + "steam.desktop" + else none) + "pavucontrol.desktop" + ]; + }; + + "org/gnome/shell/app-switcher" = { + current-workspace-only = false; + }; + + "org/gnome/shell/extensions/color-picker" = { + color-picker-shortcut = ["c"]; + enable-shortcut = true; + enable-systray = false; + menu-key = ""; + notify-style = mkUint32 1; + preview-style = mkUint32 0; + }; + + "org/gnome/shell/extensions/pop-shell" = { + active-hint = true; + active-hint-border-radius = mkUint32 1; + gap-inner = mkUint32 2; + gap-outer = mkUint32 1; + show-skip-taskbar = true; + show-title = true; + smart-gaps = false; + snap-to-grid = false; + tile-by-default = true; + }; + + "org/gnome/shell/extensions/top-bar-organizer" = { + center-box-order = ["dateMenu"]; + left-box-order = ["activities" "apps-menu" "places-menu" "vitalsMenu"]; + right-box-order = ["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"]; + }; + + "org/gnome/shell/extensions/trayIconsReloaded" = { + icon-brightness = mkInt32 0; + icon-contrast = mkInt32 0; + icon-margin-horizontal = mkInt32 0; + icon-margin-vertical = mkInt32 0; + icon-padding-horizontal = mkInt32 4; + icon-padding-vertical = mkInt32 0; + icon-saturation = mkInt32 0; + icon-size = mkInt32 16; + icons-limit = mkInt32 16; + invoke-to-workspace = true; + position-weight = mkInt32 0; + tray-margin-left = mkInt32 0; + tray-margin-right = mkInt32 0; + }; + + "org/gnome/shell/extensions/vitals" = { + hide-icons = false; + hot-sensors = ["_processor_usage_" "_memory_allocated_"]; + memory-measurement = mkInt32 1; + update-time = mkInt32 2; + use-higher-precision = true; + }; + + "org/gnome/shell/keybindings" = { + show-screenshot-ui = ["Print" "S"]; + }; + + "org/gnome/desktop/default-applications/terminal" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + exec = "kitty"; + exec-arg = ""; + } else null; + + "org/gnome/settings-daemon/plugins/media-keys" = { + custom-keybindings = [ + ( + if builtins.elem pkgs.kitty config.environment.systemPackages then + "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" + else null + ) + ]; + help = mkEmptyArray "s"; + screensaver = ["l"]; + }; + + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = + if builtins.elem pkgs.kitty config.environment.systemPackages then { + binding = "t"; + command = "kitty"; + name = "Terminal"; + } else null; }; - - "org/gnome/desktop/interface" = { - clock-show-date = true; - clock-show-seconds = true; - clock-show-weekday = true; - color-scheme = "prefer-dark"; - cursor-theme = "GoogleDot-White"; - }; - - "org/gnome/desktop/media-handling" = { - automount = false; - }; - - "org/gnome/desktop/peripherals/mouse" = { - accel-profile = "flat"; - }; - - "org/gnome/desktop/sound" = { - allow-volume-above-100-percent = true; - }; - - "org/gnome/desktop/wm/preferences" = { - button-layout = "appmenu:close"; - resize-with-right-button = true; - }; - - "org/gnome/mutter" = { - dynamic-workspaces = true; - workspaces-only-on-primary = true; - }; - - "org/gnome/SessionManager" = { - logout-prompt = false; - }; - - "org/gnome/settings-daemon/plugins/power" = { - power-button-action = "notning"; - sleep-inactive-ac-type = "nothing"; - }; - - "org/gnome/shell" = { - enabled-extensions = [ - "drive-menu@gnome-shell-extensions.gcampax.github.com" - "pop-shell@system76.com" - "workspace-indicator@gnome-shell-extensions.gcampax.github.com" - "Vitals@CoreCoding.com" - "trayIconsReloaded@selfmade.pl" - "places-menu@gnome-shell-extensions.gcampax.github.com" - "apps-menu@gnome-shell-extensions.gcampax.github.com" - "top-bar-organizer@julian.gse.jsts.xyz" - "color-picker@tuberry" - ]; - favorite-apps = [ - (if builtins.elem pkgs.kitty config.environment.systemPackages then - "kitty.desktop" - else none) - "vivaldi-stable.desktop" - "code.desktop" - "org.gnome.Nautilus.desktop" - (if config.programs.steam.enable then - "steam.desktop" - else none) - "pavucontrol.desktop" - ]; - }; - - "org/gnome/shell/app-switcher" = { - current-workspace-only = false; - }; - - "org/gnome/shell/extensions/color-picker" = { - color-picker-shortcut = ["c"]; - enable-shortcut = true; - enable-systray = false; - menu-key = ""; - notify-style = mkUint32 1; - preview-style = mkUint32 0; - }; - - "org/gnome/shell/extensions/pop-shell" = { - active-hint = true; - active-hint-border-radius = mkUint32 1; - gap-inner = mkUint32 2; - gap-outer = mkUint32 1; - show-skip-taskbar = true; - show-title = true; - smart-gaps = false; - snap-to-grid = false; - tile-by-default = true; - }; - - "org/gnome/shell/extensions/top-bar-organizer" = { - center-box-order = ["dateMenu"]; - left-box-order = ["activities" "apps-menu" "places-menu" "vitalsMenu"]; - right-box-order = ["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"]; - }; - - "org/gnome/shell/extensions/trayIconsReloaded" = { - icon-brightness = mkInt32 0; - icon-contrast = mkInt32 0; - icon-margin-horizontal = mkInt32 0; - icon-margin-vertical = mkInt32 0; - icon-padding-horizontal = mkInt32 4; - icon-padding-vertical = mkInt32 0; - icon-saturation = mkInt32 0; - icon-size = mkInt32 16; - icons-limit = mkInt32 16; - invoke-to-workspace = true; - position-weight = mkInt32 0; - tray-margin-left = mkInt32 0; - tray-margin-right = mkInt32 0; - }; - - "org/gnome/shell/extensions/vitals" = { - hide-icons = false; - hot-sensors = ["_processor_usage_" "_memory_allocated_"]; - memory-measurement = mkInt32 1; - update-time = mkInt32 2; - use-higher-precision = true; - }; - - "org/gnome/shell/keybindings" = { - show-screenshot-ui = ["Print" "S"]; - }; - - "org/gnome/desktop/default-applications/terminal" = - if builtins.elem pkgs.kitty config.environment.systemPackages then { - exec = "kitty"; - exec-arg = ""; - } else null; - - "org/gnome/settings-daemon/plugins/media-keys" = { - custom-keybindings = [ - ( - if builtins.elem pkgs.kitty config.environment.systemPackages then - "/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/" - else null - ) - ]; - help = mkEmptyArray "s"; - screensaver = ["l"]; - }; - - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" = - if builtins.elem pkgs.kitty config.environment.systemPackages then { - binding = "t"; - command = "kitty"; - name = "Terminal"; - } else null; }; -in -lib.filterAttrs (n: v: builtins.elem n selection) settings \ No newline at end of file +} diff --git a/nix-os/desktopManagers/gnome.nix b/nix-os/desktopManagers/gnome.nix index d64b100..14c19c6 100644 --- a/nix-os/desktopManagers/gnome.nix +++ b/nix-os/desktopManagers/gnome.nix @@ -1,8 +1,9 @@ -{pkgs, ... } @ moduleArgs: +{pkgs, ... }: { imports = [ ../unstable-packages.nix + ../dconf-common.nix ]; config = { services.xserver.enable = true; @@ -10,30 +11,28 @@ # environment.sessionVariables.NIXOS_OZONE_WL = "1"; - programs.dconf.profiles.user.databases = [{ - settings = import ../dconf-common.nix moduleArgs [ - "org/gnome/desktop/background" - "org/gnome/desktop/interface" - "org/gnome/desktop/media-handling" - "org/gnome/desktop/peripherals/mouse" - "org/gnome/desktop/sound" - "org/gnome/desktop/wm/preferences" - "org/gnome/mutter" - "org/gnome/SessionManager" - "org/gnome/settings-daemon/plugins/power" - "org/gnome/shell" - "org/gnome/shell/app-switcher" - "org/gnome/shell/extensions/color-picker" - "org/gnome/shell/extensions/pop-shell" - "org/gnome/shell/extensions/top-bar-organizer" - "org/gnome/shell/extensions/trayIconsReloaded" - "org/gnome/shell/extensions/vitals" - "org/gnome/shell/keybindings" - "org/gnome/desktop/default-applications/terminal" - "org/gnome/settings-daemon/plugins/media-keys" - "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" - ]; - }]; + proot.dconf.profiles.user.rulesToApply = [ + "org/gnome/desktop/background" + "org/gnome/desktop/interface" + "org/gnome/desktop/media-handling" + "org/gnome/desktop/peripherals/mouse" + "org/gnome/desktop/sound" + "org/gnome/desktop/wm/preferences" + "org/gnome/mutter" + "org/gnome/SessionManager" + "org/gnome/settings-daemon/plugins/power" + "org/gnome/shell" + "org/gnome/shell/app-switcher" + "org/gnome/shell/extensions/color-picker" + "org/gnome/shell/extensions/pop-shell" + "org/gnome/shell/extensions/top-bar-organizer" + "org/gnome/shell/extensions/trayIconsReloaded" + "org/gnome/shell/extensions/vitals" + "org/gnome/shell/keybindings" + "org/gnome/desktop/default-applications/terminal" + "org/gnome/settings-daemon/plugins/media-keys" + "org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" + ]; environment.gnome.excludePackages = with pkgs; with pkgs.gnome; [ baobab diff --git a/nix-os/displayManagers/gdm.nix b/nix-os/displayManagers/gdm.nix index f040d1c..f3e4cbc 100644 --- a/nix-os/displayManagers/gdm.nix +++ b/nix-os/displayManagers/gdm.nix @@ -1,6 +1,9 @@ -{pkgs, ... } @ moduleArgs: +{pkgs, ... }: { + imports = [ + ../dconf-common.nix + ]; config = { services.xserver.displayManager.gdm = { enable = true; @@ -8,18 +11,16 @@ autoSuspend = false; }; - programs.dconf.profiles.gdm.databases = [{ - settings = import ../dconf-common.nix moduleArgs [ - "org/gnome/desktop/interface" - "org/gnome/desktop/peripherals/mouse" - "org/gnome/desktop/sound" - "org/gnome/settings-daemon/plugins/power" - "org/gnome/shell/keybindings" - ]; - }]; + proot.dconf.profiles.gdm.rulesToApply = [ + "org/gnome/desktop/interface" + "org/gnome/desktop/peripherals/mouse" + "org/gnome/desktop/sound" + "org/gnome/settings-daemon/plugins/power" + "org/gnome/shell/keybindings" + ]; environment.systemPackages = with pkgs; [ google-cursor ]; }; -} \ No newline at end of file +} diff --git a/nix-os/generic/dconf.nix b/nix-os/generic/dconf.nix new file mode 100644 index 0000000..dfcdc04 --- /dev/null +++ b/nix-os/generic/dconf.nix @@ -0,0 +1,46 @@ +{ config, lib, pkgs, options, ... }: + +# proot.dconf.rules +# proot.dconf.profiles..rulesToApply +# proot.dconf.profiles..extraRules +let + cfg = config.proot.dconf; + profileOpts = lib.types.submodule { + options = { + rulesToApply = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = lib.attrNames cfg.rules; + description = lib.mdDoc "A list of rules keys to apply for profile"; + }; + extraRules = lib.mkOption { + type = lib.types.attrs; + default = {}; + description = lib.mdDoc "An attrset of additional dconf rules to apply ontop of selected"; + }; + }; + }; + + mapper = _: value: { + databases = lib.singleton { + settings = lib.filterAttrs (key: _: lib.elem key value.rulesToApply) cfg.rules // value.extraRules; + }; + }; +in +{ + options.proot.dconf = { + rules = lib.mkOption { + type = lib.types.attrs; + default = {}; + description = lib.mdDoc "An attrset of dconf rules to pull from"; + }; + profiles = lib.mkOption { + type = lib.types.attrsOf profileOpts; + default = {}; + description = lib.mdDoc "An attret of profiles to create, with pulled rules"; + }; + }; + + config = { + programs.dconf.profiles = lib.mapAttrs mapper cfg.profiles; + }; +} From ee64e04166bd7860941290ec086040236fdc39a7 Mon Sep 17 00:00:00 2001 From: Wroclaw Date: Fri, 31 May 2024 08:08:41 +0200 Subject: [PATCH 36/36] account: add zettlr package --- nix-os/account.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nix-os/account.nix b/nix-os/account.nix index a9ea40c..2bb15ff 100644 --- a/nix-os/account.nix +++ b/nix-os/account.nix @@ -23,6 +23,7 @@ gimp inkscape krita + unstablePkgs.zettlr ]; }; users.groups.wroclaw.gid = 1000; @@ -39,4 +40,4 @@ dataDir = "/home/wroclaw"; configDir = "/home/wroclaw/.config/syncthing"; }; -} \ No newline at end of file +}