aboutsummaryrefslogtreecommitdiffhomepage
path: root/mitamae/default.rb
blob: f561799dea18d7355b2f96a80698c973aa2b12ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
http_request ".bootstrap/nix-install" do
  url "https://nixos.org/nix/install"
end

execute "nix-install" do
  command "sh .bootstrap/nix-install --daemon"
  not_if "test -d /nix"
end

file "/etc/nix/nix.conf" do
  action :edit
  block do |content|
    content + "experimental-features = nix-command flakes\n"
  end
  not_if "grep -q 'nix-command flakes' /etc/nix/nix.conf"
end

home = ENV['HOME']

directory "#{home}/.local/state/nix/profiles"

# XDG Base Directories
directory "#{home}/.config"
directory "#{home}/.cache"
directory "#{home}/.local/share"
directory "#{home}/.local/state"

execute "home-manager switch" do
  command "nix run 'nixpkgs#home-manager' -- switch --flake '.##{node[:name]}'"
  not_if "type home-manager"
end

link "#{home}/.config/nvim" do
  to "#{home}/dotfiles/.config/nvim"
end
directory "#{home}/.config/skk"

if node[:profile] == "private"
  execute "rustup: install nightly toolchain" do
    command "rustup toolchain install nightly"
    not_if "rustup toolchain list | grep nightly"
  end
end

execute "home-manager switch" do
  command "nix run 'nixpkgs#home-manager' -- switch --flake '.##{node[:name]}'"
end