Skip to content

Commit

Permalink
New custom modules: java & docker
Browse files Browse the repository at this point in the history
  • Loading branch information
htngr committed Aug 22, 2024
1 parent 6fb4c5f commit 2b362b1
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 42 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
Add-AppxPackage codchi.msix -AllowUnsigned 2>&1
wsl --update --web-download 2>&1
wsl --set-default-version 2 2>&1
- run: |
Invoke-Pester ./tests/windows.ps1 2>&1
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
Expand All @@ -67,7 +68,7 @@ jobs:
- name: tests
run: |
cd codchi
nix develop . -c cargo run -- -vvv
nix develop . -c cargo run -- -vv
# - if: ${{ failure() }}
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
21 changes: 20 additions & 1 deletion codchi/shell.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{ mkShell
, writeShellScriptBin
, lib
, buildFHSUserEnv
, system
, fetchFromGitHub

, codchi

Expand All @@ -14,7 +17,7 @@
# , jetbrains

, cargo-watch
# , cargo-deps
# , cargo-deps
# , cargo-udeps
, cargo-bloat
, cargo-flamegraph
Expand Down Expand Up @@ -75,6 +78,22 @@ mkShell (lib.recursiveUpdate
cat "$CACHE"/dl/manifest*.json
'')

(buildFHSUserEnv {
name = "zed";
targetPkgs = _: [
# import directly to prevent polluting flake inputs
(import
(fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "nixos-unstable";
sha256 = "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=";
})
{ inherit system; }).zed-editor
];
runScript = "zed";
})

] ++ (codchi.nativeBuildInputs or [ ]);

shellHook = ''
Expand Down
31 changes: 11 additions & 20 deletions docs/src/docs/contrib/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,36 @@

- Docs
- [x] Usage
- [x] Option Reference
- Examples (Top 10 Languages?, Starter Templates?)
- Demo Video
- [X] Configuring Codchi
- ~~[x] Config / State dirs~~
- [ ] Examples (Top 10 Languages?, Starter Templates?)
- [ ] Demo Video
- NixOS options
- [x] timezone
- [ ] hosts / resolv.conf



- MVP Features
- [X] Shortcuts => Windows test
- [x] Local NixOS Config
- [X] Secrets (File / Env?)
- LXD:
- [ ] Linux: native nix
- [/] LXD:
- [X]
- [X] X11,
- Pulse, Wayland
- [/] Switch to native nix
- [ ] Pulse, Wayland
- [x] Nix package
- WSL
- [X] Host integration via `explorer.exe 'FILE'`
- [X] Graphical Launcher
- codchiw.exe?
- [ ] Logging / Error message via popup?
- [x] Logging / Error message via popup?
- gc
- [X] WSL: sparse vhdx => Docs
- [/] keep user-roots by direnv / nix build
- [/] simple tray icon
- [X] WSL
- [x] switch vcxsrv / wslg
- [X] vcxsrv tray icon switch
- Per machine status
- doctor status
- config.toml
- [ ] Codchi doctor (periodical check)

- Release v0.2.0
- Packages
- [X] MSIX: 🔒 Azure Code Signing Release
- [X] Linux: Nix
- [X] NixOS
- [/] Internal Testing & Release
Expand All @@ -48,15 +41,13 @@
- what happens if store stops and machines runs?
- how to handle network reset? => VcXsrv

- License
- [ ] License

- Future
- Custom certs auto adding
- => how to handle inside code machines?
- Announcement Post (Discourse, HN?, Product Hunt?)
- [/] GPU
- Better Logging
- [X] nix log integration (=> Progress Bar)
- WSL:
Terminal integration (#14)
- Devenv / nix develop / home-manager machines?
Expand Down
10 changes: 5 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
};
# nixvim = {
# url = "github:nix-community/nixvim";
# inputs.nixpkgs.follows = "nixpkgs";
# inputs.nixpkgs.follows = "nixpkgs";
# };

};
Expand All @@ -24,7 +24,7 @@
(self: _: {
codchi = self.callPackage ./codchi { inherit (inputs) self; platform = "linux"; };
codchi-windows = self.callPackage ./codchi { inherit (inputs) self; platform = "win"; };
codchi-utils = self.callPackage ./utils {};
codchi-utils = self.callPackage ./utils { };

mkContainer = type: driver: (import ./nix/container
{
Expand Down Expand Up @@ -70,12 +70,12 @@
inherit lib;

nixosModules.default = import ./nix/nixos;
nixosModules.codchi = { pkgs, ... }: {
nixosModules.codchi = {
nixpkgs.config.allowUnfree = true;
environment.systemPackages = [ pkgs.vscodium ];
environment.systemPackages = self.devShells.${system}.default.nativeBuildInputs;
# programs.neovim = {
# enable = true;
# package = pkgs.nixvim.makeNixvim (import ./editor.nix);
# package = pkgs.nixvim.makeNixvim (import ./editor.nix);
# };
programs.direnv = {
enable = true;
Expand Down
2 changes: 2 additions & 0 deletions nix/nixos/modules/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
imports = [
./recommended-config.nix
./java.nix
./docker.nix
];
}
4 changes: 1 addition & 3 deletions nix/nixos/modules/docker.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ in
type = types.bool;
default = false;
description = lib.mdDoc ''
Whether to enable the docker daemon.
This also adds the default user to the docker group and installs
docker-compose.
Whether to enable the docker daemon. This also adds the codchi user to the docker group and installs docker-compose.
'';
};

Expand Down
23 changes: 11 additions & 12 deletions nix/nixos/modules/java.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
let
inherit (lib) mkOption mkIf literalExpression types;

jdkPath = "/home/${config.codchi.defaultUser}/.jdks";
cfg = config.programs.java;
in
{
Expand All @@ -12,24 +11,24 @@ in
description = ''
List of JDKs which should be symlinked to ~/.jdks (for IDEs lik IntelliJ).
'';
example = literalExpression ''
example = literalExpression /* nix */ ''
{
openjdk19 = pkgs.jdk19;
}'';
default = { };
};

config = mkIf cfg.enable {
system.activationScripts.linkJDKs =
let
linkJDK = lib.mapAttrsToList (name: path:
"ln -fs ${path}/lib/openjdk ${jdkPath}/${name}");
in
''
[ -d "${jdkPath}" ] && rm -rf "${jdkPath}"
mkdir -p "${jdkPath}"
${lib.concatStringsSep "\n" (linkJDK cfg.packages)}
'';
systemd.tmpfiles.settings."codchi-jdks" =
lib.pipe cfg.packages [
(lib.mapAttrs' (name: path:
lib.nameValuePair
"${config.users.users.codchi.home}/.jdks/${name}"
{ L.argument = "${path}/lib/openjdk"; }
))
lib.zipAttrs
];

};

}

0 comments on commit 2b362b1

Please sign in to comment.