Configure elnudrop

inky
Elnu 1 year ago
parent 5b8dbadbb1
commit efa926d33f

@ -7,16 +7,6 @@
options = "--delete-generations 8d";
};
networking = {
networkmanager.enable = true;
resolvconf.enable = false; # prevent default nameservers
nameservers = [ "1.1.1.1" "1.0.0.1" ];
extraHosts =
''
192.168.0.26 elnuhub
'';
};
time.timeZone = "America/Los_Angeles";
users.users.${user} = {

@ -11,6 +11,9 @@ let
(import ./home.nix)
inputs.nixvim.homeManagerModules.nixvim
];
desktopHmImports = hmImports ++ [
(import ./home-desktop.nix)
];
hmArgs = { inherit user configDir; };
in
{
@ -30,7 +33,7 @@ in
useUserPackages = true;
extraSpecialArgs = hmArgs;
users.${user} = {
imports = hmImports ++ [
imports = desktopHmImports ++ [
(import ./desktop/home.nix)
];
};
@ -59,7 +62,7 @@ in
useUserPackages = true;
extraSpecialArgs = hmArgs;
users.${user} = {
imports = hmImports ++ [
imports = desktopHmImports ++ [
(import ./thinkpads/home.nix)
];
};
@ -84,7 +87,7 @@ in
useUserPackages = true;
extraSpecialArgs = hmArgs;
users.${user} = {
imports = hmImports ++ [
imports = desktopHmImports ++ [
(import ./thinkpads/home.nix)
];
};
@ -108,7 +111,7 @@ in
useUserPackages = true;
extraSpecialArgs = { inherit user; };
users.${user} = {
imports = hmImports ++ [
imports = desktopHmImports ++ [
(import ./virtualbox/home.nix)
];
};
@ -116,4 +119,27 @@ in
}
];
};
elnudrop = lib.nixosSystem {
inherit system;
specialArgs = { inherit user; };
modules = [
./elnudrop
./configuration.nix
{
networking.hostName = "elnudrop";
}
home-manager.nixosModules.home-manager {
home-manager = {
useUserPackages = true;
extraSpecialArgs = { inherit user; };
users.${user} = {
imports = hmImports ++ [
(import ./elnudrop/home.nix)
];
};
};
}
];
};
}

@ -31,6 +31,12 @@ in
gvfs.enable = true; # For Trash
};
networking = {
networkmanager.enable = true;
resolvconf.enable = false; # prevent default nameservers
nameservers = [ "1.1.1.1" "1.0.0.1" ];
};
xdg.portal.enable = true;
environment.systemPackages = with pkgs; [ yubioath-flutter ];
@ -50,6 +56,11 @@ in
# To prevent `Unit dconf.service not found.` after theming GTK in HM
programs.dconf.enable = true;
networking.extraHosts = ''
192.168.0.26 elnuhub
24.199.72.8 elnudrop
'';
#sound.enable = true;
#hardware.pulseaudio.enable = true;
#nixpkgs.config.pulseaudio = true;

@ -0,0 +1,16 @@
{ lib, user, ... }:
let keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEQNlGt62dBMojVCX7EUIia+wfSDfLzV4YCPi8SZ2xrp elnu@elnu.com"
]; in
{
imports = [
./hardware-configuration.nix
# Remember to update for new instances
./networking.nix # generated at runtime by nixos-infect
];
services.do-agent.enable = true;
services.openssh.enable = true;
users.users.root.openssh.authorizedKeys.keys = keys;
users.users.${user}.openssh.authorizedKeys.keys = keys;
}

@ -0,0 +1,9 @@
{ modulesPath, ... }:
{
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ];
boot.loader.grub.device = "/dev/vda";
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ];
boot.initrd.kernelModules = [ "nvme" ];
fileSystems."/" = { device = "/dev/vda1"; fsType = "ext4"; };
}

@ -0,0 +1,13 @@
{ lib, ... }:
{
imports = [
../../modules/bash
../../modules/neovim
];
# Disable greeter, which is getting run twice somehow
programs.bash = with import ../../modules/bash/bashrc.nix; {
bashrcExtra = lib.mkForce bashrcExtra;
profileExtra = greeter;
};
}

@ -0,0 +1,34 @@
{ lib, ... }: {
# This file was populated at runtime with the networking
# details gathered from the active system.
networking = {
nameservers = [ "8.8.8.8"
];
defaultGateway = "146.190.144.1";
defaultGateway6 = {
address = "";
interface = "eth0";
};
dhcpcd.enable = false;
usePredictableInterfaceNames = lib.mkForce false;
interfaces = {
eth0 = {
ipv4.addresses = [
{ address="146.190.153.94"; prefixLength=20; }
{ address="10.48.0.5"; prefixLength=16; }
];
ipv6.addresses = [
{ address="fe80::20db:d1ff:fe51:4175"; prefixLength=64; }
];
ipv4.routes = [ { address = "146.190.144.1"; prefixLength = 32; } ];
# adding route /128... 'ip route add /128 dev eth0' failed: Error: any valid prefix is expected rather than "/128".
#ipv6.routes = [ { address = ""; prefixLength = 128; } ];
};
};
};
services.udev.extraRules = ''
ATTR{address}=="22:db:d1:51:41:75", NAME="eth0"
ATTR{address}=="82:4e:3d:d2:3a:9a", NAME="eth1"
'';
}

@ -0,0 +1,80 @@
{ inputs, config, pkgs, user, ... }:
let
theme = import ../modules/theme;
in
{
imports = [
./apps.nix
../modules/bash
../modules/emacs
../modules/fcitx5
../modules/firefox
../modules/git
../modules/i3
../modules/neovim
../modules/picom
../modules/polybar
../modules/ranger
../modules/rofi
../modules/startpage
../modules/terminal
../modules/todo-txt
../modules/fantasia-archive
];
home.file."./.background-image".source = theme.wallpaper;
programs.home-manager.enable = true;
xdg = {
userDirs = rec {
enable = true;
desktop = "${config.home.homeDirectory}"; # weird hack for disabling desktop in nautilus
documents = null;
music = null;
pictures = "${publicShare}/Pictures";
templates = null;
publicShare = "${config.home.homeDirectory}/Nextcloud";
};
mimeApps = {
enable = true;
defaultApplications = {
# Make sure directories are opened in nautilus
# .desktop files can be found in /etc/profiles/per-user/elnu/share/applications
# mimetypes can be found with the mimetype command:
# nix-shell -p perl536Packages.FileMimeInfo
"inode/directory" = "org.gnome.Nautilus.desktop";
"application/zip" = "org.gnome.FileRoller.desktop";
"application/octet-stream" = "org.gnome.GHex.desktop";
};
};
};
programs.direnv.enable = true;
gtk = {
enable = true;
iconTheme = theme.gtkIconTheme pkgs;
theme = theme.gtkTheme pkgs;
gtk3 = {
bookmarks = let
home = "file://${config.home.homeDirectory}/";
in [
"${home}Nextcloud"
"${home}Projects"
"${home}nix-config Config"
"sftp://elnu@elnuhub elnuhub"
];
# Remove minimize, maximize, and close buttons
extraConfig.gtk-decoration-layout = "appmenu:none";
};
gtk4.extraConfig.gtk-decoration-layout = "appmenu:none";
};
qt = {
enable = true;
platformTheme = "gtk";
};
}

@ -1,82 +1,6 @@
{ inputs, config, pkgs, user, ... }:
{ user, ... }:
let
theme = import ../modules/theme;
in
{
imports = [
./apps.nix
../modules/emacs
../modules/fcitx5
../modules/firefox
../modules/git
../modules/i3
../modules/neovim
../modules/picom
../modules/polybar
../modules/ranger
../modules/rofi
../modules/startpage
../modules/terminal
../modules/todo-txt
../modules/fantasia-archive
];
home.file."./.background-image".source = theme.wallpaper;
programs.home-manager.enable = true;
xdg = {
userDirs = rec {
enable = true;
desktop = "${config.home.homeDirectory}"; # weird hack for disabling desktop in nautilus
documents = null;
music = null;
pictures = "${publicShare}/Pictures";
templates = null;
publicShare = "${config.home.homeDirectory}/Nextcloud";
};
mimeApps = {
enable = true;
defaultApplications = {
# Make sure directories are opened in nautilus
# .desktop files can be found in /etc/profiles/per-user/elnu/share/applications
# mimetypes can be found with the mimetype command:
# nix-shell -p perl536Packages.FileMimeInfo
"inode/directory" = "org.gnome.Nautilus.desktop";
"application/zip" = "org.gnome.FileRoller.desktop";
"application/octet-stream" = "org.gnome.GHex.desktop";
};
};
};
programs.direnv.enable = true;
gtk = {
enable = true;
iconTheme = theme.gtkIconTheme pkgs;
theme = theme.gtkTheme pkgs;
gtk3 = {
bookmarks = let
home = "file://${config.home.homeDirectory}/";
in [
"${home}Nextcloud"
"${home}Projects"
"${home}nix-config Config"
"sftp://elnu@elnuhub elnuhub"
];
# Remove minimize, maximize, and close buttons
extraConfig.gtk-decoration-layout = "appmenu:none";
};
gtk4.extraConfig.gtk-decoration-layout = "appmenu:none";
};
qt = {
enable = true;
platformTheme = "gtk";
};
home = {
username = "${user}";
homeDirectory = "/home/${user}";
@ -86,78 +10,4 @@ in
stateVersion = "22.05";
};
programs.bash = {
enable = true;
shellAliases = {
g = "git";
ga = "g add";
gc = "g commit -m ";
gu = "ga . && gc";
gs = "g status";
gi = "g init";
gp = "g push";
gf = "g pull";
gC = "g clone";
goops = "g reset --soft HEAD^";
r = "ranger";
rm = "trash-put";
emacs = "emacsclient -nw";
# Make clear command clear scrollback
# https://github.com/kovidgoyal/kitty/issues/268#issuecomment-355765686
clear = "printf '\\E[H\\E[3J'";
};
bashrcExtra = ''
function v {
if [[ $# -eq 0 ]]; then
nvim ~/UNTITLED.md
else
nvim $1
fi
}
# Modify killall for wrapped applications, e.g. firefox
# killall firefox -> killall firefox || killall .firefox-wrapped
function killall {
`which killall` $1 || `which killall` .''${1}-wrapped
}
# pandoc macro
# pandoc document.md -> pandoc document.md -o document.pdf ...
function pdf {
pandoc $1 -o ''${1%.*}.pdf --pdf-engine=xelatex -V mainfont="mplus-1c-medium" -V colorlinks=true -V linkcolor=blue
}
# Change to directory when exiting ranger with Q
# https://github.com/ranger/ranger/issues/1554#issuecomment-491650123
function ranger {
local IFS=$'\t\n'
local tempfile="$(mktemp -t tmp.XXXXXX)"
local ranger_cmd=(
command
ranger
--cmd="map Q chain shell echo %d > "$tempfile"; quitall"
)
''${ranger_cmd[@]} "$@"
if [[ -f "$tempfile" ]] && [[ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]]; then
cd -- "$(cat "$tempfile")" || return
fi
command rm -f -- "$tempfile" 2>/dev/null
}
if [ -z $TERMINAL_STARTED ] && [ -z $IN_NIX_SHELL ]; then
pfetch
while true; do
f=`fortune`
if [ ''${#f} -lt 128 ]; then
echo "''${f}"
break
fi
done
TERMINAL_STARTED=1
fi
'';
};
}
}

@ -0,0 +1,52 @@
{
bashrcExtra = ''
function v {
if [[ $# -eq 0 ]]; then
nvim ~/UNTITLED.md
else
nvim $1
fi
}
# Modify killall for wrapped applications, e.g. firefox
# killall firefox -> killall firefox || killall .firefox-wrapped
function killall {
`which killall` $1 || `which killall` .''${1}-wrapped
}
# pandoc macro
# pandoc document.md -> pandoc document.md -o document.pdf ...
function pdf {
pandoc $1 -o ''${1%.*}.pdf --pdf-engine=xelatex -V mainfont="mplus-1c-medium" -V colorlinks=true -V linkcolor=blue
}
# Change to directory when exiting ranger with Q
# https://github.com/ranger/ranger/issues/1554#issuecomment-491650123
function ranger {
local IFS=$'\t\n'
local tempfile="$(mktemp -t tmp.XXXXXX)"
local ranger_cmd=(
command
ranger
--cmd="map Q chain shell echo %d > "$tempfile"; quitall"
)
''${ranger_cmd[@]} "$@"
if [[ -f "$tempfile" ]] && [[ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]]; then
cd -- "$(cat "$tempfile")" || return
fi
command rm -f -- "$tempfile" 2>/dev/null
}
'';
greeter = ''
pfetch
while true; do
f=`fortune`
if [ ''${#f} -lt 128 ]; then
echo "''${f}"
break
fi
done
TERMINAL_STARTED=1
'';
}

@ -0,0 +1,34 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ pfetch fortune ];
programs.bash = {
enable = true;
shellAliases = {
g = "git";
ga = "g add";
gc = "g commit -m ";
gu = "ga . && gc";
gs = "g status";
gi = "g init";
gp = "g push";
gf = "g pull";
gC = "g clone";
goops = "g reset --soft HEAD^";
r = "ranger";
rm = "trash-put";
emacs = "emacsclient -nw";
# Make clear command clear scrollback
# https://github.com/kovidgoyal/kitty/issues/268#issuecomment-355765686
clear = "printf '\\E[H\\E[3J'";
};
bashrcExtra = with import ./bashrc.nix; ''
${bashrcExtra}
if [ -z $TERMINAL_STARTED ] && [ -z $IN_NIX_SHELL ]; then
${greeter}
fi
'';
};
}
Loading…
Cancel
Save