diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..a8d08c3 --- /dev/null +++ b/.envrc @@ -0,0 +1,8 @@ +use flake .nix + +if on_git_branch; then + echo + git status --short --branch + echo + git fetch +fi diff --git a/.gitignore b/.gitignore index a806510..3357b94 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ # Ignore build outputs from performing a nix-build or `nix build` command result result-* - diff --git a/.nix/flake.lock b/.nix/flake.lock new file mode 100644 index 0000000..f09af8e --- /dev/null +++ b/.nix/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1720418205, + "narHash": "sha256-cPJoFPXU44GlhWg4pUk9oUPqurPlCFZ11ZQPk21GTPU=", + "rev": "655a58a72a6601292512670343087c2d75d859c1", + "revCount": 650378, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.650378%2Brev-655a58a72a6601292512670343087c2d75d859c1/019095fe-96b2-7a7c-ad7c-2131b3fb6fa7/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.nix/flake.nix b/.nix/flake.nix new file mode 100644 index 0000000..0cbe327 --- /dev/null +++ b/.nix/flake.nix @@ -0,0 +1,32 @@ +{ + description = "A flake editing flake"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell.override + { + # Override stdenv in order to change compiler: + # stdenv = pkgs.clangStdenv; + } + { + packages = with pkgs; [ + pre-commit + commitizen + ]; + + shellHook = '' + pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg + ''; + }; + }); + }; +} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..87f991d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,27 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: detect-private-key + - id: mixed-line-ending + + - repo: https://github.com/commitizen-tools/commitizen + rev: v3.27.0 + hooks: + - id: commitizen + stages: [commit-msg] + + - repo: local + hooks: + - id: home-manager-check + name: Home Manager Config Check + entry: home-manager switch --dry-run + language: system + pass_filenames: false + exclude: ^docs/ diff --git a/README.md b/README.md index 6a6da41..c8292c9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1 @@ # home-manager - diff --git a/git/default.nix b/git/default.nix index 739bf02..8f2e90f 100644 --- a/git/default.nix +++ b/git/default.nix @@ -82,7 +82,7 @@ uri=''${1} dir=''${2} - if [[ -z ''${dir} ]]; then + if [[ -z ''${dir} ]]; then dir=''$(basename ''${1} .git) fi @@ -102,17 +102,17 @@ '') (writeShellScriptBin "git-make-relative" '' - + gitfile=''${1} - if [[ -z ''${gitfile} ]]; then + if [[ -z ''${gitfile} ]]; then gitfile=".git" - fi + fi - if [[ ! -f ''${gitfile} ]]; then + if [[ ! -f ''${gitfile} ]]; then echo "file ''${gitfile} does not exist" - exit 1 - fi + exit 1 + fi gitdir=$(grep "gitdir:" ''${gitfile} | cut -d: -f2 | xargs) rel_gitdir=$(realpath -s --relative-to=. ''${gitdir}) @@ -123,4 +123,3 @@ '') ]; } - diff --git a/horsch/ssh.nix b/horsch/ssh.nix index 50a07a7..7890487 100644 --- a/horsch/ssh.nix +++ b/horsch/ssh.nix @@ -62,4 +62,3 @@ }; }; } - diff --git a/horsch/zsh.nix b/horsch/zsh.nix index d3919cc..768828f 100644 --- a/horsch/zsh.nix +++ b/horsch/zsh.nix @@ -2,8 +2,8 @@ { programs.zsh.initExtra = '' if [ -f $HOME/.nix-profile/etc/profile.d/nix.sh ]; - then - source $HOME/.nix-profile/etc/profile.d/nix.sh + then + source $HOME/.nix-profile/etc/profile.d/nix.sh fi function sc-log { @@ -24,16 +24,16 @@ if [ -z ''${update_file} ]; then update_file=$(find build/tmp/deploy/images -name "*.swu" -type f | fzf --select-1) - fi + fi if [ -z ''${update_file} ]; then - echo "no file selected" - return 1 + echo "no file selected" + return 1 fi if [ ! -f ''${update_file} ]; then - echo "file \"''${update_file}\" does not exist" - return 2 + echo "file \"''${update_file}\" does not exist" + return 2 fi echo "flashing ''${update_file} to device..." diff --git a/neovim/default.nix b/neovim/default.nix index 69a51eb..a52092c 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -1,6 +1,6 @@ { pkgs, theme, ... }: { - # symlink for a stable path + # symlink for a stable path home.file.".vscode-extensions/vscode-lldb".source = pkgs.vscode-extensions.vadimcn.vscode-lldb; programs = { @@ -16,14 +16,14 @@ vim-bbye ansible-vim - # ui + # ui dressing-nvim # session handling project-nvim auto-session - # escape handling + # escape handling better-escape-nvim nvim-treesitter.withAllGrammars @@ -82,7 +82,7 @@ nvim-dap nvim-dap-ui - # neorg + # neorg neorg neorg-telescope ]; @@ -169,5 +169,3 @@ }; }; } - - diff --git a/shell/carapace.nix b/shell/carapace.nix index 2705a18..3b137ec 100644 --- a/shell/carapace.nix +++ b/shell/carapace.nix @@ -5,4 +5,3 @@ enableZshIntegration = true; }; } - diff --git a/shell/zoxide.nix b/shell/zoxide.nix index 435b381..043ffeb 100644 --- a/shell/zoxide.nix +++ b/shell/zoxide.nix @@ -6,4 +6,3 @@ enableZshIntegration = true; }; } -