revamp of nix organization

This commit is contained in:
Haak Saxberg 2021-10-05 23:42:21 -07:00
parent 01a48ac956
commit 4a4014bf59
20 changed files with 369 additions and 129 deletions

16
nix/build.sh Normal file
View file

@ -0,0 +1,16 @@
#! /bin/sh
install_home_manager() {
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
nix-channel --update
export NIX_PATH=$HOME/.nix-defexpr/channels${NIX_PATH:+:}$NIX_PATH
nix-shell '<home-manager>' -A install
}
build_system() {
sudo nix-channel --add https://nixos.org/channels/nixos-unstable nixos
sudo cp system/configuration.nix /etc/nixos/
sudo nixos-rebuild switch --upgrade
}

14
nix/home/commandline.nix Normal file
View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
let
defaultPkgs = with pkgs; [
lorri
p7zip
];
in
{
imports = [(import ./universal.nix)];
services.lorri.enable = true;
xdg.enable = true;
}

22
nix/home/desktop.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
let
defaultPkgs = with pkgs; [
calibre
dmenu
firefox
gnomecast
multilockscreen
signal-desktop
slack
vlc
zathura
];
in
{
imports = [(import ./commandline.nix)] ++ [(import ./programs/rofi)];
home = {
packages = defaultPkgs;
};
}

View file

@ -0,0 +1,9 @@
{pkgs, ...}:
let
in with builtins;
{
programs.direnv = {
enable = true;
stdlib = readFile ./direnvrc;
};
}

View file

@ -0,0 +1,22 @@
{ pkgs, ... }:
let
in
{
programs.git = {
enable = true;
userName = "Haak Saxberg";
userEmail = "haak.erling@gmail.com";
ignores = [
".idea/"
".direnv/"
".git-plans/"
".envrc"
".tools-info"
"*~"
"*.swp"
".yardoc/"
"doc/"
];
};
}

View file

@ -1,23 +1,5 @@
{ config, lib, pkgs, ... }: { pkgs, ... }:
with lib;
let let
git-plan = pkgs.rustPlatform.buildRustPackage rec {
name = "git-plan";
version = "1";
src = pkgs.fetchFromGitLab {
owner = "haaksmash";
repo = "git-plan";
rev = "518dcf15f3a46605f18569dd69b3b63d763e9439";
sha256 = "06gh3v35bdr0qsp459183br4hpmwm36d2r9fjyx9j5jfpzggqg51";
};
cargoSha256 = "17lr4pc2fjcgvx0p4vpkwx3mg9jadb4lygbwri0blmnkqql8xlh3";
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = [ pkgs.openssl ] ++ (if pkgs.stdenv.isDarwin then [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ] else []);
};
vim-goyo = pkgs.vimUtils.buildVimPlugin { vim-goyo = pkgs.vimUtils.buildVimPlugin {
name = "vim-goyo"; name = "vim-goyo";
src = pkgs.fetchFromGitHub { src = pkgs.fetchFromGitHub {
@ -47,89 +29,8 @@ let
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw"; sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
}; };
}; };
in in with builtins;
{ {
home.packages = with pkgs; [
git-plan
htop
jq
keybase
lastpass-cli
lorri
nnn
tree
ripgrep
zsh-autosuggestions
zsh-history-substring-search
zsh-syntax-highlighting
];
programs.direnv = {
enable = true;
stdlib = readFile ./direnv/direnvrc;
};
programs.git = {
enable = true;
userName = "Haak Saxberg";
userEmail = "haak.erling@gmail.com";
ignores = [
".idea/"
".direnv/"
".git-plans/"
".envrc"
".tools-info"
"*~"
"*.swp"
".yardoc/"
"doc/"
];
};
programs.zsh = {
enable = true;
enableCompletion = true;
defaultKeymap = "viins";
initExtra = readFile ./zsh/zshrc;
oh-my-zsh = {
enable = true;
theme = "typewritten";
custom = "$HOME/.oh-my-zsh/custom";
plugins = [
"vi-mode"
"git"
"z"
];
};
};
programs.kakoune = {
enable = true;
config = {
numberLines = {
enable = true;
highlightCursor = true;
relative = true;
};
};
plugins = with pkgs.kakounePlugins; [
kak-prelude
kak-fzf
kak-auto-pairs
kak-ansi
];
extraConfig = ''
colorscheme tomorrow-night
set -add global autoinfo normal
# FZF settings
map global normal <c-p> ': fzf-mode<ret>'
'';
};
programs.neovim = { programs.neovim = {
enable = true; enable = true;
vimAlias = true; vimAlias = true;
@ -218,7 +119,7 @@ in
lua << EOF lua << EOF
${readFile ( ${readFile (
pkgs.substituteAll { pkgs.substituteAll {
src = ./vim/nvim-lspconfig.lua; src = ./nvim-lspconfig.lua;
# since both of these are used for actually configuring the system, # since both of these are used for actually configuring the system,
# we'll probably always want them around. # we'll probably always want them around.
lua_ls = pkgs.sumneko-lua-language-server; lua_ls = pkgs.sumneko-lua-language-server;
@ -239,33 +140,7 @@ in
} }
]; ];
extraConfig = readFile ./vim/init.vim; extraConfig = readFile ./init.vim;
}; };
programs.tmux = {
enable = true;
tmuxinator = {
enable = true;
};
secureSocket = false;
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --no-ignore --follow --files --hidden --smart-case --glob \\\"!.git/*\\\"";
};
# services.lorri.enable = !pkgs.stdenv.isDarwin;
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.file.".tmux.conf" = {
source = ./tmux/tmux.conf;
};
home.file.".oh-my-zsh/custom/themes/typewritten.zsh-theme" = {
source = ./zsh/typewritten.zsh-theme;
};
} }

View file

@ -0,0 +1,7 @@
{ pkgs, ... }:
{
programs.rofi = {
enable = true;
};
}

View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
tmuxinator = {
enable = true;
};
secureSocket = false;
};
home.file.".tmux.conf" = {
source = ./tmux.conf;
};
}

View file

@ -0,0 +1,27 @@
{ pkgs, ... }:
with builtins; {
programs.zsh = {
enable = true;
enableCompletion = true;
defaultKeymap = "viins";
initExtra = readFile ./zshrc;
oh-my-zsh = {
enable = true;
theme = "typewritten";
custom = "$HOME/.oh-my-zsh/custom";
plugins = [
"vi-mode"
"git"
"z"
];
};
};
home.file.".oh-my-zsh/custom/themes/typewritten.zsh-theme" = {
source = ./typewritten.zsh-theme;
};
}

58
nix/home/universal.nix Normal file
View file

@ -0,0 +1,58 @@
{ pkgs, ... }:
let
git-plan = pkgs.rustPlatform.buildRustPackage rec {
name = "git-plan";
version = "1";
src = pkgs.fetchFromGitLab {
owner = "haaksmash";
repo = "git-plan";
rev = "518dcf15f3a46605f18569dd69b3b63d763e9439";
sha256 = "06gh3v35bdr0qsp459183br4hpmwm36d2r9fjyx9j5jfpzggqg51";
};
cargoSha256 = "17lr4pc2fjcgvx0p4vpkwx3mg9jadb4lygbwri0blmnkqql8xlh3";
nativeBuildInputs = [ pkgs.pkgconfig ];
buildInputs = [ pkgs.openssl ] ++ (if pkgs.stdenv.isDarwin then [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ] else []);
};
defaultPkgs = with pkgs; [
git-plan
jq
nnn
tree
ripgrep
zsh-autosuggestions
zsh-history-substring-search
zsh-syntax-highlighting
];
in with builtins;
{
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# no need for home-manager news, thanks
news.display = "silent";
nixpkgs.config = {
allowUnfree = true;
};
imports = [
(import ./programs/direnv)
(import ./programs/git)
(import ./programs/zsh)
(import ./programs/tmux)
(import ./programs/nvim)
];
programs.htop = {
enable = true;
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
defaultCommand = "rg --no-ignore --follow --files --hidden --smart-case --glob \\\"!.git/*\\\"";
};
}

View file

@ -0,0 +1,164 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
# do not fill the bootloader space with generations until it pops; only keep
# a reasonable number around.
boot.loader.systemd-boot.configurationLimit = 42;
# WiFi support requires kernel 5.13
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.loader.efi.canTouchEfiVariables = true;
hardware.bluetooth.enable = true;
networking.hostName = "framework"; # Define your hostname.
networking.networkmanager.enable = true;
# Create entries for /etc/wpa_supplicant.conf by running `wpa_passphrase SSID PASSWORD`
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.wlp170s0.useDHCP = true;
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n = {
defaultLocale = "en_US.UTF-8";
};
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
cachix
vim
wget
zsh
];
nixpkgs.config.allowUnfree = true;
# Open ports in the firewall.
networking.firewall = {
allowedTCPPorts = [
631 # CUPs port for printing
];
allowedUDPPorts = [
631
];
};
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
programs.gnupg.agent = { enable = true; enableSSHSupport = true; };
# List services that you want to enable:
# Enable fingerprint reading
services.fprintd.enable = true;
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Enable CUPS to print documents.
services.printing = {
enable = true;
drivers = [ pkgs.hplip ];
};
# enable avahi for printer discovery
services.avahi = {
enable = true;
nssmdns = true;
};
# Enable sound.
sound.enable = true;
hardware.pulseaudio = {
enable = true;
# The full package is necessary to allow bluetooth audio devices.
package = pkgs.pulseaudioFull;
};
# Enable touchpad support.
services.xserver.libinput.enable = true;
services.xserver = {
# Enable the X11 windowing system.
enable = true;
# Enable the GNOME Desktop Environment.
desktopManager.gnome.enable = true;
displayManager = {
defaultSession = "none+xmonad";
};
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
layout = "us";
# run the following command to swap escape and caps-lock keys, like a
# civilized person:
xkbOptions = "caps:swapescape";
};
services.syncthing = {
enable = true;
user = "haak";
dataDir = "/home/haak/synced";
configDir = "/home/haak/synced/.config/syncthing";
};
location.provider = "geoclue2";
# Define a user account. Don't forget to set a password with passwd.
users.users.haak = {
isNormalUser = true;
extraGroups = [
"wheel" # Enable sudo for the user.
"networkmanager" # Allow the user to manage networks
];
};
users.extraUsers.haak = {
shell = pkgs.zsh;
};
nix.trustedUsers = [ "root" "haak" ];
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "21.05"; # Did you read the comment?
system.autoUpgrade.enable = true;
}

12
nix/system/xmonad.nix Normal file
View file

@ -0,0 +1,12 @@
{ config, lib, pkgs, ...}:
{
displayManager = {
defaultSession = "none+xmonad";
};
windowManager.xmonad = {
enable = true;
enableContribAndExtras = true;
};
}