diff --git a/flake.lock b/flake.lock index e7a419b..41364d9 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1728337164, - "narHash": "sha256-VdRTjJFyq4Q9U7Z/UoC2Q5jK8vSo6E86lHc2OanXtvc=", + "lastModified": 1741217763, + "narHash": "sha256-g/TrltIjFHIjtzKY5CJpoPANfHQWDD43G5U1a/v5oVg=", "owner": "nix-community", "repo": "home-manager", - "rev": "038630363e7de57c36c417fd2f5d7c14773403e4", + "rev": "486b066025dccd8af7fbe5dd2cc79e46b88c80da", "type": "github" }, "original": { @@ -21,13 +21,32 @@ "type": "github" } }, + "homix": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1720719665, + "narHash": "sha256-BKcOoDlMC86zExMKXFXQ04HO99fUNFmtEdvP+gB45Pk=", + "owner": "sioodmy", + "repo": "homix", + "rev": "62bc58f2350cbb061e61ac0f3d63018663fbe4cb", + "type": "github" + }, + "original": { + "owner": "sioodmy", + "ref": "main", + "repo": "homix", + "type": "github" + } + }, "nixos-hardware": { "locked": { - "lastModified": 1728269138, - "narHash": "sha256-oKxDImsOvgUZMY4NwXVyUc/c1HiU2qInX+b5BU0yXls=", + "lastModified": 1741325094, + "narHash": "sha256-RUAdT8dZ6k/486vnu3tiNRrNW6+Q8uSD2Mq7gTX4jlo=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "ecfcd787f373f43307d764762e139a7cdeb9c22b", + "rev": "b48cc4dab0f9711af296fc367b6108cf7b8ccb16", "type": "github" }, "original": { @@ -39,11 +58,27 @@ }, "nixpkgs": { "locked": { - "lastModified": 1728492678, - "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "lastModified": 1719690277, + "narHash": "sha256-0xSej1g7eP2kaUF+JQp8jdyNmpmCJKRpO12mKl/36Kc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "rev": "2741b4b489b55df32afac57bc4bfd220e8bf617e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1741246872, + "narHash": "sha256-Q6pMP4a9ed636qilcYX8XUguvKl/0/LGXhHcRI91p0U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "10069ef4cf863633f57238f179a0297de84bd8d3", "type": "github" }, "original": { @@ -55,8 +90,9 @@ "root": { "inputs": { "home-manager": "home-manager", + "homix": "homix", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" } } }, diff --git a/flake.nix b/flake.nix index b697192..eea250a 100644 --- a/flake.nix +++ b/flake.nix @@ -5,23 +5,18 @@ nixpkgs.url = "nixpkgs/nixos-unstable"; home-manager.url = "github:nix-community/home-manager/master"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + homix.url = "github:sioodmy/homix/main"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; }; - outputs = inputs@{ nixpkgs, home-manager, ... }: + outputs = inputs@{ self, nixpkgs, homix, ... }: let systemSettings = { system = "x86_64-linux"; hostname = "kenryu-nixos"; - machine = "workstation"; + host = "syushiki"; timezone = "Asia/Tokyo"; locale = "ja_JP.UTF-8"; - bootConf = { - mode = "uefi"; - mountPath = "/boot"; - grubDev = ""; - }; - gpuType = "nvidia"; }; userSettings = { @@ -29,39 +24,35 @@ name = "Kenryu Shibata"; email-dev = "kenryudev5894@gmail.com"; dotfilesDir = "/etc/nixos"; - editor = "nvim"; - editor-pkg = pkgs.neovim; }; pkgs = import inputs.nixpkgs { system = systemSettings.system; - config = { - allowUnfree = true; - allowUnfreePredicate = (_: true ); - }; }; lib = inputs.nixpkgs.lib; - home-manager = inputs.home-manager; in { - nixosConfigurations.system = lib.nixosSystem { - system = systemSettings.system; - modules = [ - (./. + "/machines" + ("/" + systemSettings.machine) + "/configuration.nix") - home-manager.nixosModules.home-manager { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; - home-manager.users.${userSettings.username} = import (./. + "/machines" + ("/" + systemSettings.machine) + "/home.nix"); - home-manager.extraSpecialArgs = { - inherit userSettings; - }; - } - ]; - specialArgs = { - inherit systemSettings; - inherit userSettings; - inherit inputs; - }; + nixosModules = { + homix = homix.nixosModules.default; }; + nixosConfigurations = import ./hosts inputs; + #nixosConfigurations.syushiki = lib.nixosSystem { + # system = systemSettings.system; + # modules = [ + # ./hosts/syushiki + # ./overlays + # home-manager.nixosModules.home-manager { + # home-manager.useGlobalPkgs = true; + # home-manager.useUserPackages = true; + # home-manager.users.${userSettings.username} = import (./. + "/hosts/${systemSettings.host}/home.nix"); + # home-manager.extraSpecialArgs = { + # inherit userSettings; + # }; + # } + # ]; + # specialArgs = { + # inherit inputs systemSettings userSettings; + # }; + #}; }; } diff --git a/hosts/default.nix b/hosts/default.nix new file mode 100644 index 0000000..bcfd9e5 --- /dev/null +++ b/hosts/default.nix @@ -0,0 +1,20 @@ +{ self, nixpkgs, ... }: +let + inherit (self) inputs; + mkHost = name: + nixpkgs.lib.nixosSystem { + modules = [ + ./${name} + ../overlays + ] ++ builtins.attrValues self.nixosModules; + + specialArgs = { + inherit inputs; + systemSettings = import ./${name}/systemSettings.nix; + userSettings = import ../user/userSettings.nix; + }; + }; +in +{ + syushiki = mkHost "syushiki"; +} diff --git a/hosts/syushiki/default.nix b/hosts/syushiki/default.nix new file mode 100644 index 0000000..69f046c --- /dev/null +++ b/hosts/syushiki/default.nix @@ -0,0 +1,50 @@ +{ config, lib, pkgs, modulesPath, systemSettings, ... }: { + imports = [ + ../../system + ../../system/nvidia + ../../user + (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/f4c95da6-3c6b-4414-a62a-c8c26c4a1c73"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/C83C-841F"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + fileSystems."/run/media/kenryus/hdd" = { + device = "/dev/disk/by-uuid/0d146628-12f4-4bb6-abde-bbf798a57c25"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/d933c349-8e70-41e1-8d13-605656dba18b"; } + ]; + + nixpkgs.hostPlatform = lib.mkDefault systemSettings.system; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + + # Use the systemd-boot EFI boot loader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + programs.appimage = { + enable = true; + binfmt = true; + }; + + # Open ports in the firewall. + networking.firewall.allowedTCPPorts = [ 3000 3001 22 ]; + + system.stateVersion = "24.05"; # Did you read the changelog? +} diff --git a/hosts/syushiki/home.nix b/hosts/syushiki/home.nix new file mode 100644 index 0000000..e0424c0 --- /dev/null +++ b/hosts/syushiki/home.nix @@ -0,0 +1,22 @@ +{ pkgs, userSettings, ... }: +{ + imports = [ + ../../user/dev/tools/git.nix + ../../user/dev/tools/gh.nix + ../../user/dev/editor/vscodium.nix + ../../user/dev/editor/zed-editor.nix + ../../user/dev/lang/cc.nix + ../../user/dev/lang/python.nix + ../../user/dev/lang/rust.nix + ../../user/dev/lang/ecmascript.nix + ]; + + home.username = userSettings.username; + home.homeDirectory = "/home/" + userSettings.username; + + programs.home-manager.enable = true; + + home.stateVersion = "24.05"; + + home.packages = with pkgs; []; +} diff --git a/hosts/syushiki/systemSettings.nix b/hosts/syushiki/systemSettings.nix new file mode 100644 index 0000000..f728dfb --- /dev/null +++ b/hosts/syushiki/systemSettings.nix @@ -0,0 +1,6 @@ +{ + system = "x86_64-linux"; + hostname = "kenryu-nixos"; + timezone = "Asia/Tokyo"; + locale = "ja_JP.UTF-8"; +} diff --git a/machines/workstation/configuration.nix b/machines/workstation/configuration.nix index 61226b2..7e4aa3c 100644 --- a/machines/workstation/configuration.nix +++ b/machines/workstation/configuration.nix @@ -32,7 +32,7 @@ }; # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 3000 3001 ]; + networking.firewall.allowedTCPPorts = [ 3000 3001 22 ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; diff --git a/machines/workstation/home.nix b/machines/workstation/home.nix index d488f9b..3380278 100644 --- a/machines/workstation/home.nix +++ b/machines/workstation/home.nix @@ -9,6 +9,7 @@ ../../user/dev/tools/firefox-devedition.nix ../../user/dev/tools/dbeaver-bin.nix ../../user/dev/tools/tldr.nix + ../../user/dev/tools/gh.nix ../../user/dev/editor/vscodium.nix ../../user/dev/editor/zed-editor.nix ../../user/dev/lang/cc.nix @@ -18,17 +19,20 @@ ../../user/dev/ide/qtcreator.nix ../../user/apps/utils/alacritty.nix ../../user/apps/utils/keepassxc.nix - ../../user/apps/utils/cava.nix + #../../user/apps/utils/cava.nix ../../user/apps/utils/owncloud-client.nix ../../user/apps/utils/fzf.nix ../../user/apps/utils/zoxide.nix ../../user/apps/media/vlc.nix ../../user/apps/media/mpv.nix ../../user/apps/media/yt-dlp.nix + ../../user/apps/media/kdenlive.nix + ../../user/apps/media/obs-studio.nix ../../user/apps/graphics/gimp.nix ../../user/apps/graphics/inkscape.nix ../../user/apps/games/mangohud.nix ../../user/apps/office/texlive.nix + #../../user/apps/office/libreoffice-fresh.nix ../../user/shell/bash.nix ../../user/wm/xmonad/xmonad.nix ]; diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..1c16f87 --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,11 @@ +{ config, pkgs, lib, ... }: +{ + nixpkgs.overlays = [ + (final: prev: { + qemu_full = prev.qemu_full.override { + cephSupport = false; + xenSupport = false; + }; + }) + ]; +} diff --git a/pkgs/badlion-client/badlion-client.nix b/pkgs/badlion-client/badlion-client.nix new file mode 100644 index 0000000..a3a431c --- /dev/null +++ b/pkgs/badlion-client/badlion-client.nix @@ -0,0 +1,34 @@ +{ lib, fetchurl, appimageTools }: + +let + pname = "badlion-client"; + version = "4.4.1"; + + src = fetchurl { + name = "badlion-client-linux"; + # https://www.badlion.net/download/client/latest/linux + url = "https://client-updates-cdn77.badlion.net/BadlionClient"; + hash = "sha256-lyu0WQtkevCduGb5Hw5D79CekoHTQiKHvofnqS57mVU="; + }; + + appimageContents = appimageTools.extract { inherit pname version src; }; +in + appimageTools.wrapType2 rec { + inherit pname version src; + + extraInstallCommands = '' + install -Dm444 ${appimageContents}/BadlionClient.desktop $out/share/applications/BadlionClient.desktop + install -Dm444 ${appimageContents}/BadlionClient.png $out/share/pixmaps/BadlionClient.png + substituteInPlace $out/share/applications/BadlionClient.desktop \ + --replace 'Exec=AppRun --no-sandbox %U' 'Exec=badlion-client' + ''; + + meta = with lib; { + description = "Most Complete All-In-One Mod Library for Minecraft with 100+ Mods, FPS Improvements, and more"; + homepage = "https://client.badlion.net"; + license = with licenses; [ unfree ]; + maintainers = [ ]; + mainProgram = "badlion-client"; + platforms = [ "x86_64-linux" ]; + }; + } diff --git a/pkgs/badlion-client/default.nix b/pkgs/badlion-client/default.nix new file mode 100644 index 0000000..3afd0cf --- /dev/null +++ b/pkgs/badlion-client/default.nix @@ -0,0 +1,4 @@ +let + pkgs = import { }; +in + pkgs.callPackage ./badlion-client.nix { } diff --git a/pkgs/zen-browser/default.nix b/pkgs/zen-browser/default.nix new file mode 100644 index 0000000..3f5b27c --- /dev/null +++ b/pkgs/zen-browser/default.nix @@ -0,0 +1,7 @@ +let + nixpkgs = fetchTarball "https://github.com/NixOS/nixpkgs/tarball/nixos-24.11"; + pkgs = import nixpkgs { config = {}; overlays = []; }; +in +{ + zen-browser = pkgs.callPackage ./zen-browser.nix { }; +} diff --git a/pkgs/zen-browser/zen-browser.nix b/pkgs/zen-browser/zen-browser.nix new file mode 100644 index 0000000..dc255dd --- /dev/null +++ b/pkgs/zen-browser/zen-browser.nix @@ -0,0 +1,21 @@ +{ lib, stdenv, ... }: +let + version = "1.7b"; +in +stdenv.mkDerivation { + pname="zen-browser"; + inherit version; + + src = fetchTarball { + url = "https://github.com/zen-browser/desktop/releases/download/${version}/zen.linux-x86_64.tar.bz2"; + sha256 = "0aig890fcynxwi7xi8jzd1w2gzg47n0jqfq76wvnkwcam611b2bp"; + }; + + dontPatch = true; + dontConfigure = true; + dontBuild = true; + + installPhase = '' + cp -r . $out + ''; +} diff --git a/system/audio/default.nix b/system/audio/default.nix new file mode 100644 index 0000000..355cf4b --- /dev/null +++ b/system/audio/default.nix @@ -0,0 +1,23 @@ +{ pkgs, ... }: +{ + services.pulseaudio = { + support32Bit = true; + daemon.config = { + flat-volumes = "yes"; + }; + package = pkgs.pulseaudioFull; + }; + + security.rtkit.enable = true; + #services.pipewire = { + # enable = true; + # alsa.enable = true; + # alsa.support32Bit = true; + # pulse.enable = true; + # jack.enable = true; + #}; + + environment.systemPackages = with pkgs; [ + alsa-utils + ]; +} diff --git a/system/hardware/bluetooth.nix b/system/bluetooth/default.nix similarity index 100% rename from system/hardware/bluetooth.nix rename to system/bluetooth/default.nix diff --git a/system/default.nix b/system/default.nix new file mode 100644 index 0000000..3ecfc33 --- /dev/null +++ b/system/default.nix @@ -0,0 +1,19 @@ +{ pkgs, ... }: { + imports = [ + ./audio + ./bluetooth + ./inputMethods + ./kernel + ./locale + ./network + ./nix + ./opengl + ./time + ./users + ./services + ./vnc + ./wm + ./env.nix + ./utils.nix + ]; +} diff --git a/system/env.nix b/system/env.nix index 72c9fb0..0d594f7 100644 --- a/system/env.nix +++ b/system/env.nix @@ -1,7 +1,6 @@ -{ config, lib, pkgs, ... }: +{ ... }: { environment.variables = { EDITOR = "vim"; - MOZ_ENABLE_WAYLAND = 1; }; } diff --git a/system/hardware/audio.nix b/system/hardware/audio.nix deleted file mode 100644 index fa3ebc3..0000000 --- a/system/hardware/audio.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ ... }: -{ - #hardware.pulseaudio.enable = true; - - security.rtkit.enable = true; - services.pipewire = { - enable = true; - alsa.enable = true; - alsa.support32Bit = true; - pulse.enable = true; - jack.enable = true; - }; -} diff --git a/system/hardware/time.nix b/system/hardware/time.nix deleted file mode 100644 index 44b1f23..0000000 --- a/system/hardware/time.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ ... }: -{ - services.timesyncd.enable = true; -} diff --git a/system/hardware/inputMethods.nix b/system/inputMethods/default.nix similarity index 72% rename from system/hardware/inputMethods.nix rename to system/inputMethods/default.nix index 1597553..1b51ac5 100644 --- a/system/hardware/inputMethods.nix +++ b/system/inputMethods/default.nix @@ -7,7 +7,10 @@ fcitx5 = { waylandFrontend = true; plasma6Support = true; - addons = with pkgs; [ fcitx5-mozc fcitx5-skk ]; + addons = with pkgs; [ + fcitx5-mozc + fcitx5-skk + ]; }; }; }; diff --git a/system/hardware/kernel.nix b/system/kernel/default.nix similarity index 100% rename from system/hardware/kernel.nix rename to system/kernel/default.nix diff --git a/system/locale/default.nix b/system/locale/default.nix new file mode 100644 index 0000000..1b7330a --- /dev/null +++ b/system/locale/default.nix @@ -0,0 +1,14 @@ +{ systemSettings, ... }: { + i18n.defaultLocale = systemSettings.locale; + i18n.extraLocaleSettings = { + LC_ADDRESS = systemSettings.locale; + LC_IDENTIFICATION = systemSettings.locale; + LC_MEASUREMENT = systemSettings.locale; + LC_MONETARY = systemSettings.locale; + LC_NAME = systemSettings.locale; + LC_NUMERIC = systemSettings.locale; + LC_PAPER = systemSettings.locale; + LC_TELEPHONE = systemSettings.locale; + LC_TIME = systemSettings.locale; + }; +} diff --git a/system/network/default.nix b/system/network/default.nix new file mode 100644 index 0000000..2e360a9 --- /dev/null +++ b/system/network/default.nix @@ -0,0 +1,9 @@ +{ systemSettings, ... }: +{ + networking = { + hostName = systemSettings.hostname; + networkmanager.enable = true; + firewall.enable = true; + }; + systemd.services.NetworkManager-wait-online.enable = false; +} diff --git a/system/nix/default.nix b/system/nix/default.nix new file mode 100644 index 0000000..497ec64 --- /dev/null +++ b/system/nix/default.nix @@ -0,0 +1,34 @@ +{ ... }: { + nix = { + gc.automatic = false; + + settings = { + auto-optimise-store = true; + builders-use-substitutes = true; + allowed-users = ["@wheel"]; + trusted-users = ["@wheel"]; + commit-lockfile-summary = "Update flake.lock"; + accept-flake-config = true; + keep-derivations = true; + keep-outputs = true; + warn-dirty = false; + sandbox = true; + max-jobs = "auto"; + log-lines = 30; + experimental-features = [ "nix-command" "flakes" ]; + substituters = [ + "https://cache.nixos.org" + ]; + trusted-public-keys = [ + "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + ]; + }; + }; + + nixpkgs = { + config = { + allowUnfree = true; + allowBroken = true; + }; + }; +} diff --git a/system/hardware/nvidia.nix b/system/nvidia/default.nix similarity index 94% rename from system/hardware/nvidia.nix rename to system/nvidia/default.nix index 015dfb2..20fcea6 100644 --- a/system/hardware/nvidia.nix +++ b/system/nvidia/default.nix @@ -6,8 +6,8 @@ modesetting.enable = true; powerManagement.enable = false; powerManagement.finegrained = false; - open = true; nvidiaSettings = true; + open = false; package = config.boot.kernelPackages.nvidiaPackages.production; }; } diff --git a/system/hardware/opengl.nix b/system/opengl/default.nix similarity index 100% rename from system/hardware/opengl.nix rename to system/opengl/default.nix diff --git a/system/services/cups.nix b/system/services/cups/default.nix similarity index 100% rename from system/services/cups.nix rename to system/services/cups/default.nix diff --git a/system/services/default.nix b/system/services/default.nix new file mode 100644 index 0000000..82542f8 --- /dev/null +++ b/system/services/default.nix @@ -0,0 +1,13 @@ +{ ... }: { + imports = [ + ./cups + ./docker + ./flatpak + ./libvirtd + ./podman + ./polkit + ./ssh + ./steam + ./tailscale + ]; +} diff --git a/system/services/docker.nix b/system/services/docker/default.nix similarity index 71% rename from system/services/docker.nix rename to system/services/docker/default.nix index 0c5ae6a..f1671f3 100644 --- a/system/services/docker.nix +++ b/system/services/docker/default.nix @@ -15,8 +15,5 @@ docker docker-compose docker-buildx - nvidia-container-toolkit ]; - - hardware.nvidia-container-toolkit.enable = lib.lists.elem "nvidia" config.services.xserver.videoDrivers; } diff --git a/system/services/flatpak.nix b/system/services/flatpak/default.nix similarity index 100% rename from system/services/flatpak.nix rename to system/services/flatpak/default.nix diff --git a/system/services/libvirtd.nix b/system/services/libvirtd/default.nix similarity index 100% rename from system/services/libvirtd.nix rename to system/services/libvirtd/default.nix diff --git a/system/services/network-manager.nix b/system/services/network-manager.nix deleted file mode 100644 index 47fea2e..0000000 --- a/system/services/network-manager.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ ... }: -{ - networking.networkmanager.enable = true; - systemd.network.wait-online.enable = false; -} diff --git a/system/services/podman.nix b/system/services/podman/default.nix similarity index 63% rename from system/services/podman.nix rename to system/services/podman/default.nix index 2572883..03d2b54 100644 --- a/system/services/podman.nix +++ b/system/services/podman/default.nix @@ -4,8 +4,8 @@ virtualisation.podman = { enable = true; - dockerCompat = true; - dockerSocket.enable = true; + dockerCompat = false; + dockerSocket.enable = false; defaultNetwork.settings.dns_enabled = true; }; @@ -16,5 +16,5 @@ podman-compose ]; - hardware.nvidia-container-toolkit.enable = lib.lists.elem "nvidia" config.services.xserver.videoDrivers; + hardware.nvidia-container-toolkit.enable = true; } diff --git a/system/services/polkit.nix b/system/services/polkit/default.nix similarity index 100% rename from system/services/polkit.nix rename to system/services/polkit/default.nix diff --git a/system/services/ssh.nix b/system/services/ssh/default.nix similarity index 100% rename from system/services/ssh.nix rename to system/services/ssh/default.nix diff --git a/system/services/steam.nix b/system/services/steam/default.nix similarity index 100% rename from system/services/steam.nix rename to system/services/steam/default.nix diff --git a/system/services/tailscale.nix b/system/services/tailscale/default.nix similarity index 100% rename from system/services/tailscale.nix rename to system/services/tailscale/default.nix diff --git a/system/time/default.nix b/system/time/default.nix new file mode 100644 index 0000000..3e9ccbb --- /dev/null +++ b/system/time/default.nix @@ -0,0 +1,6 @@ +{ systemSettings, ... }: +{ + time.timeZone = systemSettings.timezone; + + services.timesyncd.enable = true; +} diff --git a/system/users/default.nix b/system/users/default.nix new file mode 100644 index 0000000..53ca5b0 --- /dev/null +++ b/system/users/default.nix @@ -0,0 +1,40 @@ +{ pkgs, config, userSettings, ... }: { + users.users.${userSettings.username} = { + isNormalUser = true; + description = userSettings.name; + extraGroups = [ + "networkmanager" + "wheel" + "docker" + "podman" + "input" + "flatpak" + "dialout" + "video" + "audio" + "libvirtd" + "nix" + "power" + "docker" + ]; + uid = 1000; + homix = true; + }; + + users.defaultUserShell = pkgs.bash; + + security.sudo = { + enable = true; + extraRules = [ + { + commands = + builtins.map (command: { + command = "/run/current-system/sw/bin/${command}"; + options = ["NOPASSWD"]; + }) + [ "poweroff" "reboot" "nixos-rebuild" "systemctl" "nmtui" "tailscale" ]; + groups = [ "wheel" ]; + } + ]; + }; +} diff --git a/system/vnc/default.nix b/system/vnc/default.nix new file mode 100644 index 0000000..3abc274 --- /dev/null +++ b/system/vnc/default.nix @@ -0,0 +1,11 @@ +{ pkgs, lib, ... }: +let + use-vnc = pkgs.callPackage ./use-vnc-script.nix { }; +in +{ + environment.systemPackages = with pkgs; [ + x11vnc + wayvnc + use-vnc + ]; +} diff --git a/system/vnc/use-vnc-script.nix b/system/vnc/use-vnc-script.nix new file mode 100644 index 0000000..85821d1 --- /dev/null +++ b/system/vnc/use-vnc-script.nix @@ -0,0 +1,10 @@ +{ pkgs, lib, ... }: +pkgs.writeShellScriptBin "use-vnc" '' + if [[ $XDG_SESSION_TYPE == "x11" ]]; then + x11vnc -display :0 & + else + wayvnc 0.0.0.0 & + fi + + sudo echo $! > /var/run/use-vnc.pid + '' diff --git a/system/wm/dbus.nix b/system/wm/dbus/default.nix similarity index 100% rename from system/wm/dbus.nix rename to system/wm/dbus/default.nix diff --git a/system/wm/default.nix b/system/wm/default.nix new file mode 100644 index 0000000..95414fa --- /dev/null +++ b/system/wm/default.nix @@ -0,0 +1,11 @@ +{ ... }: { + imports = [ + ./dbus + ./fonts + ./gnome-keyring + ./plasma + ./sddm + ./sway + ./xmonad + ]; +} diff --git a/system/wm/fonts.nix b/system/wm/fonts/default.nix similarity index 100% rename from system/wm/fonts.nix rename to system/wm/fonts/default.nix diff --git a/system/wm/gnome-keyring.nix b/system/wm/gnome-keyring/default.nix similarity index 100% rename from system/wm/gnome-keyring.nix rename to system/wm/gnome-keyring/default.nix diff --git a/system/wm/plasma.nix b/system/wm/plasma/default.nix similarity index 93% rename from system/wm/plasma.nix rename to system/wm/plasma/default.nix index fa5577d..741e76d 100644 --- a/system/wm/plasma.nix +++ b/system/wm/plasma/default.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: { imports = [ - ./dbus.nix + ../dbus ]; services.desktopManager.plasma6.enable = true; diff --git a/system/wm/sddm.nix b/system/wm/sddm/default.nix similarity index 80% rename from system/wm/sddm.nix rename to system/wm/sddm/default.nix index 66b90ee..190fecc 100644 --- a/system/wm/sddm.nix +++ b/system/wm/sddm/default.nix @@ -1,12 +1,12 @@ { config, pkgs, lib, ... }: { imports = [ - ./fonts.nix - ./dbus.nix - ./gnome-keyring.nix - ./xmonad.nix - ./sway.nix - ./plasma.nix + ../fonts + ../dbus + ../gnome-keyring + ../xmonad + ../sway + ../plasma ]; environment.systemPackages = with pkgs; [ diff --git a/system/wm/sway.nix b/system/wm/sway/default.nix similarity index 76% rename from system/wm/sway.nix rename to system/wm/sway/default.nix index 2ba9541..2c38215 100644 --- a/system/wm/sway.nix +++ b/system/wm/sway/default.nix @@ -1,8 +1,8 @@ { pkgs, lib, config, ... }: { imports = [ - ./gnome-keyring.nix - ./dbus.nix + ../gnome-keyring + ../dbus ]; programs.sway = { diff --git a/system/wm/xmonad.nix b/system/wm/xmonad/default.nix similarity index 87% rename from system/wm/xmonad.nix rename to system/wm/xmonad/default.nix index 67cb40a..729c662 100644 --- a/system/wm/xmonad.nix +++ b/system/wm/xmonad/default.nix @@ -1,4 +1,4 @@ -{ ... }: +{ pkgs, ... }: { services.xserver.windowManager.xmonad = { enable = true; diff --git a/user/README.md b/user/README.md new file mode 100644 index 0000000..074f0c9 --- /dev/null +++ b/user/README.md @@ -0,0 +1,3 @@ +* `packages`: packages that have zero to few configs and do not require any wrapping +* `wrapped`: packages that is wrapped with extensive config +* `homed`: packages that has configuration on common home directory. diff --git a/user/apps/browsers/chromium.nix b/user/apps/browsers/chromium.nix deleted file mode 100644 index 8627ff7..0000000 --- a/user/apps/browsers/chromium.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - chromium - ]; -} diff --git a/user/apps/browsers/firefox.nix b/user/apps/browsers/firefox.nix deleted file mode 100644 index 0674f5f..0000000 --- a/user/apps/browsers/firefox.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, config, ... }: -{ - home.packages = [ pkgs.firefox ]; -} diff --git a/user/apps/games/mangohud.nix b/user/apps/games/mangohud.nix deleted file mode 100644 index 37b2002..0000000 --- a/user/apps/games/mangohud.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - mangohud - ]; -} diff --git a/user/apps/graphics/gimp.nix b/user/apps/graphics/gimp.nix deleted file mode 100644 index 62b832a..0000000 --- a/user/apps/graphics/gimp.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - gimp - ]; -} diff --git a/user/apps/graphics/inkscape.nix b/user/apps/graphics/inkscape.nix deleted file mode 100644 index ebfac2b..0000000 --- a/user/apps/graphics/inkscape.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - inkscape - ]; -} diff --git a/user/apps/media/vlc.nix b/user/apps/media/vlc.nix deleted file mode 100644 index 2cdf857..0000000 --- a/user/apps/media/vlc.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - vlc - ]; -} diff --git a/user/apps/media/yt-dlp.nix b/user/apps/media/yt-dlp.nix deleted file mode 100644 index 7ea6ec0..0000000 --- a/user/apps/media/yt-dlp.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - yt-dlp - ]; -} diff --git a/user/apps/office/texlive.nix b/user/apps/office/texlive.nix deleted file mode 100644 index 8c08d65..0000000 --- a/user/apps/office/texlive.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ pkgs, ... }: -let - mytex = pkgs.texliveMedium.withPackages - (ps: [ - ps.biber - ps.biblatex - ps.bibtex - ps.import - ps.subfiles - ps.wrapfig - ps.collection-langjapanese - ]); -in -{ - home.packages = with pkgs; [ - mytex - pandoc - qpdf - ]; -} diff --git a/user/apps/thunderbird.nix b/user/apps/thunderbird.nix deleted file mode 100644 index 4b202ab..0000000 --- a/user/apps/thunderbird.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - thunderbird - ]; -} diff --git a/user/apps/utils/alacritty.nix b/user/apps/utils/alacritty.nix deleted file mode 100644 index a68e475..0000000 --- a/user/apps/utils/alacritty.nix +++ /dev/null @@ -1,10 +0,0 @@ -{ pkgs, lib, ... }: -{ - home.packages = with pkgs; [ - alacritty - ]; - programs.alacritty.enable = true; - programs.alacritty.settings = { - window.opacity = lib.mkForce 0.85; - }; -} diff --git a/user/apps/utils/cava.nix b/user/apps/utils/cava.nix deleted file mode 100644 index 50b4808..0000000 --- a/user/apps/utils/cava.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - cava - ]; -} diff --git a/user/apps/utils/fzf.nix b/user/apps/utils/fzf.nix deleted file mode 100644 index 8a29408..0000000 --- a/user/apps/utils/fzf.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - fzf - ]; -} diff --git a/user/apps/utils/keepassxc.nix b/user/apps/utils/keepassxc.nix deleted file mode 100644 index 0f52cf5..0000000 --- a/user/apps/utils/keepassxc.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - keepassxc - ]; -} diff --git a/user/apps/utils/zoxide.nix b/user/apps/utils/zoxide.nix deleted file mode 100644 index e60015d..0000000 --- a/user/apps/utils/zoxide.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - zoxide - ]; -} diff --git a/user/default.nix b/user/default.nix new file mode 100644 index 0000000..cbbf1c0 --- /dev/null +++ b/user/default.nix @@ -0,0 +1,7 @@ +{ ... }: { + imports = [ + ./packages + ./homed + ./wrapped + ]; +} diff --git a/user/dev/ide/qtcreator.nix b/user/dev/ide/qtcreator.nix deleted file mode 100644 index 014f538..0000000 --- a/user/dev/ide/qtcreator.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = [ pkgs.qtcreator ]; -} diff --git a/user/dev/lang/ecmascript.nix b/user/dev/lang/ecmascript.nix index 54e1d04..1c3168c 100644 --- a/user/dev/lang/ecmascript.nix +++ b/user/dev/lang/ecmascript.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { home.packages = with pkgs; [ - nodejs_20 + nodejs_22 ]; } diff --git a/user/dev/lang/python.nix b/user/dev/lang/python.nix index 1c30ab1..320e94b 100644 --- a/user/dev/lang/python.nix +++ b/user/dev/lang/python.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { home.packages = with pkgs; [ - python3Full + python313Full ]; } diff --git a/user/dev/tools/dbeaver-bin.nix b/user/dev/tools/dbeaver-bin.nix deleted file mode 100644 index 813a399..0000000 --- a/user/dev/tools/dbeaver-bin.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - dbeaver-bin - ]; -} diff --git a/user/dev/tools/firefox-devedition.nix b/user/dev/tools/firefox-devedition.nix deleted file mode 100644 index 746c146..0000000 --- a/user/dev/tools/firefox-devedition.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - firefox-devedition-bin - ]; -} diff --git a/user/apps/media/mpv.nix b/user/dev/tools/gh.nix similarity index 87% rename from user/apps/media/mpv.nix rename to user/dev/tools/gh.nix index 477a6db..063021c 100644 --- a/user/apps/media/mpv.nix +++ b/user/dev/tools/gh.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { home.packages = with pkgs; [ - mpv + gh ]; } diff --git a/user/dev/tools/gitui.nix b/user/dev/tools/gitui.nix deleted file mode 100644 index 985aa4a..0000000 --- a/user/dev/tools/gitui.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - gitui - ]; -} diff --git a/user/dev/tools/tldr.nix b/user/dev/tools/tldr.nix deleted file mode 100644 index 7dbfdac..0000000 --- a/user/dev/tools/tldr.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - tldr - ]; -} diff --git a/user/homed/default.nix b/user/homed/default.nix new file mode 100644 index 0000000..97fcf96 --- /dev/null +++ b/user/homed/default.nix @@ -0,0 +1,8 @@ +{ ... }: +{ + imports = [ + ./git + ./profile + ./xmonad + ]; +} diff --git a/user/homed/git/default.nix b/user/homed/git/default.nix new file mode 100644 index 0000000..4cafe7a --- /dev/null +++ b/user/homed/git/default.nix @@ -0,0 +1,19 @@ +{ config, pkgs, userSettings, ... }: +{ + environment.systemPackages = with pkgs; [ + git + gh + ]; + + homix.".gitconfig".text = '' + [user] + email = ${userSettings.email-dev} + name = ${userSettings.name} + [credential "https://github.com"] + helper = + helper = ${pkgs.gh}/bin/gh auth git-credential + [credential "https://gist.github.com"] + helper = + helper = ${pkgs.gh}/bin/gh auth git-credential + ''; +} diff --git a/user/homed/profile/default.nix b/user/homed/profile/default.nix new file mode 100644 index 0000000..4e52151 --- /dev/null +++ b/user/homed/profile/default.nix @@ -0,0 +1,4 @@ +{ config, ... }: +{ + homix.".profile".source = ./profile; +} diff --git a/user/.profile b/user/homed/profile/profile similarity index 100% rename from user/.profile rename to user/homed/profile/profile diff --git a/user/homed/xmonad/default.nix b/user/homed/xmonad/default.nix new file mode 100644 index 0000000..d4dfa0c --- /dev/null +++ b/user/homed/xmonad/default.nix @@ -0,0 +1,18 @@ +{ config, pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + xmobar + dunst + networkmanagerapplet + rofi + feh + pavucontrol + xorg.xkill + xdg-utils + xdg-desktop-portal + xdg-desktop-portal-gtk + ]; + + homix.".config/xmonad/xmonad.hs".source = ./xmonad.hs; + homix.".config/xmobar/xmobarrc".source = ./xmobarrc; +} diff --git a/user/homed/xmonad/xmobarrc b/user/homed/xmonad/xmobarrc new file mode 100644 index 0000000..64ebcc9 --- /dev/null +++ b/user/homed/xmonad/xmobarrc @@ -0,0 +1,33 @@ +Config { + font = "IPAGothic 9", + bgColor = "black", + fgColor = "#646464", + position = Top, + border = BottomB, + borderColor = "#646464", + + sepChar = "%", + alignSep = "}{", + template = "%multicpu% | %coretemp% | %memory% | %dynnetwork% }{ %date%", + + lowerOnStart = True, + hideOnStart = False, + allDesktops = True, + overrideRedirect = True, + pickBroadest = False, + persistent = True, + + commands = + [ + Run DynNetwork [ "--template", ": kB/s|kB/s", + "--Low", "1000", -- units: B/s + "--High", "5000", -- units: B/s + "--low", "darkgreen", + "--normal", "darkorange", + "--high", "darkred" ] 10, + + Run MultiCpu [ + "--template", "Cpu: C|C" + ] 10, + ] +} diff --git a/user/homed/xmonad/xmonad.hs b/user/homed/xmonad/xmonad.hs new file mode 100644 index 0000000..4d822a7 --- /dev/null +++ b/user/homed/xmonad/xmonad.hs @@ -0,0 +1,335 @@ +-- +-- xmonad example config file. +-- +-- A template showing all available configuration hooks, +-- and how to override the defaults in your own xmonad.hs conf file. +-- +-- Normally, you'd only override those defaults you care about. +-- + +import XMonad +import XMonad.Hooks.DynamicLog +import Data.Monoid +import System.Exit + +import qualified XMonad.StackSet as W +import qualified Data.Map as M + +-- The preferred terminal program, which is used in a binding below and by +-- certain contrib modules. +-- +myTerminal = "alacritty" + +-- Whether focus follows the mouse pointer. +myFocusFollowsMouse :: Bool +myFocusFollowsMouse = True + +-- Whether clicking on a window to focus also passes the click to the window +myClickJustFocuses :: Bool +myClickJustFocuses = False + +-- Width of the window border in pixels. +-- +myBorderWidth = 1 + +-- modMask lets you specify which modkey you want to use. The default +-- is mod1Mask ("left alt"). You may also consider using mod3Mask +-- ("right alt"), which does not conflict with emacs keybindings. The +-- "windows key" is usually mod4Mask. +-- +myModMask = mod4Mask + +-- The default number of workspaces (virtual screens) and their names. +-- By default we use numeric strings, but any string may be used as a +-- workspace name. The number of workspaces is determined by the length +-- of this list. +-- +-- A tagging example: +-- +-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] +-- +myWorkspaces = ["term", "web", "code", "debug", "docs"] ++ map show [6..9] + +-- Border colors for unfocused and focused windows, respectively. +-- +myNormalBorderColor = "#dddddd" +myFocusedBorderColor = "#ff0000" + +------------------------------------------------------------------------ +-- Key bindings. Add, modify or remove key bindings here. +-- +myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ + + -- launch a terminal + [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) + + -- launch dmenu + , ((modm, xK_p ), spawn "rofi -show drun") + + -- close focused window + , ((modm .|. shiftMask, xK_c ), kill) + + -- Rotate through the available layout algorithms + , ((modm, xK_space ), sendMessage NextLayout) + + -- Reset the layouts on the current workspace to default + , ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf) + + -- Resize viewed windows to the correct size + , ((modm, xK_n ), refresh) + + -- Move focus to the next window + , ((modm, xK_Tab ), windows W.focusDown) + + -- Move focus to the next window + , ((modm, xK_j ), windows W.focusDown) + + -- Move focus to the previous window + , ((modm, xK_k ), windows W.focusUp ) + + -- Move focus to the master window + , ((modm, xK_m ), windows W.focusMaster ) + + -- Swap the focused window and the master window + , ((modm, xK_Return), windows W.swapMaster) + + -- Swap the focused window with the next window + , ((modm .|. shiftMask, xK_j ), windows W.swapDown ) + + -- Swap the focused window with the previous window + , ((modm .|. shiftMask, xK_k ), windows W.swapUp ) + + -- Shrink the master area + , ((modm, xK_h ), sendMessage Shrink) + + -- Expand the master area + , ((modm, xK_l ), sendMessage Expand) + + -- Push window back into tiling + , ((modm, xK_t ), withFocused $ windows . W.sink) + + -- Increment the number of windows in the master area + , ((modm , xK_comma ), sendMessage (IncMasterN 1)) + + -- Deincrement the number of windows in the master area + , ((modm , xK_period), sendMessage (IncMasterN (-1))) + + -- Toggle the status bar gap + -- Use this binding with avoidStruts from Hooks.ManageDocks. + -- See also the statusBar function from Hooks.DynamicLog. + -- + -- , ((modm , xK_b ), sendMessage ToggleStruts) + + -- Quit xmonad + , ((modm .|. shiftMask, xK_q ), io exitSuccess) + + -- Restart xmonad + , ((modm , xK_q ), spawn "xmonad --recompile; xmonad --restart") + + -- Run xmessage with a summary of the default keybindings (useful for beginners) + , ((modm .|. shiftMask, xK_slash ), xmessage help) + ] + ++ + + -- + -- mod-[1..9], Switch to workspace N + -- mod-shift-[1..9], Move client to workspace N + -- + [((m .|. modm, k), windows $ f i) + | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9] + , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]] + ++ + + -- + -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3 + -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3 + -- + [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f)) + | (key, sc) <- zip [xK_w, xK_e, xK_r] [0..] + , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]] + + +------------------------------------------------------------------------ +-- Mouse bindings: default actions bound to mouse events +-- +myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList + + -- mod-button1, Set the window to floating mode and move by dragging + [ ((modm, button1), \w -> focus w >> mouseMoveWindow w + >> windows W.shiftMaster) + + -- mod-button2, Raise the window to the top of the stack + , ((modm, button2), \w -> focus w >> windows W.shiftMaster) + + -- mod-button3, Set the window to floating mode and resize by dragging + , ((modm, button3), \w -> focus w >> mouseResizeWindow w + >> windows W.shiftMaster) + + -- you may also bind events to the mouse scroll wheel (button4 and button5) + ] + +------------------------------------------------------------------------ +-- Layouts: + +-- You can specify and transform your layouts by modifying these values. +-- If you change layout bindings be sure to use 'mod-shift-space' after +-- restarting (with 'mod-q') to reset your layout state to the new +-- defaults, as xmonad preserves your old layout settings by default. +-- +-- The available layouts. Note that each layout is separated by |||, +-- which denotes layout choice. +-- +myLayout = tiled ||| Mirror tiled ||| Full + where + -- default tiling algorithm partitions the screen into two panes + tiled = Tall nmaster delta ratio + + -- The default number of windows in the master pane + nmaster = 1 + + -- Default proportion of screen occupied by master pane + ratio = 1/2 + + -- Percent of screen to increment by when resizing panes + delta = 3/100 + +------------------------------------------------------------------------ +-- Window rules: + +-- Execute arbitrary actions and WindowSet manipulations when managing +-- a new window. You can use this to, for example, always float a +-- particular program, or have a client always appear on a particular +-- workspace. +-- +-- To find the property name associated with a program, use +-- > xprop | grep WM_CLASS +-- and click on the client you're interested in. +-- +-- To match on the WM_NAME, you can use 'title' in the same way that +-- 'className' and 'resource' are used below. +-- +myManageHook = composeAll + [ className =? "MPlayer" --> doFloat + , className =? "Gimp" --> doFloat + , resource =? "desktop_window" --> doIgnore + , resource =? "kdesktop" --> doIgnore ] + +------------------------------------------------------------------------ +-- Event handling + +-- * EwmhDesktops users should change this to ewmhDesktopsEventHook +-- +-- Defines a custom handler function for X Events. The function should +-- return (All True) if the default handler is to be run afterwards. To +-- combine event hooks use mappend or mconcat from Data.Monoid. +-- +myEventHook = mempty + +------------------------------------------------------------------------ +-- Status bars and logging + +-- Perform an arbitrary action on each internal state change or X event. +-- See the 'XMonad.Hooks.DynamicLog' extension for examples. +-- +myLogHook = return () + +------------------------------------------------------------------------ +-- Startup hook + +-- Perform an arbitrary action each time xmonad starts or is restarted +-- with mod-q. Used by, e.g., XMonad.Layout.PerWorkspace to initialize +-- per-workspace layout choices. +-- +-- By default, do nothing. +myStartupHook = do + spawn "feh --bg-scale ~/画像/wallpaper/85444653_p0.jpg" + +------------------------------------------------------------------------ +-- Now run xmonad with all the defaults we set up. + +-- Run xmonad with the settings you specify. No need to modify this. +-- +main :: IO() +main = do + xmobar myConfig >>= xmonad + +-- A structure containing your configuration settings, overriding +-- fields in the default config. Any you don't override, will +-- use the defaults defined in xmonad/XMonad/Config.hs +-- +-- No need to modify this. +-- +myConfig = def { + -- simple stuff + terminal = myTerminal, + focusFollowsMouse = myFocusFollowsMouse, + clickJustFocuses = myClickJustFocuses, + borderWidth = myBorderWidth, + modMask = myModMask, + workspaces = myWorkspaces, + normalBorderColor = myNormalBorderColor, + focusedBorderColor = myFocusedBorderColor, + + -- key bindings + keys = myKeys, + mouseBindings = myMouseBindings, + + -- hooks, layouts + layoutHook = myLayout, + manageHook = myManageHook, + handleEventHook = myEventHook, + logHook = myLogHook, + startupHook = myStartupHook + } + +-- | Finally, a copy of the default bindings in simple textual tabular format. +help :: String +help = unlines ["The default modifier key is 'alt'. Default keybindings:", + "", + "-- launching and killing programs", + "mod-Shift-Enter Launch xterminal", + "mod-p Launch dmenu", + "mod-Shift-p Launch gmrun", + "mod-Shift-c Close/kill the focused window", + "mod-Space Rotate through the available layout algorithms", + "mod-Shift-Space Reset the layouts on the current workSpace to default", + "mod-n Resize/refresh viewed windows to the correct size", + "mod-Shift-/ Show this help message with the default keybindings", + "", + "-- move focus up or down the window stack", + "mod-Tab Move focus to the next window", + "mod-Shift-Tab Move focus to the previous window", + "mod-j Move focus to the next window", + "mod-k Move focus to the previous window", + "mod-m Move focus to the master window", + "", + "-- modifying the window order", + "mod-Return Swap the focused window and the master window", + "mod-Shift-j Swap the focused window with the next window", + "mod-Shift-k Swap the focused window with the previous window", + "", + "-- resizing the master/slave ratio", + "mod-h Shrink the master area", + "mod-l Expand the master area", + "", + "-- floating layer support", + "mod-t Push window back into tiling; unfloat and re-tile it", + "", + "-- increase or decrease number of windows in the master area", + "mod-comma (mod-,) Increment the number of windows in the master area", + "mod-period (mod-.) Deincrement the number of windows in the master area", + "", + "-- quit, or restart", + "mod-Shift-q Quit xmonad", + "mod-q Restart xmonad", + "mod-[1..9] Switch to workSpace N", + "", + "-- Workspaces & screens", + "mod-Shift-[1..9] Move client to workspace N", + "mod-{w,e,r} Switch to physical/Xinerama screens 1, 2, or 3", + "mod-Shift-{w,e,r} Move client to screen 1, 2, or 3", + "", + "-- Mouse bindings: default actions bound to mouse events", + "mod-button1 Set the window to floating mode and move by dragging", + "mod-button2 Raise the window to the top of the stack", + "mod-button3 Set the window to floating mode and resize by dragging"] diff --git a/user/packages/cava/default.nix b/user/packages/cava/default.nix new file mode 100644 index 0000000..41d0f1c --- /dev/null +++ b/user/packages/cava/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + cava + ]; +} diff --git a/user/packages/chromium/default.nix b/user/packages/chromium/default.nix new file mode 100644 index 0000000..4f8a3b4 --- /dev/null +++ b/user/packages/chromium/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + chromium + ]; +} diff --git a/user/packages/dbeaver/default.nix b/user/packages/dbeaver/default.nix new file mode 100644 index 0000000..410c15a --- /dev/null +++ b/user/packages/dbeaver/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + dbeaver-bin + ]; +} diff --git a/user/packages/default.nix b/user/packages/default.nix new file mode 100644 index 0000000..1f1889b --- /dev/null +++ b/user/packages/default.nix @@ -0,0 +1,29 @@ +{ ... }: { + imports = [ + ./cava + ./chromium + ./dbeaver + ./firefox + ./firefox-dev-edition + ./freecad + ./fzf + ./gimp + ./gitui + ./inkscape + ./kdenlive + ./keepassxc + ./kicad + ./libreoffice-fresh + ./mangohud + ./mpv + ./obs-studio + ./owncloud-client + ./pandoc + ./qtcreator + ./thunderbird + ./tldr + ./vlc + ./yt-dlp + ./zoxide + ]; +} diff --git a/user/packages/firefox-dev-edition/default.nix b/user/packages/firefox-dev-edition/default.nix new file mode 100644 index 0000000..ac7ab23 --- /dev/null +++ b/user/packages/firefox-dev-edition/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + firefox-devedition-bin + ]; + + environment.variables = { + MOZ_ENABLE_WAYLAND = 1; + }; +} diff --git a/user/packages/firefox/default.nix b/user/packages/firefox/default.nix new file mode 100644 index 0000000..8620ad7 --- /dev/null +++ b/user/packages/firefox/default.nix @@ -0,0 +1,10 @@ +{ pkgs, config, ... }: +{ + environment.systemPackages = with pkgs; [ + firefox + ]; + + environment.variables = { + MOZ_ENABLE_WAYLAND = 1; + }; +} diff --git a/user/packages/freecad/default.nix b/user/packages/freecad/default.nix new file mode 100644 index 0000000..f9236a8 --- /dev/null +++ b/user/packages/freecad/default.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: { + environment.systemPackages = [ pkgs.freecad ]; +} diff --git a/user/packages/fzf/default.nix b/user/packages/fzf/default.nix new file mode 100644 index 0000000..7c74be6 --- /dev/null +++ b/user/packages/fzf/default.nix @@ -0,0 +1,16 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + fzf + ]; + + environment.variables = { + FZF_ALT_C_OPTS = '' + --walker-skip .git,node_modules,target + --preview 'tree -C {}' + ''; + FZF_COMPLETION_OPTS = "--border --info=inline"; + FZF_COMPLETION_PATH_OPTS = "--walker file,dir,follow,hidden"; + FZF_COMPLETION_DIR_OPTS = "--walker dir,follow"; + }; +} diff --git a/user/packages/gimp/default.nix b/user/packages/gimp/default.nix new file mode 100644 index 0000000..5efee3d --- /dev/null +++ b/user/packages/gimp/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + gimp + ]; +} diff --git a/user/packages/gitui/default.nix b/user/packages/gitui/default.nix new file mode 100644 index 0000000..f435ba5 --- /dev/null +++ b/user/packages/gitui/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + gitui + ]; +} diff --git a/user/packages/inkscape/default.nix b/user/packages/inkscape/default.nix new file mode 100644 index 0000000..8ecb07b --- /dev/null +++ b/user/packages/inkscape/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + inkscape + ]; +} diff --git a/user/packages/kdenlive/default.nix b/user/packages/kdenlive/default.nix new file mode 100644 index 0000000..f34df14 --- /dev/null +++ b/user/packages/kdenlive/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + kdePackages.kdenlive + ]; +} diff --git a/user/packages/keepassxc/default.nix b/user/packages/keepassxc/default.nix new file mode 100644 index 0000000..d314f6a --- /dev/null +++ b/user/packages/keepassxc/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + keepassxc + ]; +} diff --git a/user/packages/kicad/default.nix b/user/packages/kicad/default.nix new file mode 100644 index 0000000..d0cbdc9 --- /dev/null +++ b/user/packages/kicad/default.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: { + environment.systemPackages = [ pkgs.kicad ]; +} diff --git a/user/packages/libreoffice-fresh/default.nix b/user/packages/libreoffice-fresh/default.nix new file mode 100644 index 0000000..11788b0 --- /dev/null +++ b/user/packages/libreoffice-fresh/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + libreoffice-fresh + ]; +} diff --git a/user/packages/mangohud/default.nix b/user/packages/mangohud/default.nix new file mode 100644 index 0000000..e1acfba --- /dev/null +++ b/user/packages/mangohud/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + mangohud + ]; +} diff --git a/user/packages/minecraft/default.nix b/user/packages/minecraft/default.nix new file mode 100644 index 0000000..f998e6e --- /dev/null +++ b/user/packages/minecraft/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + minecraft + ]; +} diff --git a/user/packages/mpv/default.nix b/user/packages/mpv/default.nix new file mode 100644 index 0000000..58642a0 --- /dev/null +++ b/user/packages/mpv/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + mpv + ]; +} diff --git a/user/packages/obs-studio/default.nix b/user/packages/obs-studio/default.nix new file mode 100644 index 0000000..fedd902 --- /dev/null +++ b/user/packages/obs-studio/default.nix @@ -0,0 +1,6 @@ +{ config, pkgs, libs, ... }: +{ + environment.systemPackages = with pkgs; [ + obs-studio + ]; +} diff --git a/user/apps/utils/owncloud-client.nix b/user/packages/owncloud-client/default.nix similarity index 50% rename from user/apps/utils/owncloud-client.nix rename to user/packages/owncloud-client/default.nix index 0f894f6..a98bf75 100644 --- a/user/apps/utils/owncloud-client.nix +++ b/user/packages/owncloud-client/default.nix @@ -1,6 +1,6 @@ { pkgs, ... }: { - home.packages = with pkgs; [ + environment.systemPackages = with pkgs; [ owncloud-client ]; } diff --git a/user/packages/pandoc/default.nix b/user/packages/pandoc/default.nix new file mode 100644 index 0000000..c3aff43 --- /dev/null +++ b/user/packages/pandoc/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + pandoc + ]; +} diff --git a/user/packages/qtcreator/default.nix b/user/packages/qtcreator/default.nix new file mode 100644 index 0000000..0e713f6 --- /dev/null +++ b/user/packages/qtcreator/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + qtcreator + ]; +} diff --git a/user/packages/thunderbird/default.nix b/user/packages/thunderbird/default.nix new file mode 100644 index 0000000..2b13462 --- /dev/null +++ b/user/packages/thunderbird/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + thunderbird + ]; +} diff --git a/user/packages/tldr/default.nix b/user/packages/tldr/default.nix new file mode 100644 index 0000000..0de0872 --- /dev/null +++ b/user/packages/tldr/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + tldr + ]; +} diff --git a/user/packages/vlc/default.nix b/user/packages/vlc/default.nix new file mode 100644 index 0000000..7550c1b --- /dev/null +++ b/user/packages/vlc/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + vlc + ]; +} diff --git a/user/packages/yt-dlp/default.nix b/user/packages/yt-dlp/default.nix new file mode 100644 index 0000000..55c828d --- /dev/null +++ b/user/packages/yt-dlp/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + yt-dlp + ]; +} diff --git a/user/packages/zoxide/default.nix b/user/packages/zoxide/default.nix new file mode 100644 index 0000000..231f77f --- /dev/null +++ b/user/packages/zoxide/default.nix @@ -0,0 +1,6 @@ +{ pkgs, ... }: +{ + environment.systemPackages = with pkgs; [ + zoxide + ]; +} diff --git a/user/profile.nix b/user/profile.nix deleted file mode 100644 index cf42340..0000000 --- a/user/profile.nix +++ /dev/null @@ -1,4 +0,0 @@ -{ config, ... }: -{ - home.file.".profile".source = ./.profile; -} diff --git a/user/shell/bash.nix b/user/shell/bash.nix deleted file mode 100644 index 97f0ec4..0000000 --- a/user/shell/bash.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ config, pkgs, ... }: -let - lsCmd = "eza -la --git -s type"; -in -{ - home.packages = with pkgs; [ - bash - ]; - - programs.bash = { - enable = true; - shellAliases = { - search-pkg = "nix search -I nixpkgs=flake:nixpkgs nixpkgs"; - newpkg = "bash ~/.dotfiles/newpkg.sh"; - rebuild = "sudo nixos-rebuild switch --flake '.#system'"; - update-flake = "nix flake update"; - l = lsCmd; - ls = lsCmd; - }; - }; -} diff --git a/user/userSettings.nix b/user/userSettings.nix new file mode 100644 index 0000000..f0baad5 --- /dev/null +++ b/user/userSettings.nix @@ -0,0 +1,5 @@ +{ + username = "kenryus"; + name = "Kenryu Shibata"; + email-dev = "kenryudev5894@gmail.com"; +} diff --git a/user/wm/xmonad/xmobarrc b/user/wm/xmonad/xmobarrc index fdd213b..64ebcc9 100644 --- a/user/wm/xmonad/xmobarrc +++ b/user/wm/xmonad/xmobarrc @@ -19,14 +19,12 @@ Config { commands = [ - Run DynNetwork [ - "--template", ": kB/s|kB/s", - "--Low", "1000" -- units: B/s, - "--High", "5000" -- units: B/s, + Run DynNetwork [ "--template", ": kB/s|kB/s", + "--Low", "1000", -- units: B/s + "--High", "5000", -- units: B/s "--low", "darkgreen", "--normal", "darkorange", - "--high", "darkred" - ] 10, + "--high", "darkred" ] 10, Run MultiCpu [ "--template", "Cpu: C|C" diff --git a/user/wm/xmonad/xmonad.hs b/user/wm/xmonad/xmonad.hs index a2c96f4..4d822a7 100644 --- a/user/wm/xmonad/xmonad.hs +++ b/user/wm/xmonad/xmonad.hs @@ -8,6 +8,7 @@ -- import XMonad +import XMonad.Hooks.DynamicLog import Data.Monoid import System.Exit @@ -36,7 +37,7 @@ myBorderWidth = 1 -- ("right alt"), which does not conflict with emacs keybindings. The -- "windows key" is usually mod4Mask. -- -myModMask = mod1Mask +myModMask = mod4Mask -- The default number of workspaces (virtual screens) and their names. -- By default we use numeric strings, but any string may be used as a @@ -47,7 +48,7 @@ myModMask = mod1Mask -- -- > workspaces = ["web", "irc", "code" ] ++ map show [4..9] -- -myWorkspaces = ["1","2","3","4","5","6","7","8","9"] +myWorkspaces = ["term", "web", "code", "debug", "docs"] ++ map show [6..9] -- Border colors for unfocused and focused windows, respectively. -- @@ -63,10 +64,7 @@ myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $ [ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- launch dmenu - , ((modm, xK_p ), spawn "dmenu_run") - - -- launch gmrun - , ((modm .|. shiftMask, xK_p ), spawn "gmrun") + , ((modm, xK_p ), spawn "rofi -show drun") -- close focused window , ((modm .|. shiftMask, xK_c ), kill) @@ -243,14 +241,17 @@ myLogHook = return () -- per-workspace layout choices. -- -- By default, do nothing. -myStartupHook = return () +myStartupHook = do + spawn "feh --bg-scale ~/画像/wallpaper/85444653_p0.jpg" ------------------------------------------------------------------------ -- Now run xmonad with all the defaults we set up. -- Run xmonad with the settings you specify. No need to modify this. -- -main = xmonad defaults +main :: IO() +main = do + xmobar myConfig >>= xmonad -- A structure containing your configuration settings, overriding -- fields in the default config. Any you don't override, will @@ -258,7 +259,7 @@ main = xmonad defaults -- -- No need to modify this. -- -defaults = def { +myConfig = def { -- simple stuff terminal = myTerminal, focusFollowsMouse = myFocusFollowsMouse, diff --git a/user/wm/xmonad/xmonad.nix b/user/wm/xmonad/xmonad.nix index 8e75923..827fd2e 100644 --- a/user/wm/xmonad/xmonad.nix +++ b/user/wm/xmonad/xmonad.nix @@ -14,4 +14,5 @@ ]; home.file.".config/xmonad/xmonad.hs".source = ./xmonad.hs; + home.file.".config/xmobar/xmobarrc".source = ./xmobarrc; } diff --git a/user/wrapped/alacritty/default.nix b/user/wrapped/alacritty/default.nix new file mode 100644 index 0000000..d7d85c3 --- /dev/null +++ b/user/wrapped/alacritty/default.nix @@ -0,0 +1,15 @@ +{ pkgs, ... }: +let + alacrittyconf = pkgs.writeText "alacritty.toml" '' + [window] + opacity = 0.85 + ''; +in + pkgs.symlinkJoin { + name = "alacritty-wrapped"; + paths = [ pkgs.alacritty ]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/alacritty --add-flags "--config-file ${alacrittyconf}" + ''; + } diff --git a/user/wrapped/bash/default.nix b/user/wrapped/bash/default.nix new file mode 100644 index 0000000..4f4feea --- /dev/null +++ b/user/wrapped/bash/default.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: +let + lsCmd = "eza -la --git -s type"; + bashrc = pkgs.writeShellScript ".bashrc" '' + [[ $- == *i* ]] || return + + eval "$(fzf --bash)" + eval "$(zoxide init bash)" + + HISTFILESIZE=100000 + HISTSIZE=1000 + + alias cd=z + alias l="${lsCmd}" + alias ls="${lsCmd}" + alias update-flake="nix flake update" + + if [[ ! -v BASH_COMPLETION_VERSINFO ]]; then + . "${pkgs.bash-completion}/etc/profile.d/bash_completion.sh" + fi + ''; +in +pkgs.symlinkJoin { + name = "bash-wrapped"; + paths = with pkgs; [ bash bash-completion]; + buildInputs = [ pkgs.makeWrapper ]; + postBuild = '' + wrapProgram $out/bin/bash --add-flags "--rcfile ${bashrc}" + ''; +} diff --git a/user/wrapped/default.nix b/user/wrapped/default.nix new file mode 100644 index 0000000..2c5e9e5 --- /dev/null +++ b/user/wrapped/default.nix @@ -0,0 +1,10 @@ +{ pkgs, config, ... }: +let + packages = { + alacritty = pkgs.callPackage ./alacritty {}; + bash = pkgs.callPackage ./bash {}; + }; +in +{ + environment.systemPackages = builtins.attrValues packages; +} diff --git a/user/wrapped/fish/config.fish b/user/wrapped/fish/config.fish new file mode 100644 index 0000000..e69de29 diff --git a/user/wrapped/fish/default.nix b/user/wrapped/fish/default.nix new file mode 100644 index 0000000..7b68d98 --- /dev/null +++ b/user/wrapped/fish/default.nix @@ -0,0 +1,3 @@ +{ pkgs, ... }: +let + fish_config = import fishinit diff --git a/user/wrapped/fish/fishinit.nix b/user/wrapped/fish/fishinit.nix new file mode 100644 index 0000000..32ca120 --- /dev/null +++ b/user/wrapped/fish/fishinit.nix @@ -0,0 +1,8 @@ +{ pkgs, aliasStr, ... }: + +pkgs.writeShellScriptBin "etc/fish/config.fish" '' + eval "$( ${pkgs.zoxide}/bin/zoxide init fish )" + ${pkgs.fzf}/bin/fzf --fish | source + + source ${./config.fish} +''