Compare commits

..

17 commits

36 changed files with 138 additions and 43 deletions

View file

@ -0,0 +1,10 @@
# Work profile overlay
_Inspired by [Published my Nix Dotfiles](https://www.chrisportela.com/posts/published-nix-dotfiles/)._
This repo demonstrates how I use a private repo to overlay my work-specific configurations on top of my personal ones. To use it, I just:
1. Clone the private repo to my machine.
2. `cd` into the private repo.
3. Run `home-manager switch --flake .#<username>@<hostname>` to activate the work profile (and then use the `switch-home` function to (re)activate it in the future).
When the public `dotfiles` repo gets updated, I run `nix flake lock --update-input dotfiles` to pull in the changes before doing `switch-home` to reapply the config.

View file

@ -0,0 +1,29 @@
{
description = "A flake to overlay private configurations on my public flake";
inputs = {
dotfiles.url = "github:jbowdre/dotfiles";
};
outputs = { self, dotfiles, nixpkgs } @inputs:
let
inherit (dotfiles) homeConfigurations homeManagerModules lib overlays packages;
inherit (self) outputs;
in
{
homeManagerModules = import "${dotfiles}/modules/home-manager";
overlays = import "${dotfiles}/overlays" { inherit inputs outputs; };
homeConfigurations = {
"work-user@work-system" = lib.homeManagerConfiguration {
modules = [
"${dotfiles}/home/global"
./work_overrides
];
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};
};
};
}

View file

@ -0,0 +1,24 @@
{ pkgs, ... }: {
imports = [
./fish.nix
];
home = {
# username override
username = "work-user";
packages = with pkgs; [
packer
terraform
vagrant
vault
wsl-open
wslu
];
};
programs = {
htop.enable = true;
git.userEmail = "work-user@company.tld";
};
}

View file

@ -0,0 +1,13 @@
{ pkgs, lib, config, ... }: {
programs.fish = {
# Shell overrides for work
shellAbbrs = rec {
putmykey = "ssh-copy-id -i ~/.ssh/id_ed25519";
putrootkey = "ssh-copy-id -i ~/.ssh/id_ed25519-root";
ssh = "ssh -i ~/.ssh/id_ed25519 -l work-user";
sshroot = "ssh -i ~/.ssh/id_ed25519-root -l root";
vpnkit = "wsl.exe -d wsl-vpnkit --cd /app service wsl-vpnkit";
};
};
}

View file

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View file

@ -1,19 +1,9 @@
# Config files
## Nix
I've started the process of leveraging [Nix](https://nixos.org/explore.html) to manage my system configurations. This repo will (eventually?) hold files used for managing user environments with [Home Manager](https://github.com/nix-community/home-manager). The goods are in [flake.nix](./flake.nix) and the [nix](./nix/) directory.
I've started the process of leveraging [Nix](https://nixos.org/explore.html) to manage my system configurations. This repo holds files used for managing user environments with [Home Manager](https://github.com/nix-community/home-manager), largely adapted from the wonderful examples at [nix-starter-configs](https://github.com/Misterio77/nix-starter-configs).
It's very much a work-in-progress though so the legacy dotfile configs are below.
## Legacy stuff
Clone the repo:
```sh
git clone https://github.com/jbowdre/dotfiles.git ~/.dotfiles
```
Use `ln` to symlink the desired configs into your home directory:
```sh
ln -s ~/.dotfiles/zsh/.zshrc ~/.zshrc
ln -s ~/.dotfiles/vim/.vimrc ~/.vimrc
ln -s ~/.dotfiles/tmux/.tmux.conf ~/.tmux.conf
ln -s ~/.dotfiles/pwsh/Microsoft.PowerShell_profile.ps1 ~/.config/powershell/Microsoft.PowerShell_profile.ps1
I've preserved my previous configs in the [.legacy_dotfiles](./.legacy_dotfiles) directory, but I'm not actively maintaining them anymore.
The [.example_work_profile](./.example_work_profile) directory demonstrates how I use a private repo to overlay my work-specific configurations on top of my personal ones.
```

View file

@ -38,19 +38,19 @@
in
{
inherit lib;
nixosModules = import ./nix/modules/nixos;
homeManagerModules = import ./nix/modules/home-manager;
nixosModules = import ./modules/nixos;
homeManagerModules = import ./modules/home-manager;
overlays = import ./nix/overlays { inherit inputs outputs; };
overlays = import ./overlays { inherit inputs outputs; };
packages = forEachSystem (pkgs: import ./nix/pkgs { inherit pkgs; });
packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; });
devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; });
formatter = forEachSystem (pkgs: pkgs.nixpkgs-fmt);
nixosConfigurations = {
# Pixelbook converted to NixOS
pixnix = lib.nixosSystem {
modules = [ ./nix/hosts/pixnix ];
modules = [ ./hosts/pixnix ];
specialArgs = { inherit inputs outputs; };
};
};
@ -59,17 +59,17 @@
# Available through 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = {
"john@penguin-fw" = lib.homeManagerConfiguration {
modules = [ ./nix/home/penguin-fw.nix ];
modules = [ ./home/penguin-fw.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};
"john@penguin-duet" = lib.homeManagerConfiguration {
modules = [ ./nix/home/penguin-duet.nix ];
modules = [ ./home/penguin-duet.nix ];
pkgs = pkgsFor.aarch64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};
"john@pixnix" = lib.homeManagerConfiguration {
modules = [ ./nix/home/pixnix.nix ];
modules = [ ./home/pixnix.nix ];
pkgs = pkgsFor.x86_64-linux;
extraSpecialArgs = { inherit inputs outputs; };
};

View file

@ -2,6 +2,7 @@
# Core CLI apps
imports = [
./exa.nix
./git.nix
./fish.nix
./tmux.nix
@ -10,10 +11,11 @@
home.packages = with pkgs; [
babelfish # Lets fish speak bash
bottom # Better top
bottom # Prettier top
httpie # Better curl
jq # JSON pretty printer and manipulator
powershell # Powershell
python3 # Python 3
tldr # TLDR pages
];
}

10
home/features/cli/exa.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, ... }: {
programs.exa = {
enable = true;
enableAliases = true;
extraOptions = [
"--group-directories-first"
];
git = true;
};
}

View file

@ -8,7 +8,10 @@
];
home.packages = with pkgs; [
awscli # AWS CLI
google-cloud-sdk # GCP CLI
hugo # Static site generator
kubectl # Container wrangler
nil # Nix LSP
# nix-inspect # See which pkgs are in your Path
nixfmt # Nix formatter

View file

@ -2,16 +2,22 @@
let
inherit (lib) mkIf;
hasPackage = pname: lib.any (p: p ? pname && p.name == pname) config.home.packages;
hasExa = hasPackage "exa";
hasKubectl = hasPackage "kubectl";
in
{
programs.fish = {
enable = true;
shellAbbrs = rec {
ccat = "egrep -v '^\s*(#|$)'";
ga = "git add";
gc = "git commit -m";
gp = "git push";
gs = "git status";
jqless = "jq -C | less -r";
ls = mkIf hasExa "exa";
k = mkIf hasKubectl "kubectl";
n = "nix";
sshpass = "ssh -o PubkeyAuthentication=no";
tf = "terraform";
tfyolo = "terraform apply -auto-approve";
vi = "vim";
@ -19,12 +25,12 @@ in
};
shellAliases = {
};
functions = {
# Disable greeting
fish_greeting = "";
ssh = "TERM=xterm command ssh $argv";
# Rebuild home-manager
switch-home = "home-manager switch -b backup --flake ${config.home.homeDirectory}/.dotfiles#$USER@$(hostname -s)";
};

20
home/features/cli/git.nix Normal file
View file

@ -0,0 +1,20 @@
{ lib, ... }:
let
email = lib.concatStringsSep "" [ "john@bo" "wdre.net" ];
in
{
programs.git = {
enable = lib.mkDefault true;
delta.enable = true;
aliases = {
graph = "log --decorate --oneline --graph";
fast-forward = "merge --ff-only";
};
userEmail = lib.mkDefault email;
userName = lib.mkDefault "John Bowdre";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
};
};
}

View file

@ -1,4 +1,4 @@
{ outputs, pkgs, lib, ... }: {
{ config, outputs, pkgs, lib, ... }: {
programs.vscode = {
enable = true;
@ -103,6 +103,10 @@
"yaml" = true;
};
"powershell.codeFormatting.useCorrectCasing" = true;
"powershell.powerShellAdditionalExePaths" = {
"pwsh" = "${config.home.homeDirectory}/.nix-profile/bin/pwsh";
};
"powershell.promptToUpdatePowerShell" = false;
"security.workspace.trust.untrustedFiles" = "open";
"vim.statusBarColorControl" = true;
"vim.useCtrlKeys" = false;

View file

@ -1,16 +0,0 @@
{ lib, ... }: {
programs.git = {
enable = lib.mkDefault true;
delta.enable = true;
aliases = {
graph = "log --decorate --oneline --graph";
fast-forward = "merge --ff-only";
};
userEmail = lib.mkDefault "john@bowdre.net";
userName = lib.mkDefault "John Bowdre";
extraConfig = {
init.defaultBranch = "main";
pull.rebase = false;
};
};
}