commit b89303566a59ff9620f110763f9b6fdea9748ba2 Author: ktkk Date: Thu Jun 5 19:13:28 2025 +0000 Initial commit diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c106215 --- /dev/null +++ b/flake.lock @@ -0,0 +1,101 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1746413188, + "narHash": "sha256-i6BoiQP0PasExESQHszC0reQHfO6D4aI2GzOwZMOI20=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8a318641ac13d3bc0a53651feaee9560f9b2d89a", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixos-wsl": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1744290088, + "narHash": "sha256-/X9XVEl0EiyisNbF5srrxXRSVoRqdwExuqyspYqqEjQ=", + "owner": "nix-community", + "repo": "NixOS-WSL", + "rev": "60b4904a1390ac4c89e93d95f6ed928975e525ed", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "main", + "repo": "NixOS-WSL", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1742937945, + "narHash": "sha256-lWc+79eZRyvHp/SqMhHTMzZVhpxkRvthsP1Qx6UCq0E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d02d88f8de5b882ccdde0465d8fa2db3aa1169f7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1746141548, + "narHash": "sha256-IgBWhX7A2oJmZFIrpRuMnw5RAufVnfvOgHWgIdds+hc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f02fddb8acef29a8b32f10a335d44828d7825b78", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixos-wsl": "nixos-wsl", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..1a9ba43 --- /dev/null +++ b/flake.nix @@ -0,0 +1,61 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + nixos-wsl.url = "github:nix-community/NixOS-WSL/main"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { self, nixpkgs, ... }@inputs: + let + inherit (self) outputs; + system = "x86_64-linux"; + in + { + formatter.${system} = nixpkgs.legacyPackages.${system}.nixfmt-tree; + + nixosConfigurations = { + wsl = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs outputs; + }; + + inherit system; + + modules = [ + ./hosts/wsl/configuration.nix + inputs.nixos-wsl.nixosModules.default + inputs.home-manager.nixosModules.default + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users = { + nixos = import ./home/nixos/home.nix; + }; + }; + } + ]; + }; + }; + + # homeConfiguration = { + # nixos = inputs.home-manager.lib.homeManagerConfiguration { + # extraSpecialArgs = { + # inherit inputs outputs self; + # }; + + # pkgs = nixpkgs.legacyPackages."x86_64-linux"; + + # modules = [ + # ./home/nixos/home.nix + # ]; + # }; + # }; + }; +} diff --git a/home/nixos/home.nix b/home/nixos/home.nix new file mode 100644 index 0000000..695c54d --- /dev/null +++ b/home/nixos/home.nix @@ -0,0 +1,157 @@ +{ config, pkgs, ... }: +{ + # Home Manager needs a bit of information about you and the paths it should + # manage. + home.username = "nixos"; + home.homeDirectory = "/home/nixos"; + + # This value determines the Home Manager release that your configuration is + # compatible with. This helps avoid breakage when a new Home Manager release + # introduces backwards incompatible changes. + # + # You should not change this value, even if you update Home Manager. If you do + # want to update the value, then make sure to first check the Home Manager + # release notes. + home.stateVersion = "24.05"; # Please read the comment before changing. + + # The home.packages option allows you to install Nix packages into your + # environment. + home.packages = with pkgs; [ + # # Adds the 'hello' command to your environment. It prints a friendly + # # "Hello, world!" when run. + # pkgs.hello + + # # It is sometimes useful to fine-tune packages, for example, by applying + # # overrides. You can do that directly here, just don't forget the + # # parentheses. Maybe you want to install Nerd Fonts with a limited number of + # # fonts? + # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; }) + + # # You can also create simple shell scripts directly inside your + # # configuration. For example, this adds a command 'my-hello' to your + # # environment: + # (pkgs.writeShellScriptBin "my-hello" '' + # echo "Hello, ${config.home.username}!" + # '') + ]; + + # Home Manager is pretty good at managing dotfiles. The primary way to manage + # plain files is through 'home.file'. + home.file = { + # # Building this configuration will create a copy of 'dotfiles/screenrc' in + # # the Nix store. Activating the configuration will then make '~/.screenrc' a + # # symlink to the Nix store copy. + # ".screenrc".source = dotfiles/screenrc; + + # # You can also set the file content immediately. + # ".gradle/gradle.properties".text = '' + # org.gradle.console=verbose + # org.gradle.daemon.idletimeout=3600000 + # ''; + }; + + # Home Manager can also manage your environment variables through + # 'home.sessionVariables'. These will be explicitly sourced when using a + # shell provided by Home Manager. If you don't want to manage your shell + # through Home Manager then you have to manually source 'hm-session-vars.sh' + # located at either + # + # ~/.nix-profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh + # + # or + # + # /etc/profiles/per-user/nixos/etc/profile.d/hm-session-vars.sh + # + home.sessionVariables = { + # EDITOR = "emacs"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + + extraConfig = '' + scriptencoding utf-8 + + set tabstop=4 + set shiftwidth=4 + set expandtab + + set number + set relativenumber + + highlight Normal guibg=none + highlight NonText guibg=none + highlight Normal ctermbg=none + highlight NonText ctermbg=none + + set list + set listchars=tab:→\ ,space:.,nbsp:␣,precedes:⇥,extends:⇤ + ''; + + plugins = with pkgs.vimPlugins; [ + { + plugin = ( + nvim-treesitter.withPlugins ( + p: with p; [ + c + cpp + zig + rust + go + gleam + lua + swift + typescript + javascript + json + nix + ] + ) + ); + config = '' + packadd! nvim-treesitter + lua <