Skip to content

Commit

Permalink
Drop podman-desktop except macOS and drop mise from all dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Jul 8, 2024
1 parent 4467e92 commit 9e573fc
Show file tree
Hide file tree
Showing 18 changed files with 68 additions and 57 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
which ruby
which irb
which ssh
which podman
- name: Make sure the $PATH for bash is not overridden as like the `path_helper`. See https://github.com/kachick/dotfiles/issues/503
run: |
[[ "$(zsh -c 'which bash')" == "$HOME/.nix-profile/bin/bash" ]]
Expand All @@ -74,6 +75,7 @@ jobs:
zsh -c 'irb --version'
zsh -c 'alacritty --version'
zsh -c 'ssh -V'
zsh -c 'podman version'
- name: Run homemade commands
run: |
zsh -c 'la ~; lat ~/.config'
Expand Down
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,33 @@ Some tools are not yet fully automated, read each docs.
- `user@linux` # Used in container
- `kachick@linux`

### Podman on Ubuntu

1. Install uidmap without Nix for use of podman even if the podman will be installed from nixpkgs

- "shadow" in nixpkg is not enough for podman - https://github.com/NixOS/nixpkgs/issues/138423

```bash
sudo apt-get install --assume-yes uidmap
```

1. Make sure putting /etc/containers/policy.json, it is not a home-manager role

```bash
sudo mkdir -p /etc/containers
/etc/containers
curl -OL https://raw.githubusercontent.com/kachick/dotfiles/main/config/containers/policy.json
```

1. Make sure the cgroup v1 is disabled if you on WSL, See [the docs](windows/WSL/README.md)

## macOS

Activate `kachick@macbook` as Linux

## Windows

After installing [WSL2](windows/docs/WSL.md), you can activate home-manager and [NixOS-WSL](https://github.com/nix-community/NixOS-WSL).\
After installing [WSL2](windows/WSL/README.md), you can activate home-manager and [NixOS-WSL](https://github.com/nix-community/NixOS-WSL).\
Read [Windows README](windows/README.md) and [CI](.github/workflows/windows.yml) for further detail.

## Note
Expand All @@ -86,11 +106,4 @@ If you are developing this repository, the simple reactivation is as follows.
makers apply user@linux
```

Using podman may require to install some dependencies without Nix

```bash
# "shadow" in nixpkg is not enough for podman - https://github.com/NixOS/nixpkgs/issues/138423
sudo apt-get install uidmap
```

If you encounter any errors in the above steps, Check and update CI and [wiki](https://github.com/kachick/dotfiles/wiki).
3 changes: 3 additions & 0 deletions cmd/winit-conf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ func provisioners() []provisioner {
newProvisioner([]string{"windows", "komorebi", "applications.yaml"}, []string{homePath, "applications.yaml"}),
newProvisioner([]string{"windows", "komorebi", "komorebi.json"}, []string{homePath, "komorebi.json"}),
newProvisioner([]string{"windows", "whkd", "whkdrc"}, []string{homePath, ".config", "whkd", "whkdrc"}),

// You may need to custom the memory size
newProvisioner([]string{"windows", "WSL", ".wslconfig"}, []string{homePath, ".wslconfig"}),
}
}

Expand Down
14 changes: 14 additions & 0 deletions config/containers/policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
"": [{"type":"insecureAcceptAnything"}]
}
}
}
1 change: 0 additions & 1 deletion home-manager/bash.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
programs.direnv.enableBashIntegration = true;
programs.zoxide.enableBashIntegration = true;
programs.fzf.enableBashIntegration = true;
programs.mise.enableBashIntegration = true;
# Intentionally disabled for keeping stable bash
programs.zellij.enableBashIntegration = false;

Expand Down
17 changes: 0 additions & 17 deletions home-manager/common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -265,23 +265,6 @@
enable = true;
};

# https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/mise.nix
programs.mise = {
enable = true;
globalConfig = {
plugins = {
# It is not registered in asdf-vm/plugins and does not appear to be actively maintained. So specify the ref here
# https://github.com/tvon/asdf-podman/tree/974e0fbb6051aaea0a685d8b14587113dfba9173
podman = "https://github.com/tvon/asdf-podman.git#974e0fbb6051aaea0a685d8b14587113dfba9173";
};
};
settings = {
status = {
missing_tools = "never";
};
};
};

# https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/bat.nix
programs.bat = {
enable = true;
Expand Down
1 change: 0 additions & 1 deletion home-manager/fish.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
# programs.direnv.enableFishIntegration = true;
programs.zoxide.enableFishIntegration = true;
programs.fzf.enableFishIntegration = true;
programs.mise.enableFishIntegration = true;
# Avoid nested zellij in host and remote login as container
programs.zellij.enableFishIntegration = false;

Expand Down
8 changes: 5 additions & 3 deletions home-manager/packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ with pkgs;
gawk
netcat # `nc`

mise # alt asdf

git
gh
ghq
Expand Down Expand Up @@ -125,6 +123,11 @@ with pkgs;
# zlib
# libyaml
# openssl

# - Enable special module for Nix OS.
# - Linux package does not contains podman-remote, you should install uidmap with apt and use this as actual engine
# - In darwin, this package will be needed as a podman-remote, you should manually install podman-desktop
podman
]
++ (with homemade-pkgs; [
la
Expand Down Expand Up @@ -154,5 +157,4 @@ with pkgs;
++ (lib.optionals stdenv.isDarwin [
# https://github.com/NixOS/nixpkgs/issues/240819
pinentry_mac
homemade-pkgs.podman
])
5 changes: 1 addition & 4 deletions home-manager/wsl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,5 @@
};
};

home.packages = [
pkgs.wslu
homemade-pkgs.podman
];
home.packages = [ pkgs.wslu ];
}
1 change: 0 additions & 1 deletion home-manager/zsh.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
programs.direnv.enableZshIntegration = true;
programs.zoxide.enableZshIntegration = true;
programs.fzf.enableZshIntegration = true;
programs.mise.enableZshIntegration = true;
# Avoid nested zellij in host and remote login as container
programs.zellij.enableZshIntegration = false;

Expand Down
15 changes: 1 addition & 14 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ rec {
updeps = pkgs.writeShellApplication {
name = "updeps";
# Do no include "nix" in inputs: https://github.com/NixOS/nix/issues/5473
runtimeInputs = with pkgs; [ mise ];
runtimeInputs = [ ];
text = ''
if [ -f /etc/NIXOS ]; then
echo 'Needless this updater for NixOS, so exit with nothing'
Expand All @@ -120,8 +120,6 @@ rec {
esac
sudo -i nix upgrade-nix
mise plugins update
'';
};

Expand Down Expand Up @@ -160,17 +158,6 @@ rec {
'';
};

# Why need the wrapper?
# nixpkgs provide 4.9.3 is not including podman-remote.
# https://github.com/NixOS/nixpkgs/blob/e3474e1d1e53b70e2b2af73ea26d6340e82f6b8b/pkgs/applications/virtualization/podman/default.nix#L104-L108
podman = pkgs.writeShellApplication {
name = "podman";
runtimeInputs = with pkgs; [ mise ];
text = ''
mise exec podman@latest -- podman "$@"
'';
};

zj = pkgs.writeShellApplication {
name = "zj";
runtimeInputs = with pkgs; [
Expand Down
2 changes: 1 addition & 1 deletion windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package dotfiles

import "embed"

//go:embed windows/*
//go:embed all:windows/*
//go:embed config/powershell/*
//go:embed config/starship/*
//go:embed config/wezterm/*
Expand Down
File renamed without changes.
10 changes: 9 additions & 1 deletion windows/docs/Podman.md → windows/Podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

## Containers?

I now prefer podman over docker and singularity.\
I now prefer podman over docker and singularity.

## How to install

Use one of following.

- Directly Install podman into the debian family # Now using. The whole steps are written in [README](../README.md) and [WSL](WSL/README.md)
- [Install podman-desktop](./Podman-Remote.md), it easy to install but requires annoy setups with another WSL instance. # Old way, Written in this file

It needs special WSL distribution. How to run it from standard WSL ubuntu is written in [this document](https://podman-desktop.io/docs/podman/accessing-podman-from-another-wsl-instance).\
Make sure you are using podman binary as podman-remote, nixpkgs product does not satisfy.\
This repository aliases podman command to mise installed binary.
Expand Down
File renamed without changes.
4 changes: 4 additions & 0 deletions windows/WSL/.wslconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[wsl2]
memory=32GB
localhostForwarding=true
kernelCommandLine=cgroup_no_v1=all
7 changes: 7 additions & 0 deletions windows/docs/WSL.md → windows/WSL/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,10 @@ wsl.exe --distribution "Ubuntu-24.04"
```

Setup nix and activate home-manager as written in [README](../README.md) with `kachick@wsl`

Disable cgroup v1 as putting [.wslconfig](.wslconfig) and restart for setting up podman

```pwsh
winit-conf.exe generate -path=windows/WSL/.wslconfig > %UserProfile%\.wslconfig
wsl.exe --shutdown
```
6 changes: 0 additions & 6 deletions windows/winget/winget-pkgs-basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
{
"PackageIdentifier": "Balena.Etcher"
},
{
"PackageIdentifier": "RedHat.Podman"
},
{
"PackageIdentifier": "RedHat.Podman-Desktop"
},
{
"PackageIdentifier": "Microsoft.WindowsTerminal"
},
Expand Down

0 comments on commit 9e573fc

Please sign in to comment.