From 5cac466f9088557c9cdbb388625b213bf94047b4 Mon Sep 17 00:00:00 2001 From: yukkop Date: Thu, 17 Jul 2025 16:10:04 +0000 Subject: [PATCH] feat(nixos): `module`: +user.yukkop --- flake.nix | 14 +-- nixos/module/hectic/user/yukkop/default.nix | 15 +++ nixos/module/hectic/user/yukkop/yukkop.nix | 97 +++++++++++++++++++ .../yukkop/{devvm-manual.nix => yukkop.nix} | 0 4 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 nixos/module/hectic/user/yukkop/default.nix create mode 100644 nixos/module/hectic/user/yukkop/yukkop.nix rename nixos/system/yukkop/{devvm-manual.nix => yukkop.nix} (100%) diff --git a/flake.nix b/flake.nix index 61837b0..d89e72d 100644 --- a/flake.nix +++ b/flake.nix @@ -53,12 +53,12 @@ legacyPackages.${system} = import nixpkgs { inherit system overlays; }; devShells.${system} = { - c = import ./devshell/c.nix { inherit self system pkgs; }; + c = import ./devshell/c.nix { inherit self system pkgs; }; postgres-c = import ./devshell/postgres-c.nix { inherit self system pkgs; }; - pure-c = import ./devshell/pure-c.nix { inherit self system pkgs; }; - default = import ./devshell/default.nix { inherit self system pkgs; }; - rust = import ./devshell/rust.nix { inherit self system pkgs; }; - haskell = import ./devshell/haskell.nix { inherit self system pkgs; }; + pure-c = import ./devshell/pure-c.nix { inherit self system pkgs; }; + default = import ./devshell/default.nix { inherit self system pkgs; }; + rust = import ./devshell/rust.nix { inherit self system pkgs; }; + haskell = import ./devshell/haskell.nix { inherit self system pkgs; }; }; nixosConfigurations = { "devvm-manual|${system}" = import ./nixos/system/devvm-manual/default.nix @@ -68,7 +68,7 @@ }; }) // { lib = self-lib; - overlays.default = import ./overlay { inherit flake self inputs nixpkgs; }; - nixosModules = import ./nixos/module { inherit flake self inputs nixpkgs; }; + overlays.default = import ./overlay { inherit flake self inputs nixpkgs; }; + nixosModules = import ./nixos/module { inherit flake self inputs nixpkgs; }; }; } diff --git a/nixos/module/hectic/user/yukkop/default.nix b/nixos/module/hectic/user/yukkop/default.nix new file mode 100644 index 0000000..29b1ff9 --- /dev/null +++ b/nixos/module/hectic/user/yukkop/default.nix @@ -0,0 +1,15 @@ +{ + self, + inputs, + flake, + system ? "x86_64-linux", + ... +}: let + # Use folder name as name of this system + name = builtins.baseNameOf ./.; +in inputs.home-manager.lib.homeManagerConfiguration { + pkgs = self.legacyPackages."${system}"; + modules = [ + (import ./${name}.nix { inherit flake self inputs; }) + ]; +} diff --git a/nixos/module/hectic/user/yukkop/yukkop.nix b/nixos/module/hectic/user/yukkop/yukkop.nix new file mode 100644 index 0000000..e6a8374 --- /dev/null +++ b/nixos/module/hectic/user/yukkop/yukkop.nix @@ -0,0 +1,97 @@ +{ + self, + inputs, + ... +}: +{ + config, + pkgs, + lib, + ... +}: let + name = builtins.baseNameOf ./.; + home = "/home/${name}"; + cfg = config.hectic.user.yukkop; +in { + options.hectic.user.yukkop.enable = lib.mkEnableOption "Enable user.yukkop"; + + config = lib.mkIf cfg.enable { + home = { + username = name; + homeDirectory = home; + packages = []; + stateVersion = "25.05"; + }; + + xdg = { + enable = true; + userDirs = { + enable = true; + pictures = "${home}/px"; + videos = "${home}/vd"; + music = "${home}/mu"; + documents = "${home}/dc"; + downloads = "${home}/dw"; + desktop = "${home}/dx"; + publicShare = "${home}/pu"; + templates = "${config.xdg.dataHome}/templates"; + }; + mimeApps = { + enable = true; + defaultApplications = { + + # Files + "application/x-shellscript" = [ "nvim.desktop" ]; + "text/x-shellscript" = [ "nvim.desktop" ]; + "text/plain" = [ "nvim.desktop" ]; + "inode/directory" = [ "pcmanfm.desktop" ]; + + # Images + "image/png" = [ "sxiv.desktop" ]; + "image/jpeg" = [ "sxiv.desktop" ]; + "image/gif" = [ "sxiv.desktop" ]; + "image/webp" = [ "sxiv.desktop" ]; + "image/x-xcf" = [ "gimp.desktop" ]; + + # Videos + "video/x-matroska" = [ "mpv.desktop" ]; + + # # Application-specific + # "application/postscript" = [ "pdf.desktop" ]; + # "application/pdf" = [ "pdf.desktop" ]; + # "application/rss+xml" = [ "rss.desktop" ]; + # "application/x-bittorrent" = [ "torrent.desktop" ]; + + # Protocols + "x-scheme-handler/http" = [ "firefox.desktop" ]; + "x-scheme-handler/https" = [ "firefox.desktop" ]; + # "x-scheme-handler/magnet" = [ "torrent.desktop" ]; + # "x-scheme-handler/mailto" = [ "mail.desktop" ]; + # "x-scheme-handler/lbry" = [ "lbry.desktop" ]; + # "x-scheme-handler/tg" = [ "telegram.desktop" ]; + + # text/x-shellscript=text.desktop; + # x-scheme-handler/magnet=torrent.desktop; + # application/x-bittorrent=torrent.desktop; + # x-scheme-handler/mailto=mail.desktop; + # text/plain=text.desktop; + # application/postscript=pdf.desktop; + # application/pdf=pdf.desktop; + # image/png=img.desktop; + # image/jpeg=img.desktop; + # image/gif=img.desktop; + # image/webp=img.desktop; + # application/rss+xml=rss.desktop; + # video/x-matroska=video.desktop; + # x-scheme-handler/lbry=lbry.desktop; + # inode/directory=file.desktop; + # text/html=chromium.desktop; + # x-scheme-handler/http=chromium.desktop; + # x-scheme-handler/https=chromium.desktop; + # x-scheme-handler/about=chromium.desktop; + # x-scheme-handler/unknown=chromium.desktop; + }; + }; + }; + }; +} diff --git a/nixos/system/yukkop/devvm-manual.nix b/nixos/system/yukkop/yukkop.nix similarity index 100% rename from nixos/system/yukkop/devvm-manual.nix rename to nixos/system/yukkop/yukkop.nix