sudo apt install curl git
curl -L https://nixos.org/nix/install | sh -s -- --daemon
# follow prompts
git clone <this-repo> ~/nix
# edit files, replace my username with yours
cd ~
mkdir -p ~/.local/state/nix/profiles
nix --extra-experimental-features "nix-command flakes" run nixpkgs#home-manager -- --extra-experimental-features "nix-command flakes" switch --flake nix/#$USER
# should setup experimental features in config and install home-manager
home-manager switch --flake nix/#${USER}
Last active
April 8, 2024 22:00
-
-
Save stuart-warren/66bea8c9b23fdac317598ea46b3b97d0 to your computer and use it in GitHub Desktop.
Nix on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nix/flake.nix | |
{ | |
description = "My Ubuntu Nix"; | |
inputs = { | |
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; | |
home-manager = { | |
url = "github:nix-community/home-manager"; | |
inputs.nixpkgs.follows = "nixpkgs"; | |
}; | |
}; | |
outputs = { | |
nixpkgs, | |
home-manager, | |
... | |
}: let | |
# system = "aarch64-linux"; If you are running on ARM powered computer | |
system = "x86_64-linux"; | |
# myuser = builtins.getEnv "USER"; | |
myuser = "stuart-warren"; | |
pkgs = nixpkgs.legacyPackages.${system}; | |
in { | |
homeConfigurations = { | |
"${myuser}" = home-manager.lib.homeManagerConfiguration { | |
inherit pkgs; | |
modules = [ | |
./home-manager/home.nix | |
]; | |
}; | |
}; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nix/home-manager/home.nix | |
{ config, pkgs, ... }: | |
let | |
# myuser = builtins.getEnv "USER"; | |
# myhome = builtins.getEnv "HOME"; | |
myuser = "stuart-warren"; | |
myhome = "/home/${myuser}"; | |
in { | |
home.username = "${myuser}"; | |
home.homeDirectory = "${myhome}"; | |
home.stateVersion = "23.11"; | |
home.packages = with pkgs; [ | |
neofetch | |
neovim | |
git | |
curl | |
wget | |
font-awesome_5 | |
nerdfonts | |
]; | |
nix = { | |
package = pkgs.nix; | |
settings.experimental-features = [ "nix-command" "flakes" ]; | |
}; | |
programs = { | |
home-manager.enable = true; | |
fzf.enable = true; | |
jq.enable = true; | |
direnv = { | |
enable = true; | |
nix-direnv = { | |
enable = true; | |
}; | |
}; | |
git = { | |
enable = true; | |
userName = "stuart-warren"; | |
userEmail = "stuartwarren83@gmail.com"; | |
}; | |
ssh = { | |
enable = true; | |
addKeysToAgent = "yes"; | |
}; | |
oh-my-posh = { | |
enable = true; | |
enableZshIntegration = true; | |
useTheme = "catppuccin"; | |
}; | |
gnome-terminal = { | |
enable = true; | |
profile."b1dcc9dd-5262-4d8d-a863-c897e6d979b9" = { | |
font = "Monospace 8"; | |
default = true; | |
visibleName = "Terminal"; | |
}; | |
}; | |
zsh = { | |
enable = true; | |
enableAutosuggestions = true; | |
history = { | |
extended = true; | |
ignoreSpace = true; | |
share = false; | |
}; | |
profileExtra = "if [ -e $HOME/.nix-profile/etc/profile.d/nix.sh ]; then . $HOME/.nix-profile/etc/profile.d/nix.sh; fi"; | |
}; | |
}; | |
services = { | |
ssh-agent.enable = true; | |
}; | |
# https://nix-community.github.io/home-manager/options.xhtml#opt-xsession.windowMan> | |
xsession = { | |
enable = true; | |
windowManager.i3 = { | |
enable = true; | |
config = { | |
focus = { | |
followMouse = true; | |
mouseWarping = true; | |
}; | |
modifier = "Mod4"; | |
terminal = "gnome-terminal"; | |
window.titlebar = false; | |
}; | |
}; | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/share/xsessions/xsession.desktop | |
[Desktop Entry] | |
Name=XSession | |
Comment=This session uses the custom .xsession file from users home dir | |
Exec=/etc/X11/Xsession | |
Type=Application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment