From a4b90ac45a4b8e8909479cee614d3d6e7f6474b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cyryl=20P=C5=82otnicki?= Date: Tue, 19 May 2020 18:10:36 +0100 Subject: [PATCH] refactoring --- .../configuration.nix} | 14 ++++----- nixos/{ => boxes/foureighty}/home.nix | 7 +++-- .../configuration.nix} | 0 nixos/boxes/skinnyv/home.nix | 30 +++++++++++++++++++ nixos/home-common.nix | 1 - nixos/up.sh | 7 ++--- nixos/variables.nix | 8 +++++ 7 files changed, 52 insertions(+), 15 deletions(-) rename nixos/boxes/{foureighty.nix => foureighty/configuration.nix} (83%) rename nixos/{ => boxes/foureighty}/home.nix (84%) rename nixos/boxes/{skinnyv.nix => skinnyv/configuration.nix} (100%) create mode 100644 nixos/boxes/skinnyv/home.nix create mode 100644 nixos/variables.nix diff --git a/nixos/boxes/foureighty.nix b/nixos/boxes/foureighty/configuration.nix similarity index 83% rename from nixos/boxes/foureighty.nix rename to nixos/boxes/foureighty/configuration.nix index 51d02a9e..fcfbf940 100644 --- a/nixos/boxes/foureighty.nix +++ b/nixos/boxes/foureighty/configuration.nix @@ -36,13 +36,13 @@ imports = [ /etc/nixos/hardware-configuration.nix - ../boot.nix - ../common.nix - ../gfx-intel.nix - ../zerotier.nix - ../gnome/system.nix - ../distributed-builds.nix - ../virtualbox.nix + ../../boot.nix + ../../common.nix + ../../gfx-intel.nix + ../../zerotier.nix + ../../distributed-builds.nix + ../../virtualbox.nix + ../../gnome/system.nix ]; diff --git a/nixos/home.nix b/nixos/boxes/foureighty/home.nix similarity index 84% rename from nixos/home.nix rename to nixos/boxes/foureighty/home.nix index c7db7129..7548ed88 100644 --- a/nixos/home.nix +++ b/nixos/boxes/foureighty/home.nix @@ -21,9 +21,10 @@ in home.file.".config/i3/status.toml".source = ~/dev/dotfiles/.config/i3/status-double-bat.toml; imports = [ - ./home-common.nix - ./programs/git.nix - ./gui.nix + ../../home-common.nix + ../../programs/git.nix + ../../gui.nix + ../../gnome/home.nix ]; } diff --git a/nixos/boxes/skinnyv.nix b/nixos/boxes/skinnyv/configuration.nix similarity index 100% rename from nixos/boxes/skinnyv.nix rename to nixos/boxes/skinnyv/configuration.nix diff --git a/nixos/boxes/skinnyv/home.nix b/nixos/boxes/skinnyv/home.nix new file mode 100644 index 00000000..927e4233 --- /dev/null +++ b/nixos/boxes/skinnyv/home.nix @@ -0,0 +1,30 @@ +{ config, pkgs, ... }: + +let + unstableTarball = fetchTarball https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz; + dotfiles = "/home/cyryl/dev/dotfiles"; +in + { + nixpkgs.config = { + allowUnfree = true; + packageOverrides = pkgs: { + unstable = import unstableTarball { + config = config.nixpkgs.config; + }; + }; + }; + + home.sessionVariables = { + TERMINAL="alacritty"; + }; + + home.file.".config/i3/status.toml".source = ~/dev/dotfiles/.config/i3/status-single-bat.toml; + + imports = [ + ../../home-common.nix + ../../programs/git.nix + ../../gui.nix + ../../i3/home.nix + ]; + + } diff --git a/nixos/home-common.nix b/nixos/home-common.nix index 64119ed0..b14269cc 100644 --- a/nixos/home-common.nix +++ b/nixos/home-common.nix @@ -23,7 +23,6 @@ ./programs.nix ./links.nix ./cli.nix - ./gnome/home.nix ]; } diff --git a/nixos/up.sh b/nixos/up.sh index 49d00134..2064ad47 100755 --- a/nixos/up.sh +++ b/nixos/up.sh @@ -5,25 +5,24 @@ set -e DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" DIR=`realpath "$DIR/../"` -CURL="curl -sSfL" - if [[ -z $DIR ]]; then echo "please set DIR" exit 1 fi +HOST=`hostname` DIR=`realpath $DIR` echo "using $DIR as the top level directory" cd $DIR git submodule update --init --recursive - mkdir -p ~/.config/Code/User ln -vfs "$DIR/.config/Code/User/settings.json" ~/.config/Code/User/settings.json ln -vfs "$DIR/.config/Code/User/keybindings.json" ~/.config/Code/User/keybindings.json mkdir -p ~/.local/share/applications -cp -v "$DIR/keeweb.desktop" ~/.local/share/applications/ ln -vfs "$DIR/tools" ~/ +ln -vsf "$DIR/nixos/boxes/$HOST/home.nix" ~/.config/nixpkgs/home.nix +sudo ln -vsf "$DIR/nixos/boxes/$HOST/configuration.nix" /etc/nixos/configuration.nix echo "all links done" sudo nix-channel --add https://nixos.org/channels/nixos-20.03 nixos diff --git a/nixos/variables.nix b/nixos/variables.nix new file mode 100644 index 00000000..7a7c7666 --- /dev/null +++ b/nixos/variables.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: +{ + options.variables = lib.mkOption { + type = lib.types.attrs; + default = { }; + }; + config._module.args.variables = config.variables; +}