diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | .zshrc | 4 | ||||
| -rw-r--r-- | INSTALL.txt | 5 | ||||
| -rwxr-xr-x | bootstrap.sh | 24 | ||||
| -rw-r--r-- | flake.lock | 49 | ||||
| -rw-r--r-- | flake.nix | 35 | ||||
| -rw-r--r-- | home-manager/home.nix | 6 | ||||
| -rwxr-xr-x | sync.sh | 23 |
8 files changed, 120 insertions, 27 deletions
@@ -1,3 +1,4 @@ +/.bootstrap /.config/alacritty/alacritty.local.yml /.config/newsboat/urls /bin/gitalias/git-* @@ -441,4 +441,6 @@ export PATH="$HOME/.cargo/bin:$PATH" export PATH="$HOME/.deno/bin:$PATH" export PATH=/usr/local/go/bin:$PATH -eval "$(direnv hook zsh)" +if type direnv >/dev/null 2>&1; then + eval "$(direnv hook zsh)" +fi diff --git a/INSTALL.txt b/INSTALL.txt index 3eba918..c2e1ea4 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -54,3 +54,8 @@ $ cargo install cargo-compete $ go install github.com/rhysd/vim-startuptime@latest ``` + + +# nix flake update +# nix store gc +# home-manager switch --flake ".#ken" diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..641fac9 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +if [ ! -d .bootstrap ]; then + mkdir .bootstrap +fi +if [ ! -f .bootstrap/nix-install ]; then + curl -o .bootstrap/nix-install -L https://nixos.org/nix/install +fi +if [ ! -d /nix ]; then + sh .bootstrap/nix-install --daemon +fi +if grep -q "nix-command flakes" /etc/nix/nix.conf; then + : +else + echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf > /dev/null +fi +if [ ! -d "$HOME/.local/state/nix/profiles" ]; then + mkdir -p "$HOME/.local/state/nix/profiles" +fi +if type home-manager > /dev/null 2>&1; then + : +else + nix run "nixpkgs#home-manager" -- switch --flake ".#ken" +fi diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..eea49a0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,49 @@ +{ + "nodes": { + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1693208669, + "narHash": "sha256-hHFaaUsZ860wvppPeiu7nJn/nXZjJfnqAQEu9SPFE9I=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "5bac4a1c06cd77cf8fc35a658ccb035a6c50cd2c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "release-23.05", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1693525452, + "narHash": "sha256-QgzIF92jB8KRwfzO1+FBPbofS4zVihwu1unRiipxCfw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "53123c945fd86f6b56af8be011558410bd4444b2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "release-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..79121d2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +######################################################## +# __ __ __ _ _ _ # +# | \/ |_ _ / _| | __ _| | _____ _ __ (_)_ __ # +# | |\/| | | | | | |_| |/ _` | |/ / _ \ | '_ \| \ \/ / # +# | | | | |_| | | _| | (_| | < __/_| | | | |> < # +# |_| |_|\__, | |_| |_|\__,_|_|\_\___(_)_| |_|_/_/\_\ # +# |___/ # +######################################################## +{ + description = "My flake configuration"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/release-23.05"; + + home-manager = { + url = "github:nix-community/home-manager/release-23.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { nixpkgs, home-manager, ... } @ inputs: { + homeConfigurations.ken = home-manager.lib.homeManagerConfiguration { + pkgs = import nixpkgs { + system = "x86_64-linux"; + config.allowUnfree = true; + }; + extraSpecialArgs = { + inherit inputs; + }; + modules = [ + ./home-manager/home.nix + ]; + }; + }; +} diff --git a/home-manager/home.nix b/home-manager/home.nix index ddbcac9..a0eb5cd 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -1,11 +1,11 @@ -{ config, pkgs, ... }: +{ pkgs, ... }: let isWayland = builtins.getEnv "XDG_SESSION_TYPE" == "wayland"; in { - home.username = builtins.getEnv "USER"; - home.homeDirectory = builtins.getEnv "HOME"; + home.username = "ken"; + home.homeDirectory = "/home/ken"; home.stateVersion = "23.05"; diff --git a/sync.sh b/sync.sh deleted file mode 100755 index 873a99c..0000000 --- a/sync.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Remove old settings. {{{1 - -# Emacs {{{2 - -emacs_conf_dir="${XDG_CONFIG_HOME:-$HOME/.config}"/emacs -if [ -d "$emacs_conf_dir" ]; then - echo "emacs: remove $emacs_conf_dir" - rm -rf "$emacs_conf_dir" -fi - -# Synchronize current settings. {{{1 - -# Bat {{{2 -if type bat >/dev/null 2>&1; then - echo "bat: rebuild cache" - bat cache --clear && bat cache --build -fi - -# }}} -# }}} -# vim: foldmethod=marker |
