Skip to content
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
17f89c3
feat: add minimal just file
cameronraysmith Sep 8, 2023
6a941a5
refactor: add default.nix to home
cameronraysmith Sep 8, 2023
c8612d9
feat: add starship config from srid/nixos-config
cameronraysmith Sep 8, 2023
ccaee29
refactor: migrate terminal config flake -> ./home
cameronraysmith Sep 8, 2023
c5c58a2
refactor: update flake to account for refactoring
cameronraysmith Sep 8, 2023
ac0f230
refactor: update flake.lock
cameronraysmith Sep 8, 2023
1209e54
fix: remove disabled autojump deferring to zoxide
cameronraysmith Sep 8, 2023
f78bca9
fix: remove asciinema
cameronraysmith Sep 8, 2023
9c7decc
fix: specify formatter in flake
cameronraysmith Sep 8, 2023
092018a
fix: fully qualify references to all inputs
cameronraysmith Sep 8, 2023
20f7b14
feat: add run target that refs lint and check
cameronraysmith Sep 8, 2023
9635789
refactor: remove unused home.nix
cameronraysmith Sep 9, 2023
e3d5134
fix: update relative path to neovim in comment
cameronraysmith Sep 9, 2023
65edb96
feat: io/update/build/clean targets for justfile
cameronraysmith Sep 9, 2023
0fa764e
fix: point to nix-systems/default in comment
cameronraysmith Sep 9, 2023
c86c3be
fix: justfile indent spacing
cameronraysmith Sep 9, 2023
9684441
refactor: make `./home` a home-manager module
cameronraysmith Sep 9, 2023
dfeee74
feat: add direnv to use flake
cameronraysmith Sep 9, 2023
6edcef0
Add a devshell (since there is .envrc)
srid Sep 9, 2023
3c26b7b
Simplify justfile default
srid Sep 9, 2023
624181c
docs: update README
cameronraysmith Sep 10, 2023
b6e101d
fix: lint gitignore
cameronraysmith Sep 10, 2023
90e7fae
chore: update flake lock
cameronraysmith Sep 10, 2023
bc51772
feat: add manual dev recipe to justfile
cameronraysmith Sep 10, 2023
3b2419d
fix: spacing typo in README
cameronraysmith Sep 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
result
.direnv
42 changes: 29 additions & 13 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 21 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{
description = "A home-manager template providing useful tools & settings for Nix-based development";

inputs = {
# Principle inputs (updated by `nix run .#update`)
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
Expand All @@ -7,17 +9,18 @@

flake-parts.url = "github:hercules-ci/flake-parts";
nixos-flake.url = "github:srid/nixos-flake";

# see https://github.com/nix-systems/default/blob/main/default.nix
systems.url = "github:nix-systems/default";
};

outputs = inputs@{ self, ... }:
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
systems = import inputs.systems;
imports = [
inputs.nixos-flake.flakeModule
];

flake.homeModules.default = ./home.nix;

flake.templates.default = {
description = "A `home-manager` template providing useful tools & settings for Nix-based development";
path = builtins.path {
Expand All @@ -31,25 +34,36 @@
perSystem = { self', pkgs, ... }:
let
# TODO: Change username
myUserName = "john";
myUserName = "runner";
in
{
legacyPackages.homeConfigurations.${myUserName} =
self.nixos-flake.lib.mkHomeConfiguration
inputs.self.nixos-flake.lib.mkHomeConfiguration
pkgs
({ pkgs, ... }: {
imports = [ self.homeModules.default ];
# Edit the contents of the ./home directory to install packages and modify dotfile configuration in your
# $HOME.
#
# https://nix-community.github.io/home-manager/index.html#sec-usage-configuration
imports = [ ./home ];
home.username = myUserName;
home.homeDirectory = "/${if pkgs.stdenv.isDarwin then "Users" else "home"}/${myUserName}";
home.stateVersion = "22.11";
});

formatter = pkgs.nixpkgs-fmt;

# Enables 'nix run' to activate.
apps.default.program = self'.packages.activate-home;

# Enable 'nix build' to build the home configuration, but without
# activating.
packages.default = self'.legacyPackages.homeConfigurations.${myUserName}.activationPackage;

devShells.default = pkgs.mkShell {
name = "nix-dev-home";
nativeBuildInputs = with pkgs; [ just ];
};
};
};
}
9 changes: 9 additions & 0 deletions home/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
imports = [
# This loads ./neovim/default.nix - neovim configured for Haskell dev, and other things.
./neovim
./starship.nix
./terminal.nix
# Add more of your home-manager modules here.
];
}
23 changes: 23 additions & 0 deletions home/starship.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
# Starship configuration from this example:
# https://github.com/srid/nixos-config/blob/f9cf0def19fbc7aa1e836be481ce50d214e34036/home/starship.nix#L4-L19
programs.starship = {
enable = true;
settings = {
username = {
style_user = "blue bold";
style_root = "red bold";
format = "[$user]($style) ";
disabled = false;
show_always = true;
};
hostname = {
ssh_only = false;
ssh_symbol = "🌐 ";
format = "on [$hostname](bold red) ";
trim_at = ".local";
disabled = false;
};
};
};
}
56 changes: 35 additions & 21 deletions home.nix → home/terminal.nix
Original file line number Diff line number Diff line change
@@ -1,29 +1,50 @@
# Edit this to install packages and modify dotfile configuration in your
# $HOME.
#
# https://nix-community.github.io/home-manager/index.html#sec-usage-configuration
{ pkgs, ... }: {
imports = [
# This loads ./home/neovim/default.nix - neovim configured for Haskell dev, and other things.
./home/neovim
# Add more of your home-manager modules here.
];
{ pkgs, ... }:

# Platform-independent terminal setup
{
# Nix packages to install to $HOME
#
# Search for packages here: https://search.nixos.org/packages
home.packages = with pkgs; [
tmate
nix-info
cachix
lazygit # Better git UI
# Unix tools
ripgrep # Better `grep`
fd
sd
tree

# Nix dev
cachix
nil # Nix language server
nix-info
nixpkgs-fmt
nixci

# Dev
gh
just
lazygit # Better git UI
tmate
];

home.shellAliases = rec {
e = "nvim";
g = "git";
lg = "lazygit";
t = "tree";
};

# Programs natively supported by home-manager.
programs = {
bat.enable = true;
# Type `z <pat>` to cd to some directory
zoxide.enable = true;
# Type `<ctrl> + r` to fuzzy search your shell history
fzf.enable = true;
jq.enable = true;
nix-index.enable = true;
htop.enable = true;


# on macOS, you probably don't need this
bash = {
enable = true;
Expand All @@ -47,12 +68,5 @@
enable = true;
nix-direnv.enable = true;
};

# Want to configure starship? See this example:
# https://github.com/srid/nixos-config/blob/f9cf0def19fbc7aa1e836be481ce50d214e34036/home/starship.nix#L4-L19
starship.enable = true;

# Type `z <pat>` to cd to some directory
zoxide.enable = true;
};
}
36 changes: 36 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Like GNU `make`, but `just` rustier.
# https://just.systems/man/en/chapter_19.html
# run `just` from this directory to see available commands

# Default command when 'just' is run without arguments
default:
@just --list

# Print nix flake inputs and outputs
io:
nix flake metadata
nix flake show

# Update nix flake
update:
nix flake update

# Lint nix files
lint:
nix fmt

# Check nix flake
check:
nix flake check

# Build nix flake
build: lint check
nix build

# Remove build output link (no garbage collection)
clean:
rm -f ./result

# Run nix flake to setup environment
run: lint check
nix run