From c0ff136282bff591e3adba8a7f401ba795f3a0ff Mon Sep 17 00:00:00 2001 From: wayne <...> Date: Mon, 14 Oct 2024 15:35:04 -0700 Subject: [PATCH] First build --- README | 3 + configuration.nix | 345 +------------------------ environment.nix | 23 ++ flake.lock | 288 +++++++++++++++++++++ flake.nix | 4 +- hardware-configuration.nix | 7 + hm/home.nix | 240 ++--------------- hm/hypr.nix | 92 +++++++ hm/wayland.nix | 17 ++ hm/xdg.nix | 35 +++ modules/display.nix | 44 +++- modules/files.nix | 12 +- modules/fonts.nix | 12 +- modules/network.nix | 36 ++- modules/nix.nix | 19 ++ modules/security.nix | 80 +++++- modules/users.nix | 25 ++ modules/wm.nix | 34 +++ pkgs/derivations/GnuCobal/_default.nix | 82 ++++++ pkgs/derivations/GnuCobal/flake.nix | 37 +++ pkgs/derivations/GnuCobal/snake.cob | 55 ++++ pkgs/derivations/polycat/default.nix | 88 +++++++ pkgs/derivations/xpen/_default.nix | 79 ++++++ pkgs/derivations/xpen/_flake.nix | 79 ++++++ pkgs/derivations/xpen/_flake.nix_ | 121 +++++++++ pkgs/derivations/xpen/flake.nix | 117 +++++++++ 26 files changed, 1416 insertions(+), 558 deletions(-) create mode 100644 README create mode 100644 environment.nix create mode 100644 flake.lock create mode 100644 hm/hypr.nix create mode 100644 hm/wayland.nix create mode 100644 hm/xdg.nix create mode 100644 modules/nix.nix create mode 100644 modules/users.nix create mode 100644 modules/wm.nix create mode 100644 pkgs/derivations/GnuCobal/_default.nix create mode 100644 pkgs/derivations/GnuCobal/flake.nix create mode 100644 pkgs/derivations/GnuCobal/snake.cob create mode 100644 pkgs/derivations/polycat/default.nix create mode 100644 pkgs/derivations/xpen/_default.nix create mode 100644 pkgs/derivations/xpen/_flake.nix create mode 100644 pkgs/derivations/xpen/_flake.nix_ create mode 100644 pkgs/derivations/xpen/flake.nix diff --git a/README b/README new file mode 100644 index 0000000..a9b6251 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +sudo nixos-rebuild switch --flake '.#' +home-manager switch --flake . +ls -la ~/.nix-profile/bin/ diff --git a/configuration.nix b/configuration.nix index 3d7e90d..7da815c 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,190 +1,25 @@ -# Edit this configuration file to define what should be installed on -# your system. Help is available in the configuration.nix(5) man page -# and in the NixOS manual (accessible by running ‘nixos-help’). - { lib, config, pkgs, zen-browser, hyprland, inputs, ... }: let unstable = import { overlays = pkgs.overlays; }; - - # flake-compat = builtins.fetchTarball "https://github.com/edolstra/flake-compat/archive/master.tar.gz"; - - # hyprland = (import flake-compat { - # src = builtins.fetchTarball "https://github.com/hyprwm/Hyprland/archive/main.tar.gz"; - # sha256 = "qY6zh8gdgioEgCDOgT+SnK9QZ3OtGi+eXqqzcsYWKe8="; - # }).defaultNix; - in +in { imports = - [ # Include the results of the hardware scan. + [ + ./environment.nix ./hardware-configuration.nix + + ./modules/display.nix + ./modules/files.nix + ./modules/fonts.nix + ./modules/network.nix + ./modules/nix.nix + ./modules/security.nix + ./modules/users.nix + ./modules/wm.nix ]; - # Bootloader. - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - networking.hostName = "launchpad"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - networking.extraHosts = '' - 192.168.12.20 router.local - 192.168.12.21 switch.local - 192.168.12.25 dhcpd.local - 192.168.12.40 launchpad.local - 192.168.12.41 xeon.local - 192.168.12.80 robo.local - 192.168.12.81 nas.local - 192.168.12.83 homeassistant.local - 192.168.12.60 toons.local - - 45.58.52.52 www - 172.245.111.249 est - 216.189.156.74 mail - ''; - - networking.interfaces.enp4s0.ipv4.addresses = [ { - address = "192.168.12.40"; - prefixLength = 24; - } ]; - networking.defaultGateway = "192.168.12.20"; - networking.nameservers = [ "192.168.12.25" ]; - networking.firewall = { - allowedTCPPortRanges = [ { from = 35000; to = 36000; } { from = 5000; to = 6000; } { from = 8000; to = 9000; } ]; - extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; - }; - - # Enable networking - networking.networkmanager.enable = true; - - fileSystems."/mnt/share/Music" = { - device = "//nas.local/Music"; - fsType = "cifs"; - options = let - automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; - - in ["${automount_opts},credentials=/etc/nixos/smb-secrets,uid=1000,gid=100"]; - }; - - # Set your time zone. - time.timeZone = "America/Los_Angeles"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "en_US.UTF-8"; - LC_IDENTIFICATION = "en_US.UTF-8"; - LC_MEASUREMENT = "en_US.UTF-8"; - LC_MONETARY = "en_US.UTF-8"; - LC_NAME = "en_US.UTF-8"; - LC_NUMERIC = "en_US.UTF-8"; - LC_PAPER = "en_US.UTF-8"; - LC_TELEPHONE = "en_US.UTF-8"; - LC_TIME = "en_US.UTF-8"; - }; - - # Enable the X11 windowing system. - # You can disable this if you're only using the Wayland session. - services.xserver = { - enable = false; - xkb = { - layout = "us"; - variant = ""; - }; - videoDrivers = [ "nvidia" ]; - }; - - hardware.opengl = { # Renamed hardware.graphics - enable = true; # Renamed - package = pkgs.mesa.drivers; # Renamed - # 32bit Support - driSupport32Bit = true; # Renamed - # package32 = pkgsi686Linux.mesa.drivers; - }; - # hardware.graphics = { # Only in unstable - # enable = true; - # package = pkgs.mesa.drivers; - # enable32Bit = true; - # }; - - hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = true; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - # Currently alpha-quality/buggy, so false is currently the recommended setting. - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # xdg.portal = { - # enable = false; - # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; - # extraPortals = [ inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland pkgs.kdePackages.xdg-desktop-portal-kde ]; - # }; - - # Enable the KDE Plasma Desktop Environment. - services.displayManager.sddm = { - enable = true; - autoNumlock = true; - enableHidpi = true; - settings = { - X11 = { - MinimumVT = 7; - DisplayCommand="/etc/sddm/Xsetup"; - }; - }; - wayland = { - enable = true; - }; - }; - # services.pentablet.enable = true; - - # environment.etc."ssdm.conf.d/10-wayland.conf".text = '' - # [General] - # DisplayServer=wayland - # GreeterEnvironment=QT_WAYLAND_SHELL_INTEGRATION=layer-shell - - # [Wayland] - # CompositorCommand=kwin_wayland --drm --no-lockscreen --no-global-shortcuts --locale1 - # ''; - - # environment.etc."sddm/Xsetup".text = '' - # #!/usr/bin/env bash - # xrandr --output DP-5 --auto --primary - # xrandr --output DP-4 --left-of DP-5 --noprimary - # xrandr --output DP-2 --right-of DP-5 --rotate left --noprimary - # ''; - environment.sessionVariables.NIXOS_OZONE_WL = "1"; - environment.sessionVariables.SDDM_INITIAL_VT = "VT 7"; - services.desktopManager.plasma6.enable = true; - programs.hyprland = { enable = true; xwayland.enable = true; @@ -194,81 +29,6 @@ let # portalPackage = inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland; }; - # programs.uwsm = { - # enable = true; # You must configure waylandCompositors suboptions - # waylandCompositors = { - # hyprland = { - # prettyName = "Hyprland"; - # comment = "Hyprland compositor managed by UWSM"; - # binPath = "/run/current-system/sw/bin/Hyprland"; - # }; - # }; - # }; - hardware.bluetooth.enable = true; # enables support for Bluetooth - hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot - - security.polkit = { - enable = true; - extraConfig = '' - polkit.addRule(function (action, subject) { - if ( - subject.isInGroup("users") && - [ - "org.freedesktop.login1.reboot", - "org.freedesktop.login1.reboot-multiple-sessions", - "org.freedesktop.login1.power-off", - "org.freedesktop.login1.power-off-multiple-sessions", - ].indexOf(action.id) !== -1 - ) { - return polkit.Result.YES; - } - }); - polkit.addRule(function(action, subject) { - var YES = polkit.Result.YES; - var permission = { - // required for udisks1: - "org.freedesktop.udisks.filesystem-mount": YES, - "org.freedesktop.udisks.luks-unlock": YES, - "org.freedesktop.udisks.drive-eject": YES, - "org.freedesktop.udisks.drive-detach": YES, - // required for udisks2: - "org.freedesktop.udisks2.filesystem-mount": YES, - "org.freedesktop.udisks2.encrypted-unlock": YES, - "org.freedesktop.udisks2.eject-media": YES, - "org.freedesktop.udisks2.power-off-drive": YES, - // required for udisks2 if using udiskie from another seat (e.g. systemd): - "org.freedesktop.udisks2.filesystem-mount-other-seat": YES, - "org.freedesktop.udisks2.filesystem-unmount-others": YES, - "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES, - "org.freedesktop.udisks2.encrypted-unlock-system": YES, - "org.freedesktop.udisks2.eject-media-other-seat": YES, - "org.freedesktop.udisks2.power-off-drive-other-seat": YES - }; - if (subject.isInGroup("storage")) { - return permission[action.id]; - } - }); - ''; - }; - - # security.pam.services = { -# login.enableKwallet = false; -# login.kwallet = { -# enable = true; -# package = pkgs.plasma5Packages.kwallet-pam; -# }; - # sddm = { - # enableKwallet = true; - # text = '' - # # Enable pam_kwallet5 for sddm - # auth optional pam_kwallet5.so - # session optional pam_kwallet5.so auto_start - # ''; - # }; - # }; -# security.pam.services.wayne.kwallet.enable = true; -# security.pam.services.wayne.kwallet.package = pkgs.plasma5Packages.kwallet-pam; - # Redirect syslog to TTY12 systemd.services."systemd-journald-tty12" = { description = "Forward syslog to TTY12"; @@ -278,50 +38,9 @@ let wantedBy = [ "multi-user.target" ]; }; - # Enable sound with pipewire. - hardware.pulseaudio.enable = false; - security.rtkit.enable = true; # Enable touchpad support (enabled default in most desktopManager). # services.xserver.libinput.enable = true; - # Enable Flakes - nix.settings = { - experimental-features = [ "nix-command" "flakes" ]; - substituters = ["https://hyprland.cachix.org"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; - max-jobs = 12; # Adjust this to your CPU core count or slightly below - }; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users = { - groups = { - wayne.gid = 1000; - vmail.gid = 2000; - storage.gid = 2010; - dialout = {}; - plugdev = {}; - uinput = {}; - }; - users = { - wayne = { - isNormalUser = true; - description = "Wayne Hayes"; - extraGroups = [ "networkmanager" "wheel" "docker" "wayne" "vmail" "uinput" "storage" ]; - openssh.authorizedKeys.keys = []; - packages = with pkgs; [ - kdePackages.kate - ]; - shell = pkgs.zsh; - }; - }; - }; - security.sudo = { - enable = true; - extraConfig = '' - %wheel ALL=(ALL) NOPASSWD: ${pkgs.input-remapper}/bin/input-remapper-service - %wheel ALL=(ALL) NOPASSWD: ${pkgs.input-remapper}/bin/input-remapper-control - ''; - }; systemd.services.StartInputRemapperDaemonAtLogin = { enable = false; description = "Start input-remapper daemon after login"; @@ -376,14 +95,6 @@ let # Install firefox. programs.firefox.enable = true; programs.zsh.enable = true; - - # Allow unfree packages - nixpkgs.config = { - allowUnfree = true; - cudaSupport = true; - acceptedLicenses = [ "unfree" "unfreeRedistributable" ]; - }; - programs.nix-ld.enable = true; # programs.nix-ld.libraries = with pkgs; [ @@ -393,9 +104,6 @@ let # libGL # gcc glib xorg.libXext # ]; - nixpkgs.config.permittedInsecurePackages = [ - "freeimage-unstable-2021-11-01" - ]; virtualisation.docker = { enable = true; @@ -491,34 +199,5 @@ let # steam-run ]; - - fonts.packages = with pkgs; [ - nerdfonts - garamond-libre - liberation_ttf - ubuntu_font_family - libre-baskerville - libre-bodoni - ]; - fonts.fontDir.enable = true; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - nix.settings.auto-optimise-store = true; - nix.settings.access-tokens = "nas.local/git=PAT:glpat-bfbAJxv_4tmgySBZcPSZ"; - - # 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 = "24.05"; # Did you read the comment? } diff --git a/environment.nix b/environment.nix new file mode 100644 index 0000000..3db3798 --- /dev/null +++ b/environment.nix @@ -0,0 +1,23 @@ +{ ... }: +{ + # Set your time zone. + time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + environment.sessionVariables.NIXOS_OZONE_WL = "1"; + environment.sessionVariables.SDDM_INITIAL_VT = "VT 7"; +} \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0a98cbb --- /dev/null +++ b/flake.lock @@ -0,0 +1,288 @@ +{ + "nodes": { + "base16": { + "inputs": { + "fromYaml": "fromYaml" + }, + "locked": { + "lastModified": 1721224776, + "narHash": "sha256-iakVQHg2DSmdOc5dNBwrDt9JLRxX5MT+IIbxfZEpGdo=", + "owner": "SenchoPens", + "repo": "base16.nix", + "rev": "c89c8123310257f3ddc04cc59aa4b5573c6d515f", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "base16.nix", + "type": "github" + } + }, + "base16-schemes": { + "flake": false, + "locked": { + "lastModified": 1696158499, + "narHash": "sha256-5yIHgDTPjoX/3oDEfLSQ0eJZdFL1SaCfb9d6M0RmOTM=", + "owner": "tinted-theming", + "repo": "base16-schemes", + "rev": "a9112eaae86d9dd8ee6bb9445b664fba2f94037a", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-schemes", + "type": "github" + } + }, + "base16-vim": { + "flake": false, + "locked": { + "lastModified": 1728589662, + "narHash": "sha256-rujJnzPRpeQWd0bP4pOa7cG5GswX4uwLBQzuhDFrdRs=", + "owner": "tinted-theming", + "repo": "base16-vim", + "rev": "24d384a064d09a20eca7e78a0bfe1fb302c0eb99", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "base16-vim", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "fromYaml": { + "flake": false, + "locked": { + "lastModified": 1721222302, + "narHash": "sha256-5vL4w9+tS9yd8WpIiDUtxN1IuxCVK2nebZMs/hCXXis=", + "owner": "SenchoPens", + "repo": "fromYaml", + "rev": "93bad85d1633b8b27287b438c0bd394094c24d06", + "type": "github" + }, + "original": { + "owner": "SenchoPens", + "repo": "fromYaml", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1726989464, + "narHash": "sha256-Vl+WVTJwutXkimwGprnEtXc/s/s8sMuXzqXaspIGlwM=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "2f23fa308a7c067e52dfcc30a0758f47043ec176", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-24.05", + "repo": "home-manager", + "type": "github" + } + }, + "legacy": { + "locked": { + "lastModified": 1611574965, + "narHash": "sha256-IYtGS077nJFIqSq6Cb8WEJwbqqd4K7S4vUuwPZKfLeo=", + "owner": "NixOS", + "repo": "nixpkgs-channels", + "rev": "4762fba469e2baa82f983b262e2c06ac2fdaae67", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs-channels", + "type": "github" + } + }, + "nix-colors": { + "inputs": { + "base16-schemes": "base16-schemes", + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1707825078, + "narHash": "sha256-hTfge2J2W+42SZ7VHXkf4kjU+qzFqPeC9k66jAUBMHk=", + "owner": "misterio77", + "repo": "nix-colors", + "rev": "b01f024090d2c4fc3152cd0cf12027a7b8453ba1", + "type": "github" + }, + "original": { + "owner": "misterio77", + "repo": "nix-colors", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1728740863, + "narHash": "sha256-u+rxA79a0lyhG+u+oPBRtTDtzz8kvkc9a6SWSt9ekVc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a3f9ad65a0bf298ed5847629a57808b97e6e8077", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1697935651, + "narHash": "sha256-qOfWjQ2JQSQL15KLh6D7xQhx0qgZlYZTYlcEiRuAMMw=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "e1e11fdbb01113d85c7f41cada9d2847660e3902", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1727348695, + "narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "base16": "base16", + "base16-vim": "base16-vim", + "flake-compat": "flake-compat", + "flake-utils": "flake-utils", + "home-manager": "home-manager", + "legacy": "legacy", + "nix-colors": "nix-colors", + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable", + "tt-schemes": "tt-schemes", + "zen-browser": "zen-browser" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "tt-schemes": { + "flake": false, + "locked": { + "lastModified": 1727294262, + "narHash": "sha256-UCRGabAyj8+RFkKdSZBR8BPE6yLM3rPpdxXHmwd9rZ0=", + "owner": "tinted-theming", + "repo": "schemes", + "rev": "b3273211d5d1510aee669083fc5a1e0e4b5e310c", + "type": "github" + }, + "original": { + "owner": "tinted-theming", + "repo": "schemes", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1728598925, + "narHash": "sha256-WW8VBIsNd4ABwe0sOWAfEttFm9j4Bzq/Eu+CsYT5pKU=", + "owner": "mastermines1", + "repo": "zen-browser-flake", + "rev": "b4290ee06022931de610817c13f324b82b9f2afc", + "type": "github" + }, + "original": { + "owner": "mastermines1", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix index d128aa0..5352dfe 100644 --- a/flake.nix +++ b/flake.nix @@ -88,7 +88,7 @@ specialArgs = {inherit inputs outputs systemSettings userSettings lib ;}; modules = [ # kmonad.nixosModules.default - ./nixos/configuration.nix + ./configuration.nix # pentablet-flake.nixosModules.pentablet ]; }; @@ -105,7 +105,7 @@ { scheme = "${inputs.tt-schemes}/base16/nord.yaml"; } # import `theming.nix`, we will write it in the next, final, step # ./theming.nix - ./home-manager/home.nix + ./hm/home.nix ]; }; }; diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 12943d7..f17a869 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -8,6 +8,10 @@ [ (modulesPath + "/installer/scan/not-detected.nix") ]; + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; @@ -38,4 +42,7 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.bluetooth.enable = true; # enables support for Bluetooth + hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot + hardware.pulseaudio.enable = false; } diff --git a/hm/home.nix b/hm/home.nix index 0853bc2..2ab4b88 100644 --- a/hm/home.nix +++ b/hm/home.nix @@ -74,21 +74,39 @@ let # propogateBuildInputs = with pkgs.python311Packages; []; # }; - polycat = pkgs.callPackage ../derivations/polycat {}; + polycat = pkgs.callPackage ../pkgs/derivations/polycat {}; in { + imports = [ + ./hypr.nix + ./xdg.nix + ./wayland.nix + + (import ../pkgs/shell/stow.nix { pkgs = pkgs; lib = lib; config = config; }) + (import ../pkgs/shell/cli-collection.nix { pkgs = pkgs; }) + (import ../pkgs/shell/sh.nix { inherit myAliases; pkgs = pkgs;}) + (import ../pkgs/shell/zsh.nix { inherit myAliases; pkgs = pkgs;}) + (import ../pkgs/git/git.nix { inherit userSettings; pkgs = pkgs; }) + (import ../pkgs/app/terminal/tmux.nix { pkgs = pkgs; lib = lib; config = config; }) + (import ../pkgs/app/terminal/kitty.nix { pkgs = pkgs; lib = lib; nix-colors = nix-colors; config = config; }) + # (import ../pkgs/app/terminal/starship.nix { pkgs = pkgs; }) + (import ../pkgs/app/terminal/parrot-starship.nix { pkgs = pkgs; }) + (import ../pkgs/app/terminal/yazi.nix { pkgs = pkgs; }) + (import ../pkgs/lang/cc/cc.nix { pkgs = pkgs; }) + # (import ../pkgs/lang/python/python.nix { pkgs = pkgs; }) + # (import ../pkgs/lang/python/python-packages.nix { pkgs = pkgs; }) + # (import ../pkgs/app/editor/nvim.nix { pkgs = pkgs; }) + # (import ../pkgs/app/terminal/alacritty.nix { pkgs = pkgs; }) + (import ../pkgs/app/audio/mopidy.nix { pkgs = pkgs; }) + ]; nixpkgs = { - # You can add overlays here - # overlays = [ ]; - # Configure your nixpkgs instance config = { - # allowUnfree = true; + allowUnfree = true; }; }; - # fix for some display managers not using ~/.profile systemd.user.sessionVariables = config.home.sessionVariables; home = { @@ -98,90 +116,9 @@ in PYTHONPATH = "${pkgs.mopidy}/lib/python3.11/site-packages:${pkgs.mopidy-tidal}/lib/python3.11/site-packages:${pkgs.mopidy-musicbox-webclient}/lib/python3.11/site-packages"; }; }; - nixpkgs.config.allowUnfree = true; - - fonts.fontconfig.enable = true; # colorScheme = nix-colors.colorSchemes.nord; - # wayland.windowManager.hyprland.enable = true; - - # xdg = { - # enable = true; - # userDirs = { - # enable = true; -# createDirectories = true; -# documents = "${config.home.homeDirectory}/Documents"; -# music = "${config.home.homeDirectory}/Music"; -# videos = "${config.home.homeDirectory}/Videos"; -# desktop = "${config.home.homeDirectory}/Desktop"; -# download = "${config.home.homeDirectory}/Downloads"; -# pictures = "${config.home.homeDirectory}/Pictures"; -# templates = "${config.home.homeDirectory}/Templates"; -# publicShare = "${config.home.homeDirectory}/Public"; - # }; -# mimeApps.enable = true; -# portal = { -# enable = true; -# configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; -# extraPortals = [ pkgs.xdg-desktop-portal-hyprland pkgs.kdePackages.xdg-desktop-portal-kde ]; -# xdgOpenUsePortal = true; -# # wlr.enable = true; -# }; -# configHome = "~/.config"; -# dataHome = "~/.local/share"; -# stateHome = "~/.local/state"; -# cacheHome = "~/.cache"; - -# systemDirs = { -# config = [ "/etc/xdg" ]; -# data = [ "/usr/share" "/usr/local/share" ]; -# }; - # }; - wayland.windowManager = { - hyprland = { - enable = true; -# # systemd ={ -# # enable = true; -# # enableXdgAutostart = true; -# # variables = [ "--all" ]; -# # }; -# package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; - xwayland.enable = true; - }; - }; - programs.hyprlock.enable = true; - services.hypridle = { - enable = true; - settings = { - # $lock_cmd = pidof hyprlock || hyprlock - # $suspend_cmd = pidof steam || systemctl suspend || loginctl suspend # fuck nvidia - - general = { - lock_cmd = "pidof hyprlock || hyprlock"; - before_sleep_cmd = "loginctl lock-session"; - }; - - listener = [ - { - timeout = 5400; - on-timeout = "loginctl lock-session"; - } - - { - timeout = 7200; - on-timeout = "hyprctl dispatch dpms off"; - on-resume = "hyprctl dispatch dpms on"; - } - - { - timeout = 10800; - on-timeout = "pidof steam || systemctl suspend || loginctl suspend"; - } - ]; - }; -}; - home.packages = with pkgs; [ (python3.withPackages (ps: with ps; [ pip pynvim # mopidy-tidal # Mopidy-WebSettings @@ -244,58 +181,9 @@ in home-manager.enable = true; vscode.enable = true; ripgrep.enable = true; - wlogout = { - enable = true; - layout = [ - { - label = "lock"; - action = "loginctl lock-session"; - text = "Lock"; - keybind = "l"; - circular = false; - } - { - label = "hibernate"; - action = "systemctl hibernate"; - text = "Hibernate"; - keybind = "h"; - circular = false; - } - { - label = "logout"; - action = "hyprctl dispatch exit"; - text = "Logout"; - keybind = "e"; - circular = false; - } - { - label = "shutdown"; - action = "systemctl poweroff"; - text = "Shutdown"; - keybind = "s"; - circular = false; - } - { - label = "suspend"; - action = "systemctl suspend"; - text = "Suspend"; - keybind = "u"; - circular = false; - } - { - label = "reboot"; - action = "systemctl reboot"; - text = "Reboot"; - keybind = "r"; - circular = false; - } - ]; - }; }; services = { - # dunst.enable = false; - mako.enable = true; blueman-applet.enable = true; keybase.enable = true; kbfs = { @@ -320,97 +208,17 @@ in icon_names.media = [ "media-optical" ]; }; }; - swayosd = { - enable = true; - display = "DP-4"; - }; }; home.sessionVariables = { EDITOR = userSettings.editor; SPAWNEDITOR = userSettings.spawnEditor; TERM = userSettings.term; - # BROWSER = userSettings.browser; }; - - imports = [ - (import ../user/shell/stow.nix { pkgs = pkgs; lib = lib; config = config; }) - (import ../user/shell/cli-collection.nix { pkgs = pkgs; }) - (import ../user/shell/sh.nix { inherit myAliases; pkgs = pkgs;}) - (import ../user/shell/zsh.nix { inherit myAliases; pkgs = pkgs;}) - (import ../user/git/git.nix { inherit userSettings; pkgs = pkgs; }) - (import ../user/app/terminal/tmux.nix { pkgs = pkgs; lib = lib; config = config; }) - (import ../user/app/terminal/kitty.nix { pkgs = pkgs; lib = lib; nix-colors = nix-colors; config = config; }) - # (import ../user/app/terminal/starship.nix { pkgs = pkgs; }) - (import ../user/app/terminal/parrot-starship.nix { pkgs = pkgs; }) - (import ../user/app/terminal/yazi.nix { pkgs = pkgs; }) - (import ../user/lang/cc/cc.nix { pkgs = pkgs; }) - # (import ../user/lang/python/python.nix { pkgs = pkgs; }) - # (import ../user/lang/python/python-packages.nix { pkgs = pkgs; }) - # (import ../user/app/editor/nvim.nix { pkgs = pkgs; }) - # (import ../user/app/terminal/alacritty.nix { pkgs = pkgs; }) - (import ../user/wm/hyprland/hyprland.nix { pkgs = pkgs; hyprland = hyprland; }) - (import ../user/wm/waybar/waybar.nix { inherit config; pkgs = pkgs; }) - # (import ../user/wm/dunst/dunst.nix { inherit config; pkgs = pkgs; lib=lib; }) - (import ../user/wm/mako/mako.nix { config = config; pkgs = pkgs; lib=lib; }) - # (import ../user/wm/decor/stylix.nix { pkgs = pkgs; }) - (import ../user/app/audio/mopidy.nix { pkgs = pkgs; }) -# nix-colors.homeManagerModules.default - ]; - news.display = "silent"; systemd.user.startServices = "sd-switch"; - # systemd.user.services.keybase-kwallet = { - # # Move the description inside `Unit` to make it more explicit - # Unit = { - # Description = "Keybase startup after kwallet is open"; - # After = [ "graphical-session.target" ]; - # }; - # # Define how the service should behave - # Service = { - # ExecStart = '' - # while ! dbus-send --session --type=method_call --dest=org.kde.KWallet /KWallet org.kde.KWallet.isOpen; do - # sleep 2 - # done - # # Run Keybase and other related services - # keybase unlock --no-prompt || keybase login - # kbfsfuse & - # keybase-gui & - # ''; - # Restart = "on-failure"; - # }; - - # # Make the service start on login - # Install = { - # WantedBy = [ "default.target" ]; - # }; - # }; - # systemd.user.services.input-remapper = { - # Unit = { - # description = "Custom Input Remapper Service"; - # }; - - # serviceConfig = { - # ExecStart = "${pkgs.input-remapper}/bin/input-remapper-control --config-dir /home/wayne/.config/input-remapper-2/ --device 'Hanvon Ugee Shortcut Remote' --preset 'Browsers' && ${pkgs.input-remapper}/bin/input-remapper-control --config-dir /home/wayne/.config/input-remapper-2/ --device 'MX MCHNCL Keyboard' --preset 'Layer_1' && ${pkgs.input-remapper}/bin/input-remapper-control --config-dir /home/wayne/.config/input-remapper-2/ --device 'SINO WEALTH Bluetooth Keyboard' --preset 'Layer_1'"; - # Restart = "on-failure"; - # }; - - # Install = { - # wantedBy = [ "graphical.target" ]; - # }; - # }; - - # home.file.".config/hypr/autostart-input-remapper.sh" = { - # text = '' - # #!/bin/sh - # sudo ${pkgs.input-remapper}/bin/input-remapper-service -d - # ''; - # executable = true; - # }; - - # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion home.stateVersion = "24.05"; } diff --git a/hm/hypr.nix b/hm/hypr.nix new file mode 100644 index 0000000..635867a --- /dev/null +++ b/hm/hypr.nix @@ -0,0 +1,92 @@ +{ pkgs, config, lib, ... }: +{ + programs.hyprlock.enable = true; + services.hypridle = { + enable = true; + settings = { + # $lock_cmd = pidof hyprlock || hyprlock + # $suspend_cmd = pidof steam || systemctl suspend || loginctl suspend # fuck nvidia + + general = { + lock_cmd = "pidof hyprlock || hyprlock"; + before_sleep_cmd = "loginctl lock-session"; + }; + + listener = [ + { + timeout = 5400; + on-timeout = "loginctl lock-session"; + } + + { + timeout = 7200; + on-timeout = "hyprctl dispatch dpms off"; + on-resume = "hyprctl dispatch dpms on"; + } + + { + timeout = 10800; + on-timeout = "pidof steam || systemctl suspend || loginctl suspend"; + } + ]; + }; + }; + programs.wlogout = { + enable = true; + layout = [ + { + label = "lock"; + action = "loginctl lock-session"; + text = "Lock"; + keybind = "l"; + circular = false; + } + { + label = "hibernate"; + action = "systemctl hibernate"; + text = "Hibernate"; + keybind = "h"; + circular = false; + } + { + label = "logout"; + action = "hyprctl dispatch exit"; + text = "Logout"; + keybind = "e"; + circular = false; + } + { + label = "shutdown"; + action = "systemctl poweroff"; + text = "Shutdown"; + keybind = "s"; + circular = false; + } + { + label = "suspend"; + action = "systemctl suspend"; + text = "Suspend"; + keybind = "u"; + circular = false; + } + { + label = "reboot"; + action = "systemctl reboot"; + text = "Reboot"; + keybind = "r"; + circular = false; + } + ]; + }; + services.swayosd = { + enable = true; + display = "DP-4"; + }; + services.mako.enable = true; + + imports = [ + (import ../pkgs/wm/hyprland/hyprland.nix { pkgs = pkgs; }) + (import ../pkgs/wm/waybar/waybar.nix { inherit config; pkgs = pkgs; }) + (import ../pkgs/wm/mako/mako.nix { config = config; pkgs = pkgs; lib=lib; }) + ]; +} \ No newline at end of file diff --git a/hm/wayland.nix b/hm/wayland.nix new file mode 100644 index 0000000..bb93178 --- /dev/null +++ b/hm/wayland.nix @@ -0,0 +1,17 @@ +{ ... }: +{ + # wayland.windowManager.hyprland.enable = true; + + wayland.windowManager = { + hyprland = { + enable = true; +# # systemd ={ +# # enable = true; +# # enableXdgAutostart = true; +# # variables = [ "--all" ]; +# # }; +# package = hyprland.packages.${pkgs.stdenv.hostPlatform.system}.hyprland; + xwayland.enable = true; + }; + }; +} \ No newline at end of file diff --git a/hm/xdg.nix b/hm/xdg.nix new file mode 100644 index 0000000..a105c04 --- /dev/null +++ b/hm/xdg.nix @@ -0,0 +1,35 @@ +{ config, pkgs, ... }: +{ + # xdg = { + # enable = true; + # userDirs = { + # enable = true; +# createDirectories = true; +# documents = "${config.home.homeDirectory}/Documents"; +# music = "${config.home.homeDirectory}/Music"; +# videos = "${config.home.homeDirectory}/Videos"; +# desktop = "${config.home.homeDirectory}/Desktop"; +# download = "${config.home.homeDirectory}/Downloads"; +# pictures = "${config.home.homeDirectory}/Pictures"; +# templates = "${config.home.homeDirectory}/Templates"; +# publicShare = "${config.home.homeDirectory}/Public"; + # }; +# mimeApps.enable = true; +# portal = { +# enable = true; +# configPackages = [ pkgs.xdg-desktop-portal-hyprland ]; +# extraPortals = [ pkgs.xdg-desktop-portal-hyprland pkgs.kdePackages.xdg-desktop-portal-kde ]; +# xdgOpenUsePortal = true; +# # wlr.enable = true; +# }; +# configHome = "~/.config"; +# dataHome = "~/.local/share"; +# stateHome = "~/.local/state"; +# cacheHome = "~/.cache"; + +# systemDirs = { +# config = [ "/etc/xdg" ]; +# data = [ "/usr/share" "/usr/local/share" ]; +# }; + # }; +} \ No newline at end of file diff --git a/modules/display.nix b/modules/display.nix index 3defac5..2ea6055 100644 --- a/modules/display.nix +++ b/modules/display.nix @@ -1,4 +1,46 @@ -{ pkgs, ... } +{ pkgs, config, ... }: { + hardware.opengl = { # Renamed hardware.graphics + enable = true; # Renamed + package = pkgs.mesa.drivers; # Renamed + # 32bit Support + driSupport32Bit = true; # Renamed + # package32 = pkgsi686Linux.mesa.drivers; + }; + # hardware.graphics = { # Only in unstable + # enable = true; + # package = pkgs.mesa.drivers; + # enable32Bit = true; + # }; + hardware.nvidia = { + # Modesetting is required. + modesetting.enable = true; + + # Nvidia power management. Experimental, and can cause sleep/suspend to fail. + # Enable this if you have graphical corruption issues or application crashes after waking + # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead + # of just the bare essentials. + powerManagement.enable = true; + + # Fine-grained power management. Turns off GPU when not in use. + # Experimental and only works on modern Nvidia GPUs (Turing or newer). + powerManagement.finegrained = false; + + # Use the NVidia open source kernel module (not to be confused with the + # independent third-party "nouveau" open source driver). + # Support is limited to the Turing and later architectures. Full list of + # supported GPUs is at: + # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus + # Only available from driver 515.43.04+ + # Currently alpha-quality/buggy, so false is currently the recommended setting. + open = false; + + # Enable the Nvidia settings menu, + # accessible via `nvidia-settings`. + nvidiaSettings = true; + + # Optionally, you may need to select the appropriate driver version for your specific GPU. + package = config.boot.kernelPackages.nvidiaPackages.stable; + }; } \ No newline at end of file diff --git a/modules/files.nix b/modules/files.nix index 3defac5..3c13e53 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -1,4 +1,12 @@ -{ pkgs, ... } -{ +{ ... }: +{ + fileSystems."/mnt/share/Music" = { + device = "//nas.local/Music"; + fsType = "cifs"; + options = let + automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; + + in ["${automount_opts},credentials=/etc/nixos/smb-secrets,uid=1000,gid=100"]; + }; } \ No newline at end of file diff --git a/modules/fonts.nix b/modules/fonts.nix index 3defac5..8233792 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -1,4 +1,12 @@ -{ pkgs, ... } +{ pkgs, ... }: { - + fonts.packages = with pkgs; [ + nerdfonts + garamond-libre + liberation_ttf + ubuntu_font_family + libre-baskerville + libre-bodoni + ]; + fonts.fontDir.enable = true; } \ No newline at end of file diff --git a/modules/network.nix b/modules/network.nix index 3defac5..c300a8d 100644 --- a/modules/network.nix +++ b/modules/network.nix @@ -1,4 +1,38 @@ -{ pkgs, ... } +{ pkgs, ... }: { + networking.hostName = "launchpad"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + networking.extraHosts = '' + 192.168.12.20 router.local + 192.168.12.21 switch.local + 192.168.12.25 dhcpd.local + 192.168.12.40 launchpad.local + 192.168.12.41 xeon.local + 192.168.12.80 robo.local + 192.168.12.81 nas.local + 192.168.12.83 homeassistant.local + 192.168.12.60 toons.local + + 45.58.52.52 www + 172.245.111.249 est + 216.189.156.74 mail + ''; + + networking.interfaces.enp4s0.ipv4.addresses = [ { + address = "192.168.12.40"; + prefixLength = 24; + } ]; + networking.defaultGateway = "192.168.12.20"; + networking.nameservers = [ "192.168.12.25" ]; + networking.firewall = { + allowedTCPPortRanges = [ { from = 35000; to = 36000; } { from = 5000; to = 6000; } { from = 8000; to = 9000; } ]; + extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; + }; + + # Enable networking + networking.networkmanager.enable = true; } \ No newline at end of file diff --git a/modules/nix.nix b/modules/nix.nix new file mode 100644 index 0000000..8bd7f98 --- /dev/null +++ b/modules/nix.nix @@ -0,0 +1,19 @@ +{ ... }: +{ + nix.settings = { + experimental-features = [ "nix-command" "flakes" ]; + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + max-jobs = 12; # Adjust this to your CPU core count or slightly below + }; + nixpkgs.config = { + allowUnfree = true; + cudaSupport = true; + acceptedLicenses = [ "unfree" "unfreeRedistributable" ]; + }; + nixpkgs.config.permittedInsecurePackages = [ + "freeimage-unstable-2021-11-01" + ]; + nix.settings.auto-optimise-store = true; + nix.settings.access-tokens = "nas.local/git=PAT:glpat-bfbAJxv_4tmgySBZcPSZ"; +} \ No newline at end of file diff --git a/modules/security.nix b/modules/security.nix index 3defac5..a891347 100644 --- a/modules/security.nix +++ b/modules/security.nix @@ -1,4 +1,82 @@ -{ pkgs, ... } +{ pkgs, ... }: { + security.polkit = { + enable = true; + extraConfig = '' + polkit.addRule(function (action, subject) { + if ( + subject.isInGroup("users") && + [ + "org.freedesktop.login1.reboot", + "org.freedesktop.login1.reboot-multiple-sessions", + "org.freedesktop.login1.power-off", + "org.freedesktop.login1.power-off-multiple-sessions", + ].indexOf(action.id) !== -1 + ) { + return polkit.Result.YES; + } + }); + polkit.addRule(function(action, subject) { + var YES = polkit.Result.YES; + var permission = { + // required for udisks1: + "org.freedesktop.udisks.filesystem-mount": YES, + "org.freedesktop.udisks.luks-unlock": YES, + "org.freedesktop.udisks.drive-eject": YES, + "org.freedesktop.udisks.drive-detach": YES, + // required for udisks2: + "org.freedesktop.udisks2.filesystem-mount": YES, + "org.freedesktop.udisks2.encrypted-unlock": YES, + "org.freedesktop.udisks2.eject-media": YES, + "org.freedesktop.udisks2.power-off-drive": YES, + // required for udisks2 if using udiskie from another seat (e.g. systemd): + "org.freedesktop.udisks2.filesystem-mount-other-seat": YES, + "org.freedesktop.udisks2.filesystem-unmount-others": YES, + "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES, + "org.freedesktop.udisks2.encrypted-unlock-system": YES, + "org.freedesktop.udisks2.eject-media-other-seat": YES, + "org.freedesktop.udisks2.power-off-drive-other-seat": YES + }; + if (subject.isInGroup("storage")) { + return permission[action.id]; + } + }); + ''; + }; + # security.pam.services = { +# login.enableKwallet = false; +# login.kwallet = { +# enable = true; +# package = pkgs.plasma5Packages.kwallet-pam; +# }; + # sddm = { + # enableKwallet = true; + # text = '' + # # Enable pam_kwallet5 for sddm + # auth optional pam_kwallet5.so + # session optional pam_kwallet5.so auto_start + # ''; + # }; + # }; +# security.pam.services.wayne.kwallet.enable = true; +# security.pam.services.wayne.kwallet.package = pkgs.plasma5Packages.kwallet-pam; + + security.rtkit.enable = true; + + security.sudo = { + enable = true; + extraConfig = '' + %wheel ALL=(ALL) NOPASSWD: ${pkgs.input-remapper}/bin/input-remapper-service + %wheel ALL=(ALL) NOPASSWD: ${pkgs.input-remapper}/bin/input-remapper-control + ''; + }; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; } \ No newline at end of file diff --git a/modules/users.nix b/modules/users.nix new file mode 100644 index 0000000..1f056cb --- /dev/null +++ b/modules/users.nix @@ -0,0 +1,25 @@ +{ config, pkgs, ... }: +{ + users = { + groups = { + wayne.gid = 1000; + vmail.gid = 2000; + storage.gid = 2010; + dialout = {}; + plugdev = {}; + uinput = {}; + }; + users = { + wayne = { + isNormalUser = true; + description = "Wayne Hayes"; + extraGroups = [ "networkmanager" "wheel" "docker" "wayne" "vmail" "uinput" "storage" ]; + openssh.authorizedKeys.keys = []; + packages = with pkgs; [ + kdePackages.kate + ]; + shell = pkgs.zsh; + }; + }; + }; +} \ No newline at end of file diff --git a/modules/wm.nix b/modules/wm.nix new file mode 100644 index 0000000..3393273 --- /dev/null +++ b/modules/wm.nix @@ -0,0 +1,34 @@ +{ pkgs, ... }: +{ + services.desktopManager.plasma6.enable = false; + + services.xserver = { + enable = false; + xkb = { + layout = "us"; + variant = ""; + }; + videoDrivers = [ "nvidia" ]; + }; + + services.displayManager.sddm = { + enable = true; + autoNumlock = true; + enableHidpi = true; + settings = { + X11 = { + MinimumVT = 7; + DisplayCommand="/etc/sddm/Xsetup"; + }; + }; + wayland = { + enable = true; + }; + }; + + # xdg.portal = { + # enable = false; + # xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + # extraPortals = [ inputs.hyprland.packages.${pkgs.stdenv.hostPlatform.system}.xdg-desktop-portal-hyprland pkgs.kdePackages.xdg-desktop-portal-kde ]; + # }; +} \ No newline at end of file diff --git a/pkgs/derivations/GnuCobal/_default.nix b/pkgs/derivations/GnuCobal/_default.nix new file mode 100644 index 0000000..ea381fe --- /dev/null +++ b/pkgs/derivations/GnuCobal/_default.nix @@ -0,0 +1,82 @@ + { +# outputs = { self, nixpkgs }: + +# let +# # set -euo pipefail; + +# # https://nix.dev/manual/nix/2.18/language/derivations.html +# # required +# system = "x86_64-linux"; +# name = 'GnuCobal'; +# + +# src = "https://sourceforge.net/projects/gnucobol/files/gnucobol/${version}/gnucobol-${version}.tar.gz"; +# sha256 = "abd657e581c14558c79d4e8974b7830f0204bd272b5a2a4a397cfea3b278e524"; + +# mkdir -p "$nixpkgs"; + +# cd "$nixpkgs"; + +# cat < "${program_name}-${version}.drv"; + +# { pkgs ? import {} }: + +# with pkgs; + lib, stdenv, fetchurl, make, glibc, gcc, binutils, coreutils}: + + stdenv.mkDerivation rec { + pname = "gnucobal"; + version = "3.2"; + + src = fetchurl { + url = "https://sourceforge.net/projects/gnucobol/files/gnucobol/${version}/gnucobol-${version}.tar.gz"; + sha256 = "abd657e581c14558c79d4e8974b7830f0204bd272b5a2a4a397cfea3b278e524"; + }; + + strictDeps = true; + + buildInputs = [ make ]; + + + env.NIX_CFLAGS_COMPILE = lib.concatStringsSep " " [ + "-I../common/include" + "-I../debug/include" + "-I../exception/include" + ]; + + doCheck = true; + + meta = { + description = "GnuCobal"; + longDescription = ''GnuCOBOL (formerly OpenCOBOL) is a free COBOL compiler. cobc translates COBOL source code to native executable using intermediate C, designated C compiler and linker. Source code features include fixed and free-format source code, data division that can define any variable format, file I/O, and external call interface. Intrinsic functions include math, sorting, searching, date and time, file operations, and string manipulation. Supports CICS, CGI, DB2, and Windows DLL. Formally known as OpenCOBOL, GnuCOBOL is a COBOL compiler with run time support. The run time is now GNU LGPL. GnuCOBOL implements a substantial part of the COBOL 85, X/Open COBOL and newer ISO COBOL standards (2002, 2014, 2022), as well as many extensions included in other COBOL compilers (IBM COBOL, MicroFocus COBOL, ACUCOBOL-GT and others).''; + homepage = "https://sourceforge.net/projects/gnucobol/"; + license = lib.licenses.gpl3; + mainProgram = "GnuCobal"; + platforms = lib.platforms.linux; + }; + } +# in { inherit name system url sha256; }; + +# } +# } + +# ./configure \ +# --libdir=$lib/lib \ +# --includedir=$headers/include \ +# --docdir=$doc/share/doc + +# buildPhase = '' + # ./configure && make + # ''; + + # installPhase = '' + + # mkdir -p $out/bin + + # cp Gnu-Cobal $out/bin + + # wrapProgram $out/bin/GnuCobal \ + + # --prefix PATH : "${pkgs.lib.makeBinPath [ pkgs.glibc ]}" + + # ''; \ No newline at end of file diff --git a/pkgs/derivations/GnuCobal/flake.nix b/pkgs/derivations/GnuCobal/flake.nix new file mode 100644 index 0000000..b76adbc --- /dev/null +++ b/pkgs/derivations/GnuCobal/flake.nix @@ -0,0 +1,37 @@ +{ + description = "GnuCobol derivation as a flake"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs"; + + outputs = { self, nixpkgs }: { + packages.x86_64-linux.gnu-cobol = let + pkgs = import nixpkgs { system = "x86_64-linux"; }; + in pkgs.stdenv.mkDerivation { + pname = "gnucobol"; + version = "3.2"; + + src = pkgs.fetchurl { + url = "https://sourceforge.net/projects/gnucobol/files/gnucobol/3.2/gnucobol-3.2.tar.gz"; + sha256 = "abd657e581c14558c79d4e8974b7830f0204bd272b5a2a4a397cfea3b278e524"; + }; + + buildInputs = [ pkgs.makeWrapper ]; + + buildPhase = '' + ./configure --prefix=$out + make + ''; + + installPhase = '' + make install + ''; + + meta = with pkgs.lib; { + description = "GNU Cobol compiler"; + license = licenses.gpl3; + maintainers = with maintainers; [ yourGitHubUsername ]; + }; + }; + }; +} + diff --git a/pkgs/derivations/GnuCobal/snake.cob b/pkgs/derivations/GnuCobal/snake.cob new file mode 100644 index 0000000..b333bfd --- /dev/null +++ b/pkgs/derivations/GnuCobal/snake.cob @@ -0,0 +1,55 @@ +IDENTIFICATION DIVISION. +PROGRAM-ID. SnakeGame. +DATA DIVISION. +WORKING-STORAGE SECTION. +01 WS-BOARD. + 05 FILLER PIC X(20) VALUE '....................'. + 05 FILLER PIC X(20) VALUE '....................'. + 05 FILLER PIC X(20) VALUE '....................'. + 05 FILLER PIC X(20) VALUE '.........O..........'. + 05 FILLER PIC X(20) VALUE '....................'. + 05 FILLER PIC X(20) VALUE '....................'. +01 WS-SNAKE-POSITION. + 05 WS-X PIC 99 VALUE 10. + 05 WS-Y PIC 99 VALUE 4. +01 WS-APPLE-POSITION. + 05 APPLE-X PIC 99 VALUE 5. + 05 APPLE-Y PIC 99 VALUE 3. +01 WS-DIRECTION PIC X VALUE 'R'. +01 WS-SCORE PIC 99 VALUE 0. + +PROCEDURE DIVISION. +MAIN-PROCEDURE. + PERFORM UNTIL WS-DIRECTION = 'Q' + DISPLAY BOARD + MOVE WS-DIRECTION TO WS-DIRECTION + PERFORM MOVE-SNAKE + PERFORM CHECK-APPLE + DISPLAY 'SCORE: ' WS-SCORE + END-PERFORM. + STOP RUN. + +MOVE-SNAKE. + IF WS-DIRECTION = 'U' THEN + SUBTRACT 1 FROM WS-Y + ELSE IF WS-DIRECTION = 'D' THEN + ADD 1 TO WS-Y + ELSE IF WS-DIRECTION = 'L' THEN + SUBTRACT 1 FROM WS-X + ELSE IF WS-DIRECTION = 'R' THEN + ADD 1 TO WS-X + END-IF. + +CHECK-APPLE. + IF WS-X = APPLE-X AND WS-Y = APPLE-Y THEN + ADD 1 TO WS-SCORE + MOVE FUNCTION RANDOM(1 20) TO APPLE-X + MOVE FUNCTION RANDOM(1 20) TO APPLE-Y + END-IF. + +DISPLAY BOARD. + MOVE SPACES TO WS-BOARD(WS-Y, WS-X). + MOVE 'O' TO WS-BOARD(WS-Y, WS-X). + MOVE 'A' TO WS-BOARD(APPLE-Y, APPLE-X). + DISPLAY WS-BOARD. + diff --git a/pkgs/derivations/polycat/default.nix b/pkgs/derivations/polycat/default.nix new file mode 100644 index 0000000..9a44dbb --- /dev/null +++ b/pkgs/derivations/polycat/default.nix @@ -0,0 +1,88 @@ +{ stdenv, fetchFromGitHub, fetchgit, cmake, lib }: +let + ls = "ls -alR"; +in +stdenv.mkDerivation rec { + pname = "polycat"; + version = "1.2.0"; # replace with actual version if applicable + + src = fetchgit { + # owner = "2IMT"; + # repo = "polycat"; + # rev = "main"; # or a specific commit/tag + # fetchSubmodules = true; + # deepClone = true; + # leaveDotGit = false; + url = "https://github.com/2IMT/polycat.git"; + hash = "sha256-zm5AJEKp9OcAPGYy86R1hxDQu3600zJWsPdQyx0OGKw="; # replace this with the correct sha256 for the download + }; + + nativeBuildInputs = [ cmake ]; + + # argparse = fetchFromGitHub { + # owner = "p-ranav"; + # repo = "argparse"; + # rev = "v2.9"; # Replace with the version needed by polycat + # sha256 = "1wdpy45qcipfyw9bbr9s42v67b88bkyniy76yvh0grp2wf8zidxx"; # Replace with correct hash + # }; + + # unpackPhase = '' + # cp -r ${src} ./source + # ''; + + # sourceRoot = "./source"; + + # Use this phase to link the argparse dependency + # patchPhase = '' + # # If the `argparse` dependency isn’t fetched automatically, fetch it here + # if [ ! -d dep/argparse ]; then + # mkdir -p dep/argparse + # cp -r ${fetchFromGitHub { + # owner = "p-ranav"; + # repo = "argparse"; + # rev = "v2.9"; + # sha256 = "1wdpy45qcipfyw9bbr9s42v67b88bkyniy76yvh0grp2wf8zidxx"; # Replace with actual hash + # }}/* dep/argparse + # fi + # ''; + + + # Unpack and link argparse manually + # unpackPhase = '' + # # Unpack main source + # runHook preUnpack + # tar xzf ${src} --strip-components=1 + # runHook postUnpack + + # # Unpack argparse and link it + # mkdir -p dep + # tar xzf ${argparse} -C dep --strip-components=1 + # ln -s ${argparse} dep/argparse + # ''; + + # Skip the problematic updateAutotoolsGnuConfigScriptsPhase + configurePhase = '' + # mkdir -p build + # cd polycat + echo ls . + cmake -DCMAKE_BUILD_TYPE=Release . + ''; + + buildPhase = '' + # mkdir -p build + # cd build + # cmake -DCMAKE_BUILD_TYPE=Release . + cmake --build . + ''; + + installPhase = '' + mkdir -p $out/bin + cp polycat $out/bin/ + ''; + + meta = with lib; { + description = "runcat module for polybar (or waybar)."; + license = licenses.mit; # Replace with correct license + maintainers = with maintainers; [ "2IMT" ]; + }; +} diff --git a/pkgs/derivations/xpen/_default.nix b/pkgs/derivations/xpen/_default.nix new file mode 100644 index 0000000..39d1ad2 --- /dev/null +++ b/pkgs/derivations/xpen/_default.nix @@ -0,0 +1,79 @@ +{ pkgs ? import {}, stdenv, fetchurl, lib }: + +# pkgs.buildFHSUserEnv { +stdenv.mkDerivation rec { + name = "PenTablet"; + targetPkgs = pkgs: []; + src = pkgs.fetchurl { + # Replace the URL with the actual download link of the driver + url = "https://www.xp-pen.com/download/file.html?id=2901&pid=977&ext=gz"; + + sha256 = "1wyl96lpw8wvzfq3q5q0njp2ca8j5h89psi8j0lmrhymxhp94ml7"; # Replace with the actual sha256 + }; + pname = "pentablet"; + version = "3.2.1.210426"; # Replace with the actual version + + extraBuildCommands = '' + mkdir -p $out/etc/xdg/autostart + mkdir -p $out/lib/udev/rules.d + mkdir -p $out/usr/lib/pentablet/{conf/xppen,doc,lib,platforms} + mkdir -p $out/usr/share/{applications,icons/hicolor/256x256/apps} + mkdir -p $PWD/tmp + + # Extract and install to FHS directories under $out + tar -xzf /path/to/XPPenLinux3.4.9-240607.tar.gz -C $PWD/tmp + + cp $PWD/tmp/App/etc/xdg/autostart/xppentablet.desktop $out/etc/xdg/autostart/ + cp $PWD/tmp/App/lib/udev/rules.d/10-xp-pen.rules $out/lib/udev/rules.d/ + cp -r $PWD/tmp/App/usr/lib/pentablet/conf/xppen/* $out/usr/lib/pentablet/conf/xppen/ + cp -r $PWD/tmp/App/usr/lib/pentablet/doc/* $out/usr/lib/pentablet/doc/ + cp -r $PWD/tmp/App/usr/lib/pentablet/lib/* $out/usr/lib/pentablet/lib/ + cp $PWD/tmp/App/usr/lib/pentablet/platforms/libqxcb.so $out/usr/lib/pentablet/platforms/ + cp $PWD/tmp/App/usr/lib/pentablet/PenTablet $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/lib/pentablet/PenTablet.sh $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/lib/pentablet/resource.rcc $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/share/applications/xppentablet.desktop $out/usr/share/applications/ + cp $PWD/tmp/App/usr/share/icons/hicolor/256x256/apps/xppentablet.png $out/usr/share/icons/hicolor/256x256/apps/ + + # Set appropriate permissions based on the script + chmod 0555 $out/usr/lib/pentablet/PenTablet + chmod 0555 $out/usr/lib/pentablet/PenTablet.sh + chmod 0777 $out/usr/lib/pentablet/conf/xppen + chmod 0666 $out/usr/lib/pentablet/conf/xppen/config.xml + chmod 0666 $out/usr/lib/pentablet/conf/xppen/language.ini + chmod 0666 $out/usr/lib/pentablet/conf/xppen/name_config.ini + chmod 0666 $out/usr/lib/pentablet/resource.rcc + + # Ensure autostart and application icons have the correct permissions + chmod 0444 $out/usr/share/applications/xppentablet.desktop + chmod 0555 $out/usr/share/icons/hicolor/256x256/apps/xppentablet.png + + # Create the lockfile + touch $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + chmod 0666 $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + ''; + + # Use bind mounts to mirror the required paths + bindPaths = [ + { hostPath = "$out/etc/xdg"; containerPath = "/etc/xdg"; } + { hostPath = "$out/lib/udev"; containerPath = "/lib/udev"; } + { hostPath = "$out/usr/lib/pentablet"; containerPath = "/usr/lib/pentablet"; } + { hostPath = "$out/usr/share"; containerPath = "/usr/share"; } + { hostPath = "$out/tmp"; containerPath = "/tmp"; } + ]; + + runScript = '' + export LD_LIBRARY_PATH=/usr/lib/pentablet/lib + export QT_PLUGIN_PATH=/usr/lib/pentablet + export XPPEN_CONFIG_DIR=/usr/lib/pentablet/conf/xppen + + # Launch the application + /usr/lib/pentablet/PenTablet.sh + ''; + + meta = with lib; { + description = "Remote Controll Drivers."; + license = licenses.mit; # Replace with correct license + maintainers = with maintainers; [ "anonymous" ]; + }; +} diff --git a/pkgs/derivations/xpen/_flake.nix b/pkgs/derivations/xpen/_flake.nix new file mode 100644 index 0000000..39d1ad2 --- /dev/null +++ b/pkgs/derivations/xpen/_flake.nix @@ -0,0 +1,79 @@ +{ pkgs ? import {}, stdenv, fetchurl, lib }: + +# pkgs.buildFHSUserEnv { +stdenv.mkDerivation rec { + name = "PenTablet"; + targetPkgs = pkgs: []; + src = pkgs.fetchurl { + # Replace the URL with the actual download link of the driver + url = "https://www.xp-pen.com/download/file.html?id=2901&pid=977&ext=gz"; + + sha256 = "1wyl96lpw8wvzfq3q5q0njp2ca8j5h89psi8j0lmrhymxhp94ml7"; # Replace with the actual sha256 + }; + pname = "pentablet"; + version = "3.2.1.210426"; # Replace with the actual version + + extraBuildCommands = '' + mkdir -p $out/etc/xdg/autostart + mkdir -p $out/lib/udev/rules.d + mkdir -p $out/usr/lib/pentablet/{conf/xppen,doc,lib,platforms} + mkdir -p $out/usr/share/{applications,icons/hicolor/256x256/apps} + mkdir -p $PWD/tmp + + # Extract and install to FHS directories under $out + tar -xzf /path/to/XPPenLinux3.4.9-240607.tar.gz -C $PWD/tmp + + cp $PWD/tmp/App/etc/xdg/autostart/xppentablet.desktop $out/etc/xdg/autostart/ + cp $PWD/tmp/App/lib/udev/rules.d/10-xp-pen.rules $out/lib/udev/rules.d/ + cp -r $PWD/tmp/App/usr/lib/pentablet/conf/xppen/* $out/usr/lib/pentablet/conf/xppen/ + cp -r $PWD/tmp/App/usr/lib/pentablet/doc/* $out/usr/lib/pentablet/doc/ + cp -r $PWD/tmp/App/usr/lib/pentablet/lib/* $out/usr/lib/pentablet/lib/ + cp $PWD/tmp/App/usr/lib/pentablet/platforms/libqxcb.so $out/usr/lib/pentablet/platforms/ + cp $PWD/tmp/App/usr/lib/pentablet/PenTablet $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/lib/pentablet/PenTablet.sh $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/lib/pentablet/resource.rcc $out/usr/lib/pentablet/ + cp $PWD/tmp/App/usr/share/applications/xppentablet.desktop $out/usr/share/applications/ + cp $PWD/tmp/App/usr/share/icons/hicolor/256x256/apps/xppentablet.png $out/usr/share/icons/hicolor/256x256/apps/ + + # Set appropriate permissions based on the script + chmod 0555 $out/usr/lib/pentablet/PenTablet + chmod 0555 $out/usr/lib/pentablet/PenTablet.sh + chmod 0777 $out/usr/lib/pentablet/conf/xppen + chmod 0666 $out/usr/lib/pentablet/conf/xppen/config.xml + chmod 0666 $out/usr/lib/pentablet/conf/xppen/language.ini + chmod 0666 $out/usr/lib/pentablet/conf/xppen/name_config.ini + chmod 0666 $out/usr/lib/pentablet/resource.rcc + + # Ensure autostart and application icons have the correct permissions + chmod 0444 $out/usr/share/applications/xppentablet.desktop + chmod 0555 $out/usr/share/icons/hicolor/256x256/apps/xppentablet.png + + # Create the lockfile + touch $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + chmod 0666 $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + ''; + + # Use bind mounts to mirror the required paths + bindPaths = [ + { hostPath = "$out/etc/xdg"; containerPath = "/etc/xdg"; } + { hostPath = "$out/lib/udev"; containerPath = "/lib/udev"; } + { hostPath = "$out/usr/lib/pentablet"; containerPath = "/usr/lib/pentablet"; } + { hostPath = "$out/usr/share"; containerPath = "/usr/share"; } + { hostPath = "$out/tmp"; containerPath = "/tmp"; } + ]; + + runScript = '' + export LD_LIBRARY_PATH=/usr/lib/pentablet/lib + export QT_PLUGIN_PATH=/usr/lib/pentablet + export XPPEN_CONFIG_DIR=/usr/lib/pentablet/conf/xppen + + # Launch the application + /usr/lib/pentablet/PenTablet.sh + ''; + + meta = with lib; { + description = "Remote Controll Drivers."; + license = licenses.mit; # Replace with correct license + maintainers = with maintainers; [ "anonymous" ]; + }; +} diff --git a/pkgs/derivations/xpen/_flake.nix_ b/pkgs/derivations/xpen/_flake.nix_ new file mode 100644 index 0000000..42d6404 --- /dev/null +++ b/pkgs/derivations/xpen/_flake.nix_ @@ -0,0 +1,121 @@ +{ + description = "Flake for installing XP-Pen PenTablet driver on NixOS"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; # You can pin this to a specific commit if needed + }; + + outputs = { self, nixpkgs }: + let + pkgs = import nixpkgs { system = "x86_64-linux"; config.allowUnfree = true; }; + in + { + packages.x86_64-linux.pentablet = pkgs.stdenv.mkDerivation rec { + pname = "pentablet"; + version = "3.2.1.210426"; # Replace with the actual version + + src = pkgs.fetchurl { + # Replace the URL with the actual download link of the driver + url = "https://www.xp-pen.com/download/file.html?id=2901&pid=977&ext=gz"; + + sha256 = "1wyl96lpw8wvzfq3q5q0njp2ca8j5h89psi8j0lmrhymxhp94ml7"; # Replace with the actual sha256 + }; + + nativeBuildInputs = [ pkgs.makeWrapper ]; + + buildInputs = with pkgs; [ + glib + gtk3 + xorg.libX11 + xorg.libXext + xorg.libXrender + xorg.libXfixes + # Add any other dependencies required by the driver + ]; + + unpackPhase = '' + mkdir -p tmpdir + cd tmpdir + tar xzf $src + echo $PWD + ''; + + installPhase = '' + # Create necessary directories + mkdir -p $out/bin + mkdir -p $out/lib/pentablet + mkdir -p $out/share/applications + mkdir -p $out/share/icons/hicolor/256x256/apps + mkdir -p $out/lib/udev/rules.d + + # Copy application files + echo "Current directory is: $PWD" + echo "Listing files in $PWD:" + ls -al $PWD + cp -r XPPenLinux3.4.9-240607/App/usr/lib/pentablet $out/lib + + # Copy the executable to bin + ln -s $out/lib/pentablet/PenTablet $out/bin/PenTablet + + # Install desktop file + cp XPPenLinux3.4.9-240607/App/usr/share/applications/xppentablet.desktop $out/share/applications/ + + # Install icon + cp XPPenLinux3.4.9-240607/App/usr/share/icons/hicolor/256x256/apps/xppentablet.png $out/share/icons/hicolor/256x256/apps/ + + # Install udev rules + cp XPPenLinux3.4.9-240607/App/lib/udev/rules.d/10-xp-pen.rules $out/lib/udev/rules.d/ + + # Create a wrapper script + makeWrapper $out/lib/pentablet/PenTablet $out/bin/PenTablet \ + --set XPPEN_CONFIG_DIR "$HOME/.config/xpen" \ + --prefix LD_LIBRARY_PATH : "$out/lib/pentablet" + + chmod +x $out/bin/PenTablet + + # Adjust permissions + chmod +x $out/lib/pentablet/PenTablet + ''; + + # Since the application might expect to write to certain directories, we'll need to address this + # in the wrapper script or by setting up writable directories (discussed later) + + meta = with pkgs.lib; { + description = "XP-Pen PenTablet driver"; + homepage = "https://www.xp-pen.com/"; + license = licenses.unfreeRedistributable; # Since it's proprietary software + platforms = platforms.linux; + }; + }; + + # Optionally, you can define a NixOS module to handle udev rules and other configurations + nixosModules.pentablet = { config, lib, pkgs, ... }: { + options = {}; + + config = { + # Install the pentablet package + environment.systemPackages = [ self.packages.${pkgs.system}.pentablet ]; + + # Add udev rules + services.udev.packages = [ self.packages.${pkgs.system}.pentablet ]; + + # If the driver requires any system services, you can define them here + # For example, if it needs to run a daemon: + # systemd.services.pentablet = { + # description = "XP-Pen PenTablet Service"; + # after = [ "network.target" ]; + # wantedBy = [ "multi-user.target" ]; + # serviceConfig = { + # ExecStart = "${self.packages.${pkgs.system}.pentablet}/bin/PenTablet"; + # }; + # }; + + # Set up auto-start if needed + # programs.autoStart.enable = true; + # programs.autoStart.startupCommands = '' + # ${self.packages.${pkgs.system}.pentablet}/bin/PenTablet & + # ''; + }; + }; + }; +} \ No newline at end of file diff --git a/pkgs/derivations/xpen/flake.nix b/pkgs/derivations/xpen/flake.nix new file mode 100644 index 0000000..2a5eefc --- /dev/null +++ b/pkgs/derivations/xpen/flake.nix @@ -0,0 +1,117 @@ +{ + description = "Remote Controll Drivers."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; # Specify the nixpkgs input + }; + + outputs = { self, nixpkgs }: + let + # Import the nixpkgs packages to access utilities like wget and tar. + pkgs = import nixpkgs { system = "x86_64-linux"; }; + # Define the download and extraction process. + downloadAndExtract = pkgs.stdenv.mkDerivation { + pname = "pentablet"; + version = "3.2.1.210426"; + + # Set up the fetchURL to download the tarball. + src = pkgs.fetchurl { + url = "https://www.xp-pen.com/download/file.html?id=2901&pid=977&ext=gz"; + sha256 = "1wyl96lpw8wvzfq3q5q0njp2ca8j5h89psi8j0lmrhymxhp94ml7"; # Replace with the actual hash + }; + + extraBuildCommands = '' + # mkdir -p $out/etc/xdg/autostart + # mkdir -p $out/lib/udev/rules.d + # mkdir -p $out/usr/lib/pentablet/{conf/xppen,doc,lib,platforms} + # mkdir -p $out/usr/share/{applications,icons/hicolor/256x256/apps} + # mkdir -p $PWD/tmp + + # # Extract and install to FHS directories under $out + # tar -xzf XPPenLinux3.4.9-240607.tar.gz -C $PWD/tmp + + # cp $PWD/tmp/App/etc/xdg/autostart/xppentablet.desktop $out/etc/xdg/autostart/ + # cp $PWD/tmp/App/lib/udev/rules.d/10-xp-pen.rules $out/lib/udev/rules.d/ + # cp -r $PWD/tmp/App/usr/lib/pentablet/conf/xppen/* $out/usr/lib/pentablet/conf/xppen/ + # cp -r $PWD/tmp/App/usr/lib/pentablet/doc/* $out/usr/lib/pentablet/doc/ + # cp -r $PWD/tmp/App/usr/lib/pentablet/lib/* $out/usr/lib/pentablet/lib/ + # cp $PWD/tmp/App/usr/lib/pentablet/platforms/libqxcb.so $out/usr/lib/pentablet/platforms/ + # cp $PWD/tmp/App/usr/lib/pentablet/PenTablet $out/usr/lib/pentablet/ + # cp $PWD/tmp/App/usr/lib/pentablet/PenTablet.sh $out/usr/lib/pentablet/ + # cp $PWD/tmp/App/usr/lib/pentablet/resource.rcc $out/usr/lib/pentablet/ + # cp $PWD/tmp/App/usr/share/applications/xppentablet.desktop $out/usr/share/applications/ + # cp $PWD/tmp/App/usr/share/icons/hicolor/256x256/apps/xppentablet.png $out/usr/share/icons/hicolor/256x256/apps/ + + # # Set appropriate permissions based on the script + # chmod 0555 $out/usr/lib/pentablet/PenTablet + # chmod 0555 $out/usr/lib/pentablet/PenTablet.sh + # chmod 0777 $out/usr/lib/pentablet/conf/xppen + # chmod 0666 $out/usr/lib/pentablet/conf/xppen/config.xml + # chmod 0666 $out/usr/lib/pentablet/conf/xppen/language.ini + # chmod 0666 $out/usr/lib/pentablet/conf/xppen/name_config.ini + # chmod 0666 $out/usr/lib/pentablet/resource.rcc + + # # Ensure autostart and application icons have the correct permissions + # chmod 0444 $out/usr/share/applications/xppentablet.desktop + # chmod 0555 $out/usr/share/icons/hicolor/256x256/apps/xppentablet.png + + # # Create the lockfile + # touch $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + # chmod 0666 $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + + set -e + + mkdir -p $out/etc/xdg/autostart + mkdir -p $out/lib/udev/rules.d + mkdir -p $out/usr/lib/pentablet/{conf/xppen,doc,lib,platforms} + mkdir -p $out/usr/share/{applications,icons/hicolor/256x256/apps} + mkdir -p $PWD/tmp + + tar -xzf ${src} -C $PWD/tmp + ls -R $PWD/tmp + + install -Dm644 $PWD/tmp/App/etc/xdg/autostart/xppentablet.desktop $out/etc/xdg/autostart/xppentablet.desktop + install -Dm644 $PWD/tmp/App/lib/udev/rules.d/10-xp-pen.rules $out/lib/udev/rules.d/10-xp-pen.rules + install -Dm644 -t $out/usr/lib/pentablet/conf/xppen/ $PWD/tmp/App/usr/lib/pentablet/conf/xppen/* + install -Dm644 -t $out/usr/lib/pentablet/doc/ $PWD/tmp/App/usr/lib/pentablet/doc/* + install -Dm755 $PWD/tmp/App/usr/lib/pentablet/platforms/libqxcb.so $out/usr/lib/pentablet/platforms/libqxcb.so + + install -Dm555 $PWD/tmp/App/usr/lib/pentablet/PenTablet $out/usr/lib/pentablet/PenTablet + install -Dm555 $PWD/tmp/App/usr/lib/pentablet/PenTablet.sh $out/usr/lib/pentablet/PenTablet.sh + install -Dm644 $PWD/tmp/App/usr/lib/pentablet/resource.rcc $out/usr/lib/pentablet/resource.rcc + + install -Dm644 $PWD/tmp/App/usr/share/applications/xppentablet.desktop $out/usr/share/applications/xppentablet.desktop + install -Dm644 $PWD/tmp/App/usr/share/icons/hicolor/256x256/apps/xppentablet.png $out/usr/share/icons/hicolor/256x256/apps/xppentablet.png + + touch $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + chmod 0666 $out/tmp/qtsingleapp-Pentab-9c9b-lockfile + + # Cleanup + rm -rf $PWD/tmp + ''; + + # Use bind mounts to mirror the required paths + bindPaths = [ + { hostPath = "$out/etc/xdg"; containerPath = "/etc/xdg"; } + { hostPath = "$out/lib/udev"; containerPath = "/lib/udev"; } + { hostPath = "$out/usr/lib/pentablet"; containerPath = "/usr/lib/pentablet"; } + { hostPath = "$out/usr/share"; containerPath = "/usr/share"; } + { hostPath = "$out/tmp"; containerPath = "/tmp"; } + ]; + + runScript = '' + export LD_LIBRARY_PATH=/usr/lib/pentablet/lib + export QT_PLUGIN_PATH=/usr/lib/pentablet + export XPPEN_CONFIG_DIR=/usr/lib/pentablet/conf/xppen + + # Launch the application + /usr/lib/pentablet/PenTablet.sh + ''; + }; + + in { + # Expose the downloadAndExtract process as a package in the flake's outputs. + packages.x86_64-linux.default = downloadAndExtract; + defaultPackage.x86_64-linux = downloadAndExtract; + }; +}