Add flake and format
This commit is contained in:
parent
88f8cf17aa
commit
78cc721580
77
flake.lock
Normal file
77
flake.lock
Normal file
|
@ -0,0 +1,77 @@
|
|||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1716328825,
|
||||
"narHash": "sha256-ZpKwUK97Cxkocx+Jx2O91Qhza5zhS8i1G/YzacnGvCI=",
|
||||
"owner": "squarepear",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "bb663f89b88a2b4a3e2a46d2266cfc5e0fd9c619",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "squarepear",
|
||||
"ref": "gdtoolkit-4",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1708475490,
|
||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"id": "systems",
|
||||
"type": "indirect"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715940852,
|
||||
"narHash": "sha256-wJqHMg/K6X3JGAE9YLM0LsuKrKb4XiBeVaoeMNlReZg=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "2fba33a182602b9d49f0b2440513e5ee091d838b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
26
flake.nix
Normal file
26
flake.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
inputs = {
|
||||
nixpkgs.url = github:squarepear/nixpkgs/gdtoolkit-4;
|
||||
treefmt-nix.url = github:numtide/treefmt-nix;
|
||||
};
|
||||
|
||||
outputs = {
|
||||
self,
|
||||
nixpkgs,
|
||||
systems,
|
||||
treefmt-nix,
|
||||
}: let
|
||||
# Small tool to iterate over each systems
|
||||
eachSystem = f: nixpkgs.lib.genAttrs (import systems) (system: f nixpkgs.legacyPackages.${system});
|
||||
|
||||
# Eval the treefmt modules from ./treefmt.nix
|
||||
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
|
||||
in {
|
||||
# for `nix fmt`
|
||||
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
|
||||
# for `nix flake check`
|
||||
checks = eachSystem (pkgs: {
|
||||
formatting = treefmtEval.${pkgs.system}.config.build.check self;
|
||||
});
|
||||
};
|
||||
}
|
|
@ -11,13 +11,14 @@ var last_focused_day = null
|
|||
var new_focused_day = null
|
||||
var all_days = []
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var current_year = Time.get_date_dict_from_system().year
|
||||
|
||||
year_label.text = "%s" % current_year
|
||||
|
||||
for i in range (1, 13):
|
||||
for i in range(1, 13):
|
||||
var month = month_scene.instantiate()
|
||||
month.year = current_year
|
||||
month.month = i
|
||||
|
@ -50,7 +51,9 @@ func _on_fill_days(shift_clicked_day):
|
|||
return
|
||||
|
||||
# Determine if date is before or after the last focused day.
|
||||
var first_day = last_focused_day if last_focused_day.is_before(shift_clicked_day) else shift_clicked_day
|
||||
var first_day = (
|
||||
last_focused_day if last_focused_day.is_before(shift_clicked_day) else shift_clicked_day
|
||||
)
|
||||
var last_day = shift_clicked_day if first_day == last_focused_day else last_focused_day
|
||||
|
||||
# Toggle days between the two days.
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
class_name Day
|
||||
extends Button
|
||||
|
||||
|
||||
signal day_toggled(date)
|
||||
signal fill_days(date)
|
||||
|
||||
|
@ -9,7 +8,7 @@ var date = {}
|
|||
|
||||
|
||||
func _ready():
|
||||
set_toggle_mode(true);
|
||||
set_toggle_mode(true)
|
||||
toggled.connect(self._on_day_toggled)
|
||||
|
||||
|
||||
|
@ -35,5 +34,6 @@ func is_before(other_day):
|
|||
return true
|
||||
return false
|
||||
|
||||
|
||||
func dump():
|
||||
print("%s - %s - %s" % [date.year, date.month, date.day])
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
class_name Month
|
||||
extends Control
|
||||
|
||||
|
||||
signal day_toggled(date)
|
||||
signal fill_days(date)
|
||||
|
||||
|
@ -46,7 +45,7 @@ func _on_fill_days(day):
|
|||
|
||||
func find_days_in_month(year: int, month: int):
|
||||
assert(month >= 1 and month <= 12)
|
||||
if (month == 2 and is_leap_year(year)):
|
||||
if month == 2 and is_leap_year(year):
|
||||
return 29
|
||||
return DAYS_IN_MONTH[month - 1]
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
extends Node
|
||||
|
||||
|
||||
var periods = []
|
||||
var last_period = null
|
||||
|
||||
|
|
11
treefmt.nix
Normal file
11
treefmt.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{pkgs, ...}: {
|
||||
projectRootFile = "flake.nix";
|
||||
|
||||
programs = {
|
||||
gdformat = {
|
||||
enable = true;
|
||||
package = pkgs.gdtoolkit_4;
|
||||
};
|
||||
alejandra.enable = true;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue