feat(*): init
17 files changed, -0/+516
.editorconfig
@@ -0,0 +1,9 @@+root = true++[*]+charset = utf-8+end_of_line = lf++[*.nix]+indent_size = 2+indent_style = space
flake.lock
@@ -0,0 +1,86 @@+{+ "nodes": {+ "flake-compat": {+ "flake": false,+ "locked": {+ "lastModified": 1747046372,+ "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",+ "owner": "edolstra",+ "repo": "flake-compat",+ "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",+ "type": "github"+ },+ "original": {+ "owner": "edolstra",+ "repo": "flake-compat",+ "type": "github"+ }+ },+ "home-manager": {+ "inputs": {+ "nixpkgs": [+ "nixpkgs"+ ]+ },+ "locked": {+ "lastModified": 1761316995,+ "narHash": "sha256-BAAjCpjTnfaxtc9NCkbUl9MUv5JmAG5qU7/G8TTHmb4=",+ "owner": "~rycee",+ "repo": "home-manager",+ "rev": "82b58f38202540bce4e5e00759d115c5a43cab85",+ "type": "sourcehut"+ },+ "original": {+ "owner": "~rycee",+ "repo": "home-manager",+ "type": "sourcehut"+ }+ },+ "nixos-wsl": {+ "inputs": {+ "flake-compat": "flake-compat",+ "nixpkgs": [+ "nixpkgs"+ ]+ },+ "locked": {+ "lastModified": 1761969132,+ "narHash": "sha256-0me4+e+1VxNuvySSw0voqMCWU/eUmTuth7f4+Q2jbUY=",+ "owner": "nix-community",+ "repo": "NixOS-WSL",+ "rev": "761582d6ab431549fe1396d2cd681e3fe9376020",+ "type": "github"+ },+ "original": {+ "owner": "nix-community",+ "repo": "NixOS-WSL",+ "type": "github"+ }+ },+ "nixpkgs": {+ "locked": {+ "lastModified": 1761907660,+ "narHash": "sha256-kJ8lIZsiPOmbkJypG+B5sReDXSD1KGu2VEPNqhRa/ew=",+ "owner": "nixos",+ "repo": "nixpkgs",+ "rev": "2fb006b87f04c4d3bdf08cfdbc7fab9c13d94a15",+ "type": "github"+ },+ "original": {+ "owner": "nixos",+ "ref": "nixos-unstable",+ "repo": "nixpkgs",+ "type": "github"+ }+ },+ "root": {+ "inputs": {+ "home-manager": "home-manager",+ "nixos-wsl": "nixos-wsl",+ "nixpkgs": "nixpkgs"+ }+ }+ },+ "root": "root",+ "version": 7+}
flake.nix
@@ -0,0 +1,22 @@+{+ inputs = {+ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";++ nixos-wsl.url = "github:nix-community/NixOS-WSL";+ nixos-wsl.inputs.nixpkgs.follows = "nixpkgs";+ + home-manager.url = "sourcehut:~rycee/home-manager";+ home-manager.inputs.nixpkgs.follows = "nixpkgs";+ };++ outputs = inputs@{ self, nixpkgs, home-manager, ... }:+ let+ inherit (self) outputs;+ lib = nixpkgs.lib // home-manager.lib;+ in {+ nixosConfigurations = import ./nixos/hosts { inherit inputs outputs lib; };+ homeConfigurations = import ./home/profiles;++ overlays = import ./overlays { inherit inputs outputs; };+ };+}
home/features/cli/bash.nix
@@ -0,0 +1,18 @@+{+ programs = {+ eza.enable = true;++ bash = {+ enable = true;+ shellAliases = {+ l = "eza --git -s type";+ ls = "l -l";+ la = "l -la";+ tree = "l --tree";+ grep = "grep --color";++ dev = "cd $HOME/documents/dev";+ };+ };+ };+}
home/features/cli/git.nix
@@ -0,0 +1,33 @@+{ config, ... }:++{+ programs.git = {+ enable = true;++ userName = "lostduk";+ userEmail = "[email protected]";++ aliases = {+ l = "log --oneline";+ lg = "log --oneline --decorate --graph";++ s = "status";++ fuck = "reset --hard";+ shit = "reset --soft";+ };++ extraConfig = {+ init.defaultBranch = "main";++ #user.signing.key = "";++ gpg.program = "${config.programs.gpg.package}/bin/gpg2";++ commit = {+ verbose = true;+ #gpgSign = true;+ };+ };+ };+}
home/features/cli/gpg.nix
@@ -0,0 +1,25 @@+{ pkgs, config, lib, ... }:++{+ services.gpg-agent = {+ enable = true;+ enableSshSupport = true;++ pinentryPackage = pkgs.pinentry-curses;+ };++ programs = {+ gpg = {+ enable = true;+ settings.trust-model = "tofu+pgp";+ scdaemonSettings.disable-ccid = true;+ };++ bash.initExtra = ''+ export GPG_TTY="$(tty)"+ export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)+ gpgconf --launch gpg-agent+ gpg-connect-agent UPDATESTARTUPTTY /bye > /dev/null+ '';+ };+}
home/features/cli/nvim.nix
@@ -0,0 +1,48 @@+{+ # TMP: neovim suck tbh but it work+ programs.neovim = {+ enable = true;++ vimAlias = true;+ vimdiffAlias = true;+ defaultEditor = true;++ # wtf+ withNodeJs = false;+ withRuby = false;+ withPython3 = false;++ extraConfig = ''+ "" Variables+ let mapleader="\<space>"++ "" Options+ " General+ set mouse="!"+ set magic+ set hidden+ set notimeout+ set autoindent+ set encoding=utf-8+ set clipboard=unnamedplus++ " File+ set autoread+ set noswapfile+ set undofile++ " Ui+ set number+ set relativenumber+ set nowrap+ set lazyredraw+ set cc=80++ "" Mapping+ " useless features tbh why have tab in (n)vim just use tmux or smth+ nnoremap <Esc> :noh<cr>+ nnoremap <Tab> :bnext<cr>+ nnoremap <S-Tab> :bprev<cr>+ '';+ };+}
home/features/global.nix
@@ -0,0 +1,19 @@+{ config, pkgs, ... }:++{+ home = {+ username = "lostduk";+ homeDirectory = "/home/lostduk";+ stateVersion = "25.05";++ sessionVariables = {+ # Fuck Google+ GOSUMDB = "off";+ GOPROXY = "direct";+ GOTELEMETRY = "off";+ GOTOOLCHAIN = "local";+ };++ packages = with pkgs; [ pass ];+ };+}
home/profiles/default.nix
@@ -0,0 +1,11 @@+let+ mkProfile = hostname: {...}: {+ imports = [+ ../features/global.nix++ (./. + "/${hostname}.nix")+ ];+ };+in {+ sunflower = mkProfile "sunflower";+}
home/profiles/sunflower.nix
@@ -0,0 +1,24 @@+{+ imports = [+ ../features/cli/gpg.nix+ ../features/cli/git.nix+ ../features/cli/nvim.nix+ ../features/cli/bash.nix+ ];++ # TMP: neovim suck tbh but it work+ programs.neovim.extraConfig = ''+ let g:clipboard = {+ \ 'name': 'WslClipboard',+ \ 'copy': {+ \ '+': 'clip.exe',+ \ '*': 'clip.exe',+ \ },+ \ 'paste': {+ \ '+': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',+ \ '*': 'powershell.exe -NoLogo -NoProfile -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',+ \ },+ \ 'cache_enabled': 0,+ \ }+ '';+}
nixos/features/global.nix
@@ -0,0 +1,90 @@+{ inputs, outputs, lib, pkgs, ... }:++{+ i18n.defaultLocale = "en_US.UTF-8";+ time.timeZone = "UTC";++ nix = {+ package = pkgs.nixVersions.latest;++ gc = {+ automatic = true;+ dates = "weekly";+ options = "--delete-older-than 7d";+ };++ settings = {+ keep-outputs = false;+ keep-derivations = false;+ auto-optimise-store = true;++ trusted-users = [ "@wheel" ];+ experimental-features = [ "nix-command" "flakes" ];+ };+ };++ nixpkgs = {+ overlays = builtins.attrValues outputs.overlays;++ config = {+ allowUnfree = lib.mkForce false;+ allowBroken = lib.mkForce false;+ };+ };++ networking = {+ domain = "lostduk.com";++ useDHCP = true;+ enableIPv6 = lib.mkForce false;++ firewall = {+ enable = lib.mkForce true;+ allowPing = lib.mkForce false;+ allowedTCPPorts = [];+ allowedUDPPorts = [];+ };+ };++ services = {+ pcscd.enable = true;++ openssh = {+ enable = true;+ settings = {+ PermitRootLogin = "no";+ PasswordAuthentication = false;+ KbdInteractiveAuthentication = false;+ };+ hostKeys = [{+ path = "/persist/etc/ssh/ssh_host_ed25519_key";+ type = "ed25519";+ }];+ };+ };++ security = {+ protectKernelImage = true;++ audit = {+ enable = true;+ rules = [ "-a exit,always, -F arch=b64 -S execve" ];+ };++ sudo = {+ execWheelOnly = true;+ wheelNeedsPassword = lib.mkForce true;+ };++ auditd.enable = true;+ pam.enableSSHAgentAuth = true;+ };++ users = {+ mutableUsers = lib.mkForce false;++ users.root.hashedPassword = lib.mkForce "!";+ };++ environment.defaultPackages = lib.mkForce [];+}
nixos/features/kore.nix
@@ -0,0 +1,40 @@+{ config, lib, ... }:++let+ hostOptions = with lib; {+ ipv4 = mkOption {+ type = types.str;+ default = null;+ };+ roles = mkOption {+ type = types.nullOr (types.listOf types.str);+ default = null;+ };+ };+in {+ options.kore = with lib; {+ hosts = mkOption {+ type = types.attrsOf (types.submodule [{ options = hostOptions; }]);+ default = null;+ };+ currentHost = mkOption {+ type = types.submodule [{ options = hostOptions; }];+ default = null;+ };+ };+ config = {+ warnings = lib.optional (!(config.kore.hosts ? ${config.networking.hostName}))+ "no configuration for ${config.networking.hostName} found";++ # TMP+ kore = {+ hosts = {+ sunflower = {+ ipv4 = "0.0.0.0";+ roles = [ "workstation" ];+ };+ };+ currentHost = config.kore.hosts.${config.networking.hostName};+ };+ };+}
nixos/hosts/default.nix
@@ -0,0 +1,21 @@+{ inputs, outputs, lib, ... }:++let+ mkSystem = system: hostname: lib.nixosSystem {+ system = system;+ specialArgs = { inherit inputs outputs; };+ modules = [+ ../features/global.nix+ ../features/kore.nix++ ../roles++ (./. + "/${hostname}.nix")++ { networking.hostName = "${hostname}"; }+ { system.stateVersion = "25.05"; }+ ];+ };+in {+ sunflower = mkSystem "x86_64-linux" "sunflower";+}
nixos/hosts/sunflower.nix
@@ -0,0 +1,30 @@+{ pkgs, inputs, modulesPath, ... }:++{+ imports = [+ inputs.nixos-wsl.nixosModules.default++ ( modulesPath + "/installer/scan/not-detected.nix" )+ ];++ wsl = {+ enable = true;+ defaultUser = "lostduk";+ useWindowsDriver = true;++ usbip = {+ enable = true;+ };+ };++ users.users.lostduk = {+ isNormalUser = true;+ extraGroups = [ "wheel" ];+ password = "tmp";+ };++ hardware = {+ graphics.enable = true;+ cpu.intel.updateMicrocode = true;+ };+}
nixos/roles/default.nix
@@ -0,0 +1,5 @@+{+ imports = [+ ./workstation.nix+ ];+}
nixos/roles/workstation.nix
@@ -0,0 +1,19 @@+{ inputs, outputs, config, lib, ... }:++let+ roleName = "workstation";+ roleEnabled = lib.elem roleName config.kore.currentHost.roles;+in {+ imports = [ inputs.home-manager.nixosModules.home-manager ];++ config = lib.mkMerge [{} (lib.mkIf roleEnabled {+ home-manager = {+ useGlobalPkgs = true;+ useUserPackages = true;+ extraSpecialArgs = { inherit inputs outputs; };++ users.lostduk = outputs.homeConfigurations.${config.networking.hostName};+ };+ })];+}+
overlays/default.nix
@@ -0,0 +1,16 @@+{ inputs, outputs, ... }:++{+ # https://m7.rs/git/nix-config/tree/overlays/default.nix#line-13+ flake-inputs = final: _: {+ inputs =+ builtins.mapAttrs (_: flake:+ let+ legacyPackages = (flake.legacyPackages or {}).${final.system} or {};+ packages = (flake.packages or {}).${final.system} or {};+ in+ if legacyPackages != {} then legacyPackages else packages+ )+ inputs;+ };+}