Skip to content

Commit 2f56cc0

Browse files
committed
Reset git history now that we have a sensible config
Getting started with home manager Initial setup on ubuntu Refactor to use flakes/multiple machines Fixes Add vm install script test fix Wrong data type? nope fix A theory find the break and more pretty sure this is it and now... ... .... less complicated oops that var no longer exists add back machine def cursed undefined vars ..... ... oops .... Double impl? ... Ok now please? Ok Ok ok ok Fix use inputs add to import test For the love of god Nope nope oops oops users not user we are the say so now guest not gues ok ok zsh is default shell add experimental features enable flakes fix install script Install script is full pipeline Script fix
0 parents  commit 2f56cc0

File tree

9 files changed

+384
-0
lines changed

9 files changed

+384
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
result

flake.lock

+66
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
description = "Dovs nixos configs";
3+
inputs = {
4+
#Set to a specific 'unstable' commit. See https://status.nixos.org
5+
nixpkgs.url = "github:nixos/nixpkgs/931ab058daa7e4cd539533963f95e2bb0dbd41e6";
6+
nixos-hardware.url = github:NixOS/nixos-hardware/master;
7+
home-manager.url = "github:nix-community/home-manager/release-21.11";
8+
home-manager.inputs.nixpkgs.follows = "nixpkgs";
9+
};
10+
11+
outputs = inputs@{ self, home-manager, nixpkgs, ... }:
12+
let
13+
system = "x86_64-linux";
14+
in
15+
{
16+
nixosConfigurations = {
17+
nixosvm = inputs.nixpkgs.lib.nixosSystem {
18+
inherit system;
19+
modules = [
20+
./machines/nixosvm.nix
21+
home-manager.nixosModules.home-manager
22+
];
23+
specialArgs = { inherit inputs; };
24+
};
25+
};
26+
homeConfigurations =
27+
let
28+
username = "dovalperin";
29+
stateVersion = "21.11";
30+
baseConfiguration = {
31+
programs.home-manager.enable = true;
32+
home.username = "dovalperin";
33+
home.homeDirectory = "/home/dovalperin";
34+
};
35+
mkHomeConfig = cfg: home-manager.lib.homeManagerConfiguration {
36+
inherit username system stateVersion;
37+
homeDirectory = "/home/${username}";
38+
configuration = baseConfiguration // cfg;
39+
};
40+
in
41+
{
42+
"DovDev" = mkHomeConfig {
43+
imports = [
44+
./home.nix
45+
./machines/DovDevUbuntu.nix
46+
];
47+
};
48+
};
49+
};
50+
}
51+
52+

home.nix

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{ config, pkgs, ... }:
2+
3+
{
4+
imports = [ ./modules/zsh.nix ];
5+
# Home Manager needs a bit of information about you and the
6+
# paths it should manage.
7+
home.username = "dovalperin";
8+
home.homeDirectory = "/home/dovalperin";
9+
10+
home.packages = [
11+
pkgs.yarn
12+
pkgs.ripgrep
13+
pkgs.bat
14+
pkgs.exa
15+
pkgs.rustup
16+
];
17+
18+
dov = {
19+
zsh.enable = true;
20+
};
21+
22+
programs.home-manager.enable = true;
23+
24+
programs.fzf = {
25+
enable = true;
26+
enableZshIntegration = true;
27+
};
28+
29+
programs.git = {
30+
enable = true;
31+
userName = "Dov Alperin";
32+
userEmail = "dzalperin@gmail.com";
33+
delta.enable = true;
34+
extraConfig = {
35+
init = {
36+
defaultBranch = "main";
37+
};
38+
};
39+
};
40+
41+
programs.go = {
42+
enable = true;
43+
};
44+
45+
programs.jq = {
46+
enable = true;
47+
};
48+
}

machines/DovDevUbuntu.nix

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{ config, pkgs, ... }: {
2+
xdg.enable = true;
3+
xdg.mime.enable = true;
4+
targets.genericLinux.enable = true;
5+
programs.zsh.envExtra = ''
6+
if [ -e /home/dovalperin/.nix-profile/etc/profile.d/nix.sh ]; then . /home/dovalperin/.nix-profile/etc/profile.d/nix.sh; fi
7+
'';
8+
}

machines/nixosvm.nix

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{ config, pkgs, ... }:
2+
{
3+
imports =
4+
[
5+
../hardware-configuration.nix
6+
];
7+
boot.loader.systemd-boot.enable = true;
8+
boot.loader.efi.canTouchEfiVariables = true;
9+
10+
nix.extraOptions = ''
11+
experimental-features = nix-command flakes
12+
'';
13+
14+
networking.networkmanager.enable = true;
15+
networking.useDHCP = false; #global flag deprecated
16+
networking.interfaces.enp1s0.useDHCP = true;
17+
networking.hostName = "nixosvm";
18+
19+
services.xserver.enable = true;
20+
services.xserver.displayManager.gdm.enable = true;
21+
services.xserver.desktopManager.gnome.enable = true;
22+
environment.systemPackages = with pkgs; [
23+
gnomeExtensions.appindicator
24+
];
25+
services.udev.packages = with pkgs; [ gnome3.gnome-settings-daemon ];
26+
27+
users.users.dovalperin = {
28+
isNormalUser = true;
29+
extraGroups = [ "wheel" ];
30+
shell = pkgs.zsh;
31+
};
32+
33+
home-manager = {
34+
users = { dovalperin = ../home.nix; };
35+
useGlobalPkgs = true;
36+
};
37+
38+
# This value determines the NixOS release from which the default
39+
# settings for stateful data, like file locations and database versions
40+
# on your system were taken. It‘s perfectly fine and recommended to leave
41+
# this value at the release version of the first install of this system.
42+
# Before changing this value read the documentation for this option
43+
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
44+
system.stateVersion = "21.11"; # Did you read the comment?
45+
}

modules/zsh.nix

+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{ lib, config, pkgs, ... }:
2+
3+
with lib;
4+
5+
let
6+
cfg = config.dov.zsh;
7+
in
8+
{
9+
options.dov.zsh.enable = mkEnableOption "zsh config";
10+
11+
config = mkIf cfg.enable
12+
{
13+
programs.zsh = {
14+
enable = true;
15+
enableCompletion = false;
16+
oh-my-zsh = {
17+
enable = true;
18+
};
19+
shellAliases = {
20+
ls = "exa -GFh";
21+
cls = "clear";
22+
cat = "bat --paging=never";
23+
catl = "bat";
24+
catp = "bat --plain";
25+
reload = "source ~/.zshrc";
26+
open-profile = "vim ~/.zshrc";
27+
};
28+
sessionVariables = {
29+
SPACESHIP_PROMPT_ADD_NEWLINE = "false";
30+
SPACESHIP_PROMPT_SEPARATE_LINE = "false";
31+
SPACESHIP_USER_SHOW = "always";
32+
SPACESHIP_HOST_SHOW = "always";
33+
SPACESHIP_BATTERY_SHOW = " always";
34+
SPACESHIP_BATTERY_PREFIX = "🔋";
35+
ZSH_AUTOSUGGEST_STRATEGY = [ "history" ];
36+
GPG_TTY = "$(tty)";
37+
EDITOR = "vim";
38+
SPACESHIP_NIXSHELL_SHOW = "\${SPACESHIP_NIXSHELL_SHOW=true}";
39+
SPACESHIP_NIXSHELL_PREFIX = "\${SPACESHIP_NIXSHELL_PREFIX=\"nix-shell \"}";
40+
SPACESHIP_NIXSHELL_SUFFIX = "\${SPACESHIP_NIXSHELL_SUFFIX=\"$SPACESHIP_PROMPT_DEFAULT_SUFFIX\"}";
41+
SPACESHIP_NIXSHELL_SYMBOL = "\${SPACESHIP_NIXSHELL_SYMBOL=\"❄️\"}";
42+
};
43+
initExtra = ''
44+
bindkey '^ ' autosuggest-accept
45+
46+
spaceship_nixshell() {
47+
[[ $SPACESHIP_NIXSHELL_SHOW == false ]] && return
48+
[[ -z $IN_NIX_SHELL ]] && return
49+
spaceship::section \
50+
"yellow" \
51+
"$SPACESHIP_NIXSHELL_PREFIX" \
52+
"$SPACESHIP_NIXSHELL_SYMBOL $IN_NIX_SHELL" \
53+
"$SPACESHIP_NIXSHELL_SUFFIX"
54+
}
55+
56+
# This is a hack and assumes that nixshell will always be first if it is present at all
57+
if [ $SPACESHIP_PROMPT_ORDER[1] != nixshell ]; then
58+
SPACESHIP_PROMPT_ORDER=(nixshell $SPACESHIP_PROMPT_ORDER)
59+
fi
60+
61+
function move {
62+
if [ ! -n "$1" ]; then
63+
echo "Enter a directory name"
64+
elif [ -d $1 ]; then
65+
echo "\`$1' already exists"
66+
else
67+
mkdir $1 && cd $1
68+
fi
69+
}
70+
71+
function zsh_history_fix {
72+
mv ~/.zsh_history ~/.zsh_history_bad
73+
strings ~/.zsh_history_bad > ~/.zsh_history
74+
fc -R ~/.zsh_history
75+
rm ~/.zsh_history_bad
76+
}
77+
'';
78+
plugins = [
79+
{
80+
name = "spaceship-prompt";
81+
file = "spaceship.zsh-theme";
82+
src = pkgs.fetchFromGitHub {
83+
owner = "spaceship-prompt";
84+
repo = "spaceship-prompt";
85+
rev = "v3.16.1";
86+
sha256 = "sXnL57g5e7KboLXHzXxSD0+8aKPNnTX6Q2yVft+Pr7w=";
87+
};
88+
}
89+
{
90+
name = "zsh-autosuggestions";
91+
file = "zsh-autosuggestions.plugin.zsh";
92+
src = pkgs.fetchFromGitHub {
93+
owner = "zsh-users";
94+
repo = "zsh-autosuggestions";
95+
rev = "a411ef3e0992d4839f0732ebeb9823024afaaaa8";
96+
sha256 = "1g3pij5qn2j7v7jjac2a63lxd97mcsgw6xq6k5p7835q9fjiid98";
97+
};
98+
}
99+
{
100+
name = "nix-zsh-completions";
101+
file = "nix-zsh-completions.plugin.zsh";
102+
src = pkgs.fetchFromGitHub {
103+
owner = "spwhitt";
104+
repo = "nix-zsh-completions";
105+
rev = "468d8cf752a62b877eba1a196fbbebb4ce4ebb6f";
106+
sha256 = "16r0l7c1jp492977p8k6fcw2jgp6r43r85p6n3n1a53ym7kjhs2d";
107+
};
108+
}
109+
{
110+
name = "fzf-tab";
111+
file = "fzf-tab.plugin.zsh";
112+
src = pkgs.fetchFromGitHub {
113+
owner = "Aloxaf";
114+
repo = "fzf-tab";
115+
rev = "190500bf1de6a89416e2a74470d3b5cceab102ba";
116+
sha256 = "1dipsy0s67fr47ig5559bcp1h5yn8rdjshhs8zsq7j8plvvh99qb";
117+
};
118+
}
119+
{
120+
name = "nix-shell";
121+
file = "nix-shell.plugin.zsh";
122+
src = pkgs.fetchFromGitHub {
123+
owner = "chisui";
124+
repo = "zsh-nix-shell";
125+
rev = "v0.4.0";
126+
sha256 = "037wz9fqmx0ngcwl9az55fgkipb745rymznxnssr3rx9irb6apzg";
127+
};
128+
}
129+
{
130+
name = "zsh-syntax-highlighting";
131+
file = "zsh-syntax-highlighting.plugin.zsh";
132+
src = pkgs.fetchFromGitHub {
133+
owner = "zsh-users";
134+
repo = "zsh-syntax-highlighting";
135+
rev = "c7caf57ca805abd54f11f756fda6395dd4187f8a";
136+
sha256 = "0cvz071fz67wf8kjavizyq6adm206945byqlv9ib59c96yl8zsri";
137+
};
138+
}
139+
];
140+
};
141+
};
142+
}

scripts/vminstall

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env bash
2+
3+
parted /dev/vda -- mklabel gpt
4+
parted /dev/vda -- mkpart primary 512MiB -2GiB
5+
parted /dev/vda -- mkpart primary linux-swap -2GiB 100%
6+
parted /dev/vda -- mkpart ESP fat32 1MiB 512MiB
7+
parted /dev/vda -- set 3 esp on
8+
mkfs.ext4 -L nixos /dev/vda1
9+
mkswap -L swap /dev/vda2
10+
mkfs.fat -F 32 -n boot /dev/vda3
11+
mount /dev/disk/by-label/nixos /mnt
12+
mkdir -p /mnt/boot
13+
mount /dev/disk/by-label/boot /mnt/boot
14+
mkdir -p /mnt/nixos
15+
git clone https://github.com/DAlperin/dotfiles.git /mnt/nixos
16+
nixos-generate-config --show-hardware-config | tee /mnt/nixos/hardware-configuration.nix
17+
cd /mnt/nixos
18+
git add hardware-configuration.nix
19+
nixos-install --root /mnt --impure --flake .#nixosvm

ubuntuSwitch

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/env bash
2+
nix build .#homeConfigurations.DovDev.activationPackage
3+
./result/activate

0 commit comments

Comments
 (0)