From 41c802081a41fea0c2df97a861b67ecf8d58dc19 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 28 Feb 2024 23:17:23 +0100 Subject: [PATCH] orbi works and steam is a component now --- nixos/components/gui/default.nix | 15 ++- nixos/components/gui/steam.nix | 40 ++++++ nixos/homes/common/packages.nix | 6 + nixos/homes/common/terminal.nix | 18 ++- nixos/machines/cream/configuration.nix | 1 - nixos/machines/orbi/configuration.nix | 6 +- .../default.nix} | 10 +- .../disko-config.nix | 126 ++++++++---------- .../hardware-configuration.nix | 0 nixos/machines/sternchen/configuration.nix | 2 - nixos/machines/sterni/configuration.nix | 1 - nixos/modules/default.nix | 8 +- nixos/modules/programs/steam.nix | 1 + nixos/system/desktop/default.nix | 1 - 14 files changed, 135 insertions(+), 100 deletions(-) create mode 100644 nixos/components/gui/steam.nix rename nixos/machines/orbi/{hetzner.nix => hardware-configuration/default.nix} (97%) rename nixos/machines/orbi/{ => hardware-configuration}/disko-config.nix (54%) rename nixos/machines/orbi/{ => hardware-configuration}/hardware-configuration.nix (100%) diff --git a/nixos/components/gui/default.nix b/nixos/components/gui/default.nix index 88c0413..3b648c7 100644 --- a/nixos/components/gui/default.nix +++ b/nixos/components/gui/default.nix @@ -7,17 +7,18 @@ with lib; imports = [ # todo : structure with home-manager and such is not cool, create another structure - ./xorg - ./home-manager - ./browser.nix - ./suspend.nix - ./pass.nix ./audio.nix - ./kmonad.nix - ./taskwarrior.nix + ./browser.nix ./fonts.nix + ./home-manager + ./kmonad.nix ./noti.nix + ./pass.nix + ./steam.nix + ./suspend.nix + ./taskwarrior.nix ./vscode.nix + ./xorg ]; config = mkIf config.components.gui.enable { diff --git a/nixos/components/gui/steam.nix b/nixos/components/gui/steam.nix new file mode 100644 index 0000000..34f4925 --- /dev/null +++ b/nixos/components/gui/steam.nix @@ -0,0 +1,40 @@ +{ config, pkgs, lib, ... }: +with lib; +{ + options.components.gui.steam.enable = mkOption { + type = lib.types.bool; + default = config.components.gui.enable; + }; + + config = mkIf (config.components.gui.steam.enable) { + + environment.systemPackages = [ + (pkgs.writeShellScriptBin "steam" '' + /var/run/wrappers/bin/sudo -u steam -i ${pkgs.steam}/bin/steam $@ + '') + pkgs.xorg.xhost + # to use xbox controllers + pkgs.xboxdrv + ]; + + users.users.steam = { + isNormalUser = false; + isSystemUser = true; + home = "/home/steam"; + createHome = true; + extraGroups = [ "audio" "input" "video" "pipewire" ]; + group = "steam"; + shell = pkgs.bashInteractive; + }; + users.groups.steam = { }; + + # for steam + # --------- + hardware.opengl.driSupport = true; + hardware.opengl.driSupport32Bit = true; + + security.sudo.extraConfig = '' + ${config.users.extraUsers.mainUser.name} ALL=(steam) NOPASSWD: ALL + ''; + }; +} diff --git a/nixos/homes/common/packages.nix b/nixos/homes/common/packages.nix index f52c54a..8b1431e 100644 --- a/nixos/homes/common/packages.nix +++ b/nixos/homes/common/packages.nix @@ -20,8 +20,14 @@ with lib; # todo : configure this properly tldr + bandwhich ]; + + programs.btop.enable = true; + } + + (mkIf config.gui.enable { home.packages = [ libreoffice diff --git a/nixos/homes/common/terminal.nix b/nixos/homes/common/terminal.nix index 7cb7706..1b3330c 100644 --- a/nixos/homes/common/terminal.nix +++ b/nixos/homes/common/terminal.nix @@ -31,15 +31,6 @@ enableZshIntegration = true; }; - # provide better `Ctrl+r` command in terminal - #programs.mcfly = { - # enable = true; - # keyScheme = "vim"; - # fuzzySearchFactor = 3; - # enableZshIntegration = true; - # enableBashIntegration = true; - #}; - # provide better `Ctrl+r` command in terminal programs.atuin = { enable = true; @@ -53,7 +44,14 @@ auto_sync = true; sync_frequency = "5m"; sync_address = "http://chungus.private:8888"; - search_mode = "skim"; + search_mode = "fuzzy"; + style = "full"; + inline_height = 20; + + # With workspace filtering enabled, Atuin will filter for commands executed + # in any directory within a git repository tree. + workspaces = true; + }; }; } diff --git a/nixos/machines/cream/configuration.nix b/nixos/machines/cream/configuration.nix index a5d2409..80cb85c 100644 --- a/nixos/machines/cream/configuration.nix +++ b/nixos/machines/cream/configuration.nix @@ -115,7 +115,6 @@ }; }; - programs.custom.steam.enable = true; services.printing.enable = true; # fonts diff --git a/nixos/machines/orbi/configuration.nix b/nixos/machines/orbi/configuration.nix index dbd872a..e079fbc 100644 --- a/nixos/machines/orbi/configuration.nix +++ b/nixos/machines/orbi/configuration.nix @@ -9,8 +9,9 @@ ../../components ../../modules - ./disko-config.nix - ./hetzner.nix + #./disko-config.nix + #./hetzner.nix + ./hardware-configuration # services #./borg.nix @@ -52,6 +53,7 @@ #./cache.nix ]; + networking.hostName = "orbi"; components.terminal.enable = true; components.mainUser.enable = true; diff --git a/nixos/machines/orbi/hetzner.nix b/nixos/machines/orbi/hardware-configuration/default.nix similarity index 97% rename from nixos/machines/orbi/hetzner.nix rename to nixos/machines/orbi/hardware-configuration/default.nix index 8651de4..4612ed5 100644 --- a/nixos/machines/orbi/hetzner.nix +++ b/nixos/machines/orbi/hardware-configuration/default.nix @@ -2,7 +2,6 @@ let - hostName = "orbi"; # apt install -y lshw # lshw -C network | grep -Poh 'driver=[[:alnum:]]+' @@ -27,7 +26,13 @@ let in { - # needed lvm for raid + +imports = [ + ./disko-config.nix + ./hardware-configuration.nix +]; + + # luks unlock zeug #boot.initrd.kernelModules = [ ]; #boot.initrd.systemd.users.root.shell = "/bin/cryptsetup-askpass"; #boot.initrd.systemd.services.openssh = { @@ -46,7 +51,6 @@ in # { path = "/boot_sdb"; devices = [ "/dev/sdb" ]; } #]; - networking.hostName = hostName; # Network configuration (Hetzner uses static IP assignments, and we don't use DHCP here) #networking.useDHCP = false; diff --git a/nixos/machines/orbi/disko-config.nix b/nixos/machines/orbi/hardware-configuration/disko-config.nix similarity index 54% rename from nixos/machines/orbi/disko-config.nix rename to nixos/machines/orbi/hardware-configuration/disko-config.nix index 6aa2504..891b501 100644 --- a/nixos/machines/orbi/disko-config.nix +++ b/nixos/machines/orbi/hardware-configuration/disko-config.nix @@ -4,8 +4,7 @@ # nixos-install { config, lib, ... }: let - #disks = [ "sda" "sdb" ]; - disks = [ "sda" ]; + disks = [ "sda" "sdb" ]; in { # ZFS already has its own scheduler. Without this my(@Artturin) computer froze for a second when i nix build something. @@ -18,38 +17,28 @@ in disko.devices = { disk = lib.genAttrs disks (disk: { - #name = disk; type = "disk"; device = "/dev/${disk}"; content = { type = "gpt"; partitions = { boot = { - priority = 0; - #start = "0"; - #end = "1M"; + priority = 0; size = "1M"; type = "EF02"; # for grub MBR }; ESP = { - priority = 1; - #start = "1M"; - #end = "500M"; + priority = 1; size = "500M"; type = "EF00"; - # bootable = true; content = { type = "filesystem"; format = "vfat"; - mountpoint = "/boot"; - #mountpoint = "/boot_${disk}"; + mountpoint = if disk == "sda" then "/boot" else "/boot_${disk}"; mountOptions = [ "defaults" ]; }; }; root = { - #name = "zfs"; - #start = "500M"; - #end = "500G"; priority = 10; size = "500G"; # content = { @@ -68,26 +57,24 @@ in }; # }; }; - #media = { - # #name = "zfs"; - # #start = "500G"; - # #end = "100%"; - # size = "100%"; - # # content = { - # # type = "luks"; - # # settings = { - # # # if you want to use the key for interactive login be sure there is no trailing newline - # # # for example use `echo -n "password" > /run/secret.key` - # # keyFile = "/run/secret.key"; - # # allowDiscards = true; - # # }; - # # name = "media_${disk}"; - # content = { - # type = "zfs"; - # pool = "zmedia"; - # }; - # # }; - #}; + media = { + priority = 50; + size = "100%"; + # content = { + # type = "luks"; + # settings = { + # # if you want to use the key for interactive login be sure there is no trailing newline + # # for example use `echo -n "password" > /run/secret.key` + # keyFile = "/run/secret.key"; + # allowDiscards = true; + # }; + # name = "media_${disk}"; + content = { + type = "zfs"; + pool = "zmedia"; + }; + # }; + }; }; }; }); @@ -97,7 +84,7 @@ in zroot = { type = "zpool"; - #mode = "mirror"; + mode = "mirror"; rootFsOptions = { mountpoint = "none"; canmount = "off"; @@ -124,39 +111,40 @@ in }; # `zpool import -f zraid` once on the first boot and reboot - #zmedia = { - # type = "zpool"; - # rootFsOptions = { - # mountpoint = "none"; - # canmount = "off"; - # }; - # datasets = { - # "media" = { - # type = "zfs_fs"; - # mountpoint = "/media"; - # options = { - # mountpoint = "legacy"; - # compression = "lz4"; - # #"com.sun:auto-snapshot:daily" = false; - # #"com.sun:auto-snapshot:weekly" = false; - # #"com.sun:auto-snapshot:monthly" = false; - # }; - # }; - # # todo make sure this disk has some minimum space - # "nextcloud" = { - # type = "zfs_fs"; - # mountpoint = "/var/lib/nextcloud"; - # options = { - # mountpoint = "legacy"; - # compression = "lz4"; - # "com.sun:auto-snapshot:hourly" = toString true; - # "com.sun:auto-snapshot:daily" = toString true; - # #"com.sun:auto-snapshot:weekly" = false; - # #"com.sun:auto-snapshot:monthly" = false; - # }; - # }; - # }; - #}; + zmedia = { + type = "zpool"; + rootFsOptions = { + mountpoint = "none"; + canmount = "off"; + }; + datasets = { + "media" = { + type = "zfs_fs"; + mountpoint = "/media"; + options = { + mountpoint = "legacy"; + compression = "lz4"; + #"com.sun:auto-snapshot:daily" = false; + #"com.sun:auto-snapshot:weekly" = false; + #"com.sun:auto-snapshot:monthly" = false; + }; + }; + # todo make sure this disk has some minimum space + "nextcloud" = { + type = "zfs_fs"; + mountpoint = "/var/lib/nextcloud"; + options = { + mountpoint = "legacy"; + compression = "lz4"; + "com.sun:auto-snapshot:hourly" = toString true; + "com.sun:auto-snapshot:daily" = toString true; + #"com.sun:auto-snapshot:weekly" = false; + #"com.sun:auto-snapshot:monthly" = false; + }; + }; + }; + }; + }; }; diff --git a/nixos/machines/orbi/hardware-configuration.nix b/nixos/machines/orbi/hardware-configuration/hardware-configuration.nix similarity index 100% rename from nixos/machines/orbi/hardware-configuration.nix rename to nixos/machines/orbi/hardware-configuration/hardware-configuration.nix diff --git a/nixos/machines/sternchen/configuration.nix b/nixos/machines/sternchen/configuration.nix index 7ee9625..6b11437 100644 --- a/nixos/machines/sternchen/configuration.nix +++ b/nixos/machines/sternchen/configuration.nix @@ -46,8 +46,6 @@ }; }; - programs.custom.steam.enable = false; - # keyboard fiddling i18n.defaultLocale = "de_DE.UTF-8"; console.keyMap = "de"; diff --git a/nixos/machines/sterni/configuration.nix b/nixos/machines/sterni/configuration.nix index 823703c..f49b6d2 100644 --- a/nixos/machines/sterni/configuration.nix +++ b/nixos/machines/sterni/configuration.nix @@ -25,7 +25,6 @@ components.mainUser.enable = true; users.users.mainUser.extraGroups = [ "adbusers" "video" ]; - programs.custom.steam.enable = false; services.printing.enable = false; services.nginx.enable = true; diff --git a/nixos/modules/default.nix b/nixos/modules/default.nix index ffff35b..2a2506e 100644 --- a/nixos/modules/default.nix +++ b/nixos/modules/default.nix @@ -6,15 +6,15 @@ ./services/castget.nix ./services/rbackup.nix - ./services/home-assistant.nix - ./services/lektor.nix + #./services/home-assistant.nix + #./services/lektor.nix ./services/samba-share.nix - ./services/videoencoder.nix + #./services/videoencoder.nix ./services/taskwarrior-pushover.nix ./services/taskwarrior-autotag.nix ./programs/browser.nix - ./programs/citate.nix + #./programs/citate.nix ./programs/curl-scripts.nix #./programs/easytag.nix #./programs/elm.nix diff --git a/nixos/modules/programs/steam.nix b/nixos/modules/programs/steam.nix index 6da51b1..d5cc9ad 100644 --- a/nixos/modules/programs/steam.nix +++ b/nixos/modules/programs/steam.nix @@ -47,6 +47,7 @@ in security.sudo.extraConfig = '' ${config.users.extraUsers.mainUser.name} ALL=(steam) NOPASSWD: ALL ''; + }; } diff --git a/nixos/system/desktop/default.nix b/nixos/system/desktop/default.nix index 35437e5..c275012 100644 --- a/nixos/system/desktop/default.nix +++ b/nixos/system/desktop/default.nix @@ -23,7 +23,6 @@ }; curlScripts.enable = true; - citate.enable = true; };