diff --git a/defaults.nix b/defaults.nix index 9d34495..c2e1d9c 100644 --- a/defaults.nix +++ b/defaults.nix @@ -2,15 +2,15 @@ { config, pkgs, lib, ... }: -{ - lib = { - buildLisp = import ./lib/buildLisp.nix {}; - }; +let + state-version = "20.03"; +in { imports = [ ./hardware-configuration.nix ./packages/local.nix ./config/local.nix + ]; nixpkgs.config.allowUnfree = true; @@ -25,6 +25,7 @@ boot bind binutils + # bpytop btrfs-progs bundix byobu @@ -33,6 +34,7 @@ certbot clang curl + doomEmacsInit dpkg enca fail2ban @@ -45,6 +47,7 @@ google-cloud-sdk guile heimdalFull + home-manager imagemagick ipfs iptables @@ -91,7 +94,7 @@ yubikey-personalization ]; - system.stateVersion = "20.03"; + system.stateVersion = state-version; system.autoUpgrade.enable = true; @@ -134,6 +137,9 @@ enableSSHSupport = true; }; + fish = { + enable = true; + }; }; services = { @@ -200,6 +206,7 @@ uid = 10000; createHome = true; description = "Niten"; + shell = pkgs.fish; extraGroups = ["wheel" "audio" "video" "disk" "floppy" "lp" "cdrom" "tape" "dialout" "adm" "input" "systemd-journal" "fudosys" "libvirtd"]; group = "users"; home = "/home/niten"; @@ -226,6 +233,11 @@ }; }; + home-manager.users = { + niten = import ./users/niten.nix { inherit config pkgs lib; }; + root = import ./users/root.nix { inherit config pkgs lib; }; + }; + systemd.services.fudo-environment-init = { enable = true; description = "Fudo common settings."; diff --git a/fudo/profiles/server.nix b/fudo/profiles/server.nix index a095170..8a45fdc 100644 --- a/fudo/profiles/server.nix +++ b/fudo/profiles/server.nix @@ -2,11 +2,7 @@ with lib; let - reboot-if-necessary = pkgs.writeScriptBin "reboot-if-necessary" '' - #!${pkgs.stdenv.shell} - - set -ne - + reboot-if-necessary = pkgs.writeShellScriptBin "reboot-if-necessary" '' if [ $# -ne 1 ]; then echo "FAILED: no sync file provided." exit 1 @@ -24,15 +20,11 @@ let exit 0 ''; - test-config = pkgs.writeScriptBin "fudo-test-config" '' - #!${pkgs.stdenv.shell} - - set -ne - + test-config = pkgs.writeShellScriptBin "fudo-test-config" '' if [ $# -gt 1 ]; then echo "usage: $0 [timeout]" exit 1 - elif [ $# -eq 1 ]; the + elif [ $# -eq 1 ]; then TIMEOUT=$1 else TIMEOUT=15m diff --git a/packages/local.nix b/packages/local.nix index fe7339a..6e82605 100644 --- a/packages/local.nix +++ b/packages/local.nix @@ -1,7 +1,6 @@ { pkgs, lib, ... }: -let - unstablePkgs = import {}; +let unstablePkgs = import { }; in { nixpkgs.config.packageOverrides = pkgs: rec { @@ -11,13 +10,16 @@ in { fetchurl = builtins.fetchurl; }; - minecraft-server_1_15_1 = pkgs.minecraft-server.overrideAttrs (oldAttrs: rec { - version = "1.15.1"; - src = builtins.fetchurl { - url = "https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar"; - sha256 = "a0c062686bee5a92d60802ca74d198548481802193a70dda6d5fe7ecb7207993"; - }; - }); + minecraft-server_1_15_1 = pkgs.minecraft-server.overrideAttrs + (oldAttrs: rec { + version = "1.15.1"; + src = builtins.fetchurl { + url = + "https://launcher.mojang.com/v1/objects/4d1826eebac84847c71a77f9349cc22afd0cf0a1/server.jar"; + sha256 = + "a0c062686bee5a92d60802ca74d198548481802193a70dda6d5fe7ecb7207993"; + }; + }); minecraft-current = pkgs.minecraft.overrideAttrs (oldAttrs: rec { src = builtins.fetchurl { @@ -29,26 +31,24 @@ in { # DON'T LEAVE THE HASH--Nix will think the package hasn't changed minecraft-server_1_16_1 = let version = "1.16.1"; - url = "https://launcher.mojang.com/v1/objects/a412fd69db1f81db3f511c1463fd304675244077/server.jar"; + url = + "https://launcher.mojang.com/v1/objects/a412fd69db1f81db3f511c1463fd304675244077/server.jar"; sha256 = "0nwkdig6yw4cnm2ld78z4j4xzhbm1rwv55vfxz0gzhsbf93xb0i7"; in (pkgs.minecraft-server.overrideAttrs (oldAttrs: rec { name = "minecraft-server-${version}"; inherit version; - src = pkgs.fetchurl { - inherit url sha256; - }; + src = pkgs.fetchurl { inherit url sha256; }; })); minecraft-server_1_16_2 = let version = "1.16.2"; - url = "https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar"; + url = + "https://launcher.mojang.com/v1/objects/c5f6fb23c3876461d46ec380421e42b289789530/server.jar"; sha256 = "0fbghwrj9b2y9lkn2b17id4ghglwvyvcc8065h582ksfz0zys0i9"; in (pkgs.minecraft-server.overrideAttrs (oldAttrs: rec { name = "minecraft-server-${version}"; inherit version; - src = pkgs.fetchurl { - inherit url sha256; - }; + src = pkgs.fetchurl { inherit url sha256; }; })); postgresql_11_gssapi = pkgs.postgresql_11.overrideAttrs (oldAttrs: rec { @@ -62,15 +62,11 @@ in { }); hll2380dw-cups = import ./hll2380dw-cups.nix { - inherit (pkgs) stdenv fetchurl makeWrapper cups dpkg a2ps ghostscript gnugrep gnused coreutils file perl which; + inherit (pkgs) + stdenv fetchurl makeWrapper cups dpkg a2ps ghostscript gnugrep gnused + coreutils file perl which; }; - # backplane-dns = import ./backplane-dns.nix { - # pkgs = pkgs; - # stdenv = pkgs.stdenv; - # fetchgit = pkgs.fetchgit; - # }; - backplane-dns-client = import ./backplane-dns-client.nix { pkgs = pkgs; stdenv = pkgs.stdenv; @@ -106,12 +102,40 @@ in { meta = with pkgs.lib; { description = "Google photos uploader, written in Go."; - homepage = https://github.com/int128/gpup; + homepage = "https://github.com/int128/gpup"; license = licenses.asl20; platforms = platforms.linux ++ platforms.darwin; }; }; + doomEmacsInit = pkgs.writeShellScriptBin "doom-emacs-init.sh" '' + DOOMDIR=$HOME/.emacs.d + + function clone_into() { + ${pkgs.git}/bin/git clone https://github.com/hlissner/doom-emacs.git $1 + } + + if [ ! -d "$DOOMDIR" ]; then + clone_into $DOOMDIR + $DOOMDIR/bin/doom -y install + fi + + if [ ! -f $DOOMDIR/bin/doom ]; then + # legacy...move to a backup + mv $HOME/.emacs.d $HOME/.emacs.d.bak + mv $HOME/.emacs $HOME/.emacs + clone_into $DOOMDIR + $DOOMDIR/bin/doom -y install + fi + + $DOOMDIR/bin/doom sync + + #if ${pkgs.emacs}/bin/emacsclient -ca false -e '(delete-frame)'; then + # # emacs is running + # ${pkgs.emacs}/bin/emacsclient -e '(doom/reload)' + #fi + ''; + localLispPackages = (import ./lisp { inherit lib; pkgs = unstablePkgs; @@ -121,5 +145,11 @@ in { inherit localLispPackages; pkgs = unstablePkgs; }; + + doom-emacs-config = pkgs.fetchgit { + url = "https://git.fudo.org/niten/doom-emacs.git"; + rev = "0613fcec820851e5b92f0ab493fb2078c6754b51"; + sha256 = "00zzghdxpyb6r22znxyknydcl5v7zfai1fvjfy4gwfw8211n4z2m"; + }; }; } diff --git a/users/niten.nix b/users/niten.nix new file mode 100644 index 0000000..ad6e070 --- /dev/null +++ b/users/niten.nix @@ -0,0 +1,41 @@ +{ config, pkgs, lib, ... }: + +let + name = "Niten"; + email = "niten@fudo.org"; + +in { + programs = { + git = { + enable = true; + userName = name; + userEmail = email; + }; + }; + + xresources.properties = { + "Xft.antialias" = 1; + "Xft.autohint" = 0; + "Xft.dpi" = 192; + "Xft.hinting" = 1; + "Xft.hintstyle" = "hintfull"; + "Xft.lcdfilter" = "lcddefault"; + }; + + services.gpg-agent.enable = true; + + # services.redshift = { + # enable = true; + # latitude = "51.0"; + # longitude = "47.0"; + # brightness.day = "1"; + # brightness.night = "0.5"; + # tray = true; + # }; + + home.file.".doom.d" = { + source = pkgs.doom-emacs-config; + recursive = true; + onChange = "${pkgs.doomEmacsInit}/bin/doom-emacs-init.sh"; + }; +} diff --git a/users/root.nix b/users/root.nix new file mode 100644 index 0000000..ab8b8a1 --- /dev/null +++ b/users/root.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: + +let + name = "Root"; + email = "root@fudo.org"; + +in { + programs = { + git = { + enable = true; + userName = name; + userEmail = email; + }; + }; + + services.gpg-agent.enable = true; + + home.file.".doom.d" = { + source = pkgs.doom-emacs-config; + recursive = true; + onChange = "${pkgs.doomEmacsInit}/bin/doom-emacs-init.sh"; + }; +}